00001 00002 #ifndef KORE_H 00003 #define KORE_H 00004 00005 #if defined( WIN32 ) 00006 #define KORE_WIN32 00007 #include <windows.h> 00008 #ifdef KORE_EXPORTS 00009 #define KORE_API __declspec(dllexport) 00010 #else // !KORE_EXPORTS 00011 #define KORE_API __declspec(dllimport) 00012 #endif // KORE_EXPORTS 00013 #elif defined( __BEOS__ ) 00014 #define KORE_BEOS 00015 #include <image.h> 00016 #ifdef KORE_EXPORTS 00017 #define KORE_API __declspec(dllexport) 00018 #else // !KORE_EXPORTS 00019 #define KORE_API __declspec(dllimport) 00020 #endif // KORE_EXPORTS 00021 #define HMODULE image_id 00022 #elif defined( __ATHEOS__ ) 00023 #define KORE_ATHEOS 00024 #define KORE_API 00025 #define HMODULE int 00026 #else 00027 #define KORE_UNIX 00028 #define KORE_LINUX 00029 #define KORE_FREEBSD 00030 #define KORE_API 00031 #define HMODULE const void* 00032 #endif 00033 00037 #define KORE_CALLBACK( name, param_list ) \ 00038 public: \ 00039 typedef void (* name##CallbackType) param_list; \ 00040 void name##Call param_list \ 00041 { \ 00042 if( name param_list ) \ 00043 { \ 00044 int n = _##name##Callbacks.size(); \ 00045 for( int i=0; i < n; i++ ) \ 00046 _##name##Callbacks[i] param_list; \ 00047 } \ 00048 } \ 00049 void name##Connect(name##CallbackType cb) \ 00050 { \ 00051 _##name##Callbacks.push_back( cb ); \ 00052 } \ 00053 void name##Disconnect(name##CallbackType cb) \ 00054 { \ 00055 _##name##Callbacks.erase( &cb ); \ 00056 } \ 00057 protected: \ 00058 virtual bool name param_list \ 00059 { \ 00060 return true; \ 00061 } \ 00062 private: \ 00063 vector< name##CallbackType > _##name##Callbacks; 00064 00065 #define KORE_CALL( name, param_list ) name##Call param_list 00066 #define KORE_CONNECT( name, cb ) name##Connect( cb ) 00067 #define KORE_DISCONNECT( name, cb ) name##Diconnect( cb ) 00068 00072 namespace kore 00073 { 00074 }; 00075 00076 using namespace std; 00077 00078 #endif // KORE_H