00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef _CEGUIFactoryModule_h_
00029 #define _CEGUIFactoryModule_h_
00030
00031
00032
00033
00034
00035 #if defined(__WIN32__) || defined(_WIN32)
00036 # define DYNLIB_HANDLE hInstance
00037 # define DYNLIB_LOAD( a ) LoadLibrary( a )
00038 # define DYNLIB_GETSYM( a, b ) GetProcAddress( a, b )
00039 # define DYNLIB_UNLOAD( a ) !FreeLibrary( a )
00040 # define DYNLIB_ERROR( ) "Unknown Error"
00041
00042 struct HINSTANCE__;
00043 typedef struct HINSTANCE__* hInstance;
00044
00045 #elif defined(__linux__)
00046 # define DYNLIB_HANDLE void*
00047 # define DYNLIB_LOAD( a ) dlopen( a, RTLD_LAZY )
00048 # define DYNLIB_GETSYM( a, b ) dlsym( a, b )
00049 # define DYNLIB_UNLOAD( a ) dlclose( a )
00050 # define DYNLIB_ERROR( ) dlerror( )
00051
00052 #elif defined(__APPLE_CC__)
00053 # define DYNLIB_HANDLE CFBundleRef
00054 # define DYNLIB_LOAD( a ) mac_loadExeBundle( a )
00055 # define DYNLIB_GETSYM( a, b ) mac_getBundleSym( a, b )
00056 # define DYNLIB_UNLOAD( a ) mac_unloadExeBundle( a )
00057 # define DYNLIB_ERROR( ) mac_errorBundle()
00058 #endif
00059
00060
00061
00062 namespace CEGUI
00063 {
00064
00069 class FactoryModule
00070 {
00071 public:
00082 FactoryModule(const String& filename);
00083
00084
00092 virtual ~FactoryModule(void);
00093
00094
00105 void registerFactory(const String& type) const;
00106
00107
00115 uint registerAllFactories() const;
00116
00117 private:
00118
00119
00120
00121 static const char RegisterFactoryFunctionName[];
00122 static const char RegisterAllFunctionName[];
00123
00124 typedef void (*FactoryRegisterFunction)(const String&);
00125 typedef uint (*RegisterAllFunction)(void);
00126
00127 FactoryRegisterFunction d_regFunc;
00128 RegisterAllFunction d_regAllFunc;
00129 String d_moduleName;
00130 DYNLIB_HANDLE d_handle;
00131 };
00132
00133 }
00134
00135
00136 #endif