Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | File List | 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 <stdarg.h> 00031 #include "csextern.h" 00032 #include "cstypes.h" 00033 #include "csutil/array.h" 00034 #include "csutil/csstring.h" 00035 #include "csutil/scf.h" 00036 #include "iengine/engine.h" 00037 #include "igraphic/imageio.h" 00038 #include "imap/loader.h" 00039 #include "imap/saver.h" 00040 #include "iutil/evdefs.h" 00041 #include "iutil/vfs.h" 00042 #include "ivaria/conout.h" 00043 #include "ivaria/reporter.h" 00044 #include "ivaria/stdrep.h" 00045 #include "ivideo/graph3d.h" 00046 #include "ivideo/fontserv.h" 00047 00048 struct iObjectRegistry; 00049 struct iEvent; 00050 struct iEventHandler; 00051 struct iEventQueue; 00052 struct iPluginManager; 00053 struct iVirtualClock; 00054 struct iCommandLineParser; 00055 struct iConfigManager; 00056 struct iVerbosityManager; 00057 00061 00062 #define CS_REQUEST_PLUGIN(Name,Interface) Name, #Interface, \ 00063 scfInterface<Interface>::GetID(), scfInterface<Interface>::GetVersion() 00064 00065 // !!! NOTE !!! 00066 // When editing this list, you *must* ensure that initapp.h #include the 00067 // appropriate header for each SCF interface mentioned by a CS_REQUEST_PLUGIN() 00068 // invocation. This is necessary to guarantee that the interface-specialized 00069 // version of scfInterface<> is seen by clients rather than the non-specialized 00070 // template. 00071 00073 #define CS_REQUEST_END \ 00074 (const char*)0 00075 00076 #define CS_REQUEST_VFS \ 00077 CS_REQUEST_PLUGIN("crystalspace.kernel.vfs", iVFS) 00078 00079 #define CS_REQUEST_FONTSERVER \ 00080 CS_REQUEST_PLUGIN("crystalspace.font.server.default", iFontServer) 00081 00082 #define CS_REQUEST_IMAGELOADER \ 00083 CS_REQUEST_PLUGIN("crystalspace.graphic.image.io.multiplex", iImageIO) 00084 00085 #define CS_REQUEST_NULL3D \ 00086 CS_REQUEST_PLUGIN("crystalspace.graphics3d.null",iGraphics3D) 00087 00088 #define CS_REQUEST_SOFTWARE3D \ 00089 CS_REQUEST_PLUGIN("crystalspace.graphics3d.software",iGraphics3D) 00090 00091 #define CS_REQUEST_OPENGL3D \ 00092 CS_REQUEST_PLUGIN("crystalspace.graphics3d.opengl", iGraphics3D) 00093 00094 #define CS_REQUEST_ENGINE \ 00095 CS_REQUEST_PLUGIN("crystalspace.engine.3d", iEngine) 00096 00097 #define CS_REQUEST_LEVELLOADER \ 00098 CS_REQUEST_PLUGIN("crystalspace.level.loader", iLoader) 00099 00100 #define CS_REQUEST_LEVELSAVER \ 00101 CS_REQUEST_PLUGIN("crystalspace.level.saver", iSaver) 00102 00103 #define CS_REQUEST_REPORTER \ 00104 CS_REQUEST_PLUGIN("crystalspace.utilities.reporter", iReporter) 00105 00106 #define CS_REQUEST_REPORTERLISTENER \ 00107 CS_REQUEST_PLUGIN("crystalspace.utilities.stdrep", iStandardReporterListener) 00108 00109 #define CS_REQUEST_CONSOLEOUT \ 00110 CS_REQUEST_PLUGIN("crystalspace.console.output.simple", iConsoleOutput) 00111 00116 typedef bool (*csEventHandlerFunc) (iEvent&); 00117 00118 00129 class CS_CSTOOL_EXPORT csPluginRequest 00130 { 00131 private: 00132 csString class_name; 00133 csString interface_name; 00134 scfInterfaceID interface_id; 00135 int interface_version; 00136 void set(csPluginRequest const&); 00137 public: 00138 csPluginRequest(csString class_name, csString interface_name, 00139 scfInterfaceID interface_id, int interface_version); 00140 csPluginRequest(csPluginRequest const& r) { set(r); } 00141 csPluginRequest& operator=(csPluginRequest const& r) {set(r); return *this;} 00142 bool operator==(csPluginRequest const&) const; 00143 bool operator!=(csPluginRequest const& r) const { return !operator==(r); } 00144 csString GetClassName() const { return class_name; } 00145 csString GetInterfaceName() const { return interface_name; } 00146 scfInterfaceID GetInterfaceID() const { return interface_id; } 00147 int GetInterfaceVersion() const { return interface_version; } 00148 }; 00149 00150 00156 class CS_CSTOOL_EXPORT csInitializer 00157 { 00158 public: 00187 static iObjectRegistry* CreateEnvironment(int argc, char const* const argv[]); 00188 00193 static bool InitializeSCF (int argc, char const* const argv[]); 00194 00200 static iObjectRegistry* CreateObjectRegistry (); 00201 00208 static iPluginManager* CreatePluginManager (iObjectRegistry*); 00209 00216 static iEventQueue* CreateEventQueue (iObjectRegistry*); 00217 00224 static iVirtualClock* CreateVirtualClock (iObjectRegistry*); 00225 00231 static iCommandLineParser* CreateCommandLineParser ( 00232 iObjectRegistry*, int argc, char const* const argv[]); 00233 00238 static iVerbosityManager* CreateVerbosityManager (iObjectRegistry*); 00239 00245 static iConfigManager* CreateConfigManager (iObjectRegistry*); 00246 00253 static bool CreateInputDrivers (iObjectRegistry*); 00254 00264 static bool CreateStringSet (iObjectRegistry*); 00265 00277 static bool SetupConfigManager (iObjectRegistry*, const char* configName, 00278 const char *ApplicationID = "CrystalSpace.Noname"); 00279 00291 static iVFS* SetupVFS(iObjectRegistry* objectReg, 00292 const char* pluginID = "crystalspace.kernel.vfs"); 00293 00305 static bool RequestPlugins (iObjectRegistry*, ...); 00306 00312 static bool RequestPluginsV (iObjectRegistry*, va_list); 00313 00333 static bool RequestPlugins(iObjectRegistry*,csArray<csPluginRequest> const&); 00334 00339 static bool OpenApplication (iObjectRegistry*); 00340 00344 static void CloseApplication (iObjectRegistry*); 00345 00354 static bool SetupEventHandler ( 00355 iObjectRegistry*, iEventHandler*, unsigned int eventmask); 00356 00363 static bool SetupEventHandler ( 00364 iObjectRegistry*, csEventHandlerFunc, unsigned int eventmask = 00365 CSMASK_Nothing | 00366 CSMASK_Broadcast | 00367 CSMASK_MouseUp | 00368 CSMASK_MouseDown | 00369 CSMASK_MouseMove | 00370 CSMASK_Keyboard | 00371 CSMASK_MouseClick | 00372 CSMASK_MouseDoubleClick | 00373 CSMASK_JoystickMove | 00374 CSMASK_JoystickDown | 00375 CSMASK_JoystickUp); 00376 00405 static void DestroyApplication (iObjectRegistry*); 00406 }; 00407 00410 #endif // __CS_INITAPP_H__
Generated for Crystal Space by doxygen 1.3.9.1