Main Page | Modules | Class Hierarchy | Class List | Directories | File List | Class Members | File Members | Related Pages

os_factory.cpp

00001 /*****************************************************************************
00002  * os_factory.cpp
00003  *****************************************************************************
00004  * Copyright (C) 2003 the VideoLAN team
00005  * $Id: os_factory.cpp 11664 2005-07-09 06:17:09Z courmisch $
00006  *
00007  * Authors: Cyril Deguet     <[email protected]>
00008  *          Olivier Teulière <[email protected]>
00009  *
00010  * This program is free software; you can redistribute it and/or modify
00011  * it under the terms of the GNU General Public License as published by
00012  * the Free Software Foundation; either version 2 of the License, or
00013  * (at your option) any later version.
00014  *
00015  * This program is distributed in the hope that it will be useful,
00016  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018  * GNU General Public License for more details.
00019  *
00020  * You should have received a copy of the GNU General Public License
00021  * along with this program; if not, write to the Free Software
00022  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
00023  *****************************************************************************/
00024 
00025 #include "os_factory.hpp"
00026 
00027 #ifdef X11_SKINS
00028 #include "../x11/x11_factory.hpp"
00029 #elif defined WIN32_SKINS
00030 #include "../win32/win32_factory.hpp"
00031 #elif defined MACOSX_SKINS
00032 #include "../macosx/macosx_factory.hpp"
00033 #endif
00034 
00035 OSFactory *OSFactory::instance( intf_thread_t *pIntf )
00036 {
00037     if( ! pIntf->p_sys->p_osFactory )
00038     {
00039         OSFactory *pOsFactory;
00040 #ifdef X11_SKINS
00041         pOsFactory = new X11Factory( pIntf );
00042 #elif defined WIN32_SKINS
00043         pOsFactory = new Win32Factory( pIntf );
00044 #elif defined MACOSX_SKINS
00045         pOsFactory = new MacOSXFactory( pIntf );
00046 #else
00047 #error "No OSFactory implementation !"
00048 #endif
00049 
00050         if( pOsFactory->init() )
00051         {
00052             // Initialization succeeded
00053             pIntf->p_sys->p_osFactory = pOsFactory;
00054         }
00055         else
00056         {
00057             // Initialization failed
00058             delete pOsFactory;
00059         }
00060     }
00061     return pIntf->p_sys->p_osFactory;
00062 }
00063 
00064 
00065 void OSFactory::destroy( intf_thread_t *pIntf )
00066 {
00067     if( pIntf->p_sys->p_osFactory )
00068     {
00069         delete pIntf->p_sys->p_osFactory;
00070         pIntf->p_sys->p_osFactory = NULL;
00071     }
00072 }
00073 

Generated on Tue Dec 20 10:14:42 2005 for vlc-0.8.4a by  doxygen 1.4.2