Blender V2.61 - r43446

GHOST_ISystemPaths.cpp

Go to the documentation of this file.
00001 /*
00002  * ***** BEGIN GPL LICENSE BLOCK *****
00003  *
00004  * This program is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU General Public License
00006  * as published by the Free Software Foundation; either version 2
00007  * of the License, or (at your option) any later version.
00008  *
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software Foundation,
00016  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00017  *
00018  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
00019  * All rights reserved.
00020  *
00021  * The Original Code is: all of this file.
00022  *
00023  * Contributor(s): none yet.
00024  *
00025  * ***** END GPL LICENSE BLOCK *****
00026  */
00027 
00040 #include "GHOST_ISystemPaths.h"
00041 
00042 #ifdef WIN32
00043 #   include "GHOST_SystemPathsWin32.h"
00044 #else
00045 #   ifdef __APPLE__
00046 #       ifdef GHOST_COCOA
00047 #           include "GHOST_SystemPathsCocoa.h"
00048 #       else
00049 #           include "GHOST_SystemPathsCarbon.h"
00050 #       endif
00051 #   else
00052 #       include "GHOST_SystemPathsX11.h"
00053 #   endif
00054 #endif
00055 
00056 
00057 GHOST_ISystemPaths* GHOST_ISystemPaths::m_systemPaths = 0;
00058 
00059 
00060 GHOST_TSuccess GHOST_ISystemPaths::create()
00061 {
00062     GHOST_TSuccess success;
00063     if (!m_systemPaths) {
00064 #ifdef WIN32
00065         m_systemPaths = new GHOST_SystemPathsWin32 ();
00066 #else
00067 #   ifdef __APPLE__
00068 #       ifdef GHOST_COCOA
00069             m_systemPaths = new GHOST_SystemPathsCocoa ();
00070 #       else
00071             m_systemPaths = new GHOST_SystemPathsCarbon ();
00072 #       endif
00073 #   else 
00074         m_systemPaths = new GHOST_SystemPathsX11 ();
00075 #   endif
00076 #endif 
00077         success = m_systemPaths != 0 ? GHOST_kSuccess : GHOST_kFailure;
00078     }
00079     else {
00080         success = GHOST_kFailure;
00081     }
00082     return success;
00083 }
00084 
00085 GHOST_TSuccess GHOST_ISystemPaths::dispose()
00086 {
00087     GHOST_TSuccess success = GHOST_kSuccess;
00088     if (m_systemPaths) {
00089         delete m_systemPaths;
00090         m_systemPaths = 0;
00091     }
00092     else {
00093         success = GHOST_kFailure;
00094     }
00095     return success;
00096 }
00097 
00098 GHOST_ISystemPaths* GHOST_ISystemPaths::get()
00099 {
00100     if (!m_systemPaths) {
00101         create();
00102     }
00103     return m_systemPaths;
00104 }
00105 
00106 
00107