Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages
initapp.h
Go to the documentation of this file.00001 /* 00002 Copyright (C) 1998-2001 by Jorrit Tyberghein 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Library General Public 00006 License as published by the Free Software Foundation; either 00007 version 2 of the License, or (at your option) any later version. 00008 00009 This library 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 GNU 00012 Library General Public License for more details. 00013 00014 You should have received a copy of the GNU Library General Public 00015 License along with this library; if not, write to the Free 00016 Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00017 */ 00018 00019 #ifndef __CS_INITAPP_H__ 00020 #define __CS_INITAPP_H__ 00021 00030 #include "csextern.h" 00031 00032 #include "csutil/array.h" 00033 #include "csutil/csstring.h" 00034 #include "csutil/scf.h" 00035 #include "iengine/engine.h" 00036 #include "igraphic/imageio.h" 00037 #include "imap/loader.h" 00038 #include "imap/saver.h" 00039 #include "iutil/evdefs.h" 00040 #include "iutil/vfs.h" 00041 #include "ivaria/conout.h" 00042 #include "ivaria/reporter.h" 00043 #include "ivaria/stdrep.h" 00044 #include "ivideo/graph3d.h" 00045 #include "ivideo/fontserv.h" 00046 00047 struct iObjectRegistry; 00048 struct iEvent; 00049 struct iEventHandler; 00050 struct iEventQueue; 00051 struct iPluginManager; 00052 struct iVirtualClock; 00053 struct iCommandLineParser; 00054 struct iConfigManager; 00055 struct iVerbosityManager; 00056 00060 00061 #define CS_REQUEST_PLUGIN(Name,Interface) Name, scfInterfaceTraits<Interface>::GetName(), \ 00062 scfInterfaceTraits<Interface>::GetID(), scfInterfaceTraits<Interface>::GetVersion() 00063 00064 // !!! NOTE !!! 00065 // When editing this list, you *must* ensure that initapp.h #include the 00066 // appropriate header for each SCF interface mentioned by a CS_REQUEST_PLUGIN() 00067 // invocation. This is necessary to guarantee that the interface-specialized 00068 // version of scfInterfaceTraits<> is seen by clients rather than the non-specialized 00069 // template. 00070 00072 #define CS_REQUEST_END \ 00073 (const char*)0 00074 00075 #define CS_REQUEST_VFS \ 00076 CS_REQUEST_PLUGIN("crystalspace.kernel.vfs", iVFS) 00077 00078 #define CS_REQUEST_FONTSERVER \ 00079 CS_REQUEST_PLUGIN("crystalspace.font.server.default", iFontServer) 00080 00081 #define CS_REQUEST_IMAGELOADER \ 00082 CS_REQUEST_PLUGIN("crystalspace.graphic.image.io.multiplexer", iImageIO) 00083 00084 #define CS_REQUEST_NULL3D \ 00085 CS_REQUEST_PLUGIN("crystalspace.graphics3d.null",iGraphics3D) 00086 00087 #define CS_REQUEST_SOFTWARE3D \ 00088 CS_REQUEST_PLUGIN("crystalspace.graphics3d.software",iGraphics3D) 00089 00090 #define CS_REQUEST_OPENGL3D \ 00091 CS_REQUEST_PLUGIN("crystalspace.graphics3d.opengl", iGraphics3D) 00092 00093 #define CS_REQUEST_ENGINE \ 00094 CS_REQUEST_PLUGIN("crystalspace.engine.3d", iEngine) 00095 00096 #define CS_REQUEST_LEVELLOADER \ 00097 CS_REQUEST_PLUGIN("crystalspace.level.loader", iLoader) 00098 00099 #define CS_REQUEST_LEVELSAVER \ 00100 CS_REQUEST_PLUGIN("crystalspace.level.saver", iSaver) 00101 00102 #define CS_REQUEST_REPORTER \ 00103 CS_REQUEST_PLUGIN("crystalspace.utilities.reporter", iReporter) 00104 00105 #define CS_REQUEST_REPORTERLISTENER \ 00106 CS_REQUEST_PLUGIN("crystalspace.utilities.stdrep", iStandardReporterListener) 00107 00108 #define CS_REQUEST_CONSOLEOUT \ 00109 CS_REQUEST_PLUGIN("crystalspace.console.output.simple", iConsoleOutput) 00110 00115 typedef bool (*csEventHandlerFunc) (iEvent&); 00116 00117 00128 class CS_CRYSTALSPACE_EXPORT csPluginRequest 00129 { 00130 private: 00131 csString class_name; 00132 csString interface_name; 00133 scfInterfaceID interface_id; 00134 int interface_version; 00135 void set(csPluginRequest const&); 00136 public: 00137 csPluginRequest(csString class_name, csString interface_name, 00138 scfInterfaceID interface_id, int interface_version); 00139 csPluginRequest(csPluginRequest const& r) { set(r); } 00140 csPluginRequest& operator=(csPluginRequest const& r) {set(r); return *this;} 00141 bool operator==(csPluginRequest const&) const; 00142 bool operator!=(csPluginRequest const& r) const { return !operator==(r); } 00143 csString GetClassName() const { return class_name; } 00144 csString GetInterfaceName() const { return interface_name; } 00145 scfInterfaceID GetInterfaceID() const { return interface_id; } 00146 int GetInterfaceVersion() const { return interface_version; } 00147 }; 00148 00149 00155 class CS_CRYSTALSPACE_EXPORT csInitializer 00156 { 00157 public: 00186 static iObjectRegistry* CreateEnvironment(int argc, char const* const argv[]); 00187 00192 static bool InitializeSCF (int argc, char const* const argv[]); 00193 00199 static iObjectRegistry* CreateObjectRegistry (); 00200 00207 static iPluginManager* CreatePluginManager (iObjectRegistry*); 00208 00215 static iEventQueue* CreateEventQueue (iObjectRegistry*); 00216 00223 static iVirtualClock* CreateVirtualClock (iObjectRegistry*); 00224 00230 static iCommandLineParser* CreateCommandLineParser ( 00231 iObjectRegistry*, int argc, char const* const argv[]); 00232 00237 static iVerbosityManager* CreateVerbosityManager (iObjectRegistry*); 00238 00244 static iConfigManager* CreateConfigManager (iObjectRegistry*); 00245 00252 static bool CreateInputDrivers (iObjectRegistry*); 00253 00263 static bool CreateStringSet (iObjectRegistry*); 00264 00276 static bool SetupConfigManager (iObjectRegistry*, const char* configName, 00277 const char *ApplicationID = "CrystalSpace.Noname"); 00278 00290 static iVFS* SetupVFS(iObjectRegistry* objectReg, 00291 const char* pluginID = "crystalspace.kernel.vfs"); 00292 00304 static bool RequestPlugins (iObjectRegistry*, ...); 00305 00311 static bool RequestPluginsV (iObjectRegistry*, va_list); 00312 00332 static bool RequestPlugins(iObjectRegistry*,csArray<csPluginRequest> const&); 00333 00338 static bool OpenApplication (iObjectRegistry*); 00339 00343 static void CloseApplication (iObjectRegistry*); 00344 00353 static bool SetupEventHandler ( 00354 iObjectRegistry*, iEventHandler*, unsigned int eventmask); 00355 00362 static bool SetupEventHandler ( 00363 iObjectRegistry*, csEventHandlerFunc, unsigned int eventmask = 00364 CSMASK_Nothing | 00365 CSMASK_Broadcast | 00366 CSMASK_MouseUp | 00367 CSMASK_MouseDown | 00368 CSMASK_MouseMove | 00369 CSMASK_Keyboard | 00370 CSMASK_MouseClick | 00371 CSMASK_MouseDoubleClick | 00372 CSMASK_JoystickMove | 00373 CSMASK_JoystickDown | 00374 CSMASK_JoystickUp); 00375 00404 static void DestroyApplication (iObjectRegistry*); 00405 }; 00406 00409 #endif // __CS_INITAPP_H__
Generated for Crystal Space by doxygen 1.4.4