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
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039 #ifndef Foundation_ClassLibrary_INCLUDED
00040 #define Foundation_ClassLibrary_INCLUDED
00041
00042
00043 #include "Poco/Foundation.h"
00044 #include "Poco/Manifest.h"
00045 #include <typeinfo>
00046
00047
00048 #if defined(_WIN32)
00049 #define POCO_LIBRARY_API __declspec(dllexport)
00050 #else
00051 #define POCO_LIBRARY_API
00052 #endif
00053
00054
00055
00056
00057
00058 extern "C"
00059 {
00060 bool POCO_LIBRARY_API pocoBuildManifest(Poco::ManifestBase* pManifest);
00061 void POCO_LIBRARY_API pocoInitializeLibrary();
00062 void POCO_LIBRARY_API pocoUninitializeLibrary();
00063 }
00064
00065
00066
00067
00068
00069 #define POCO_DECLARE_NAMED_MANIFEST(name) \
00070 extern "C" \
00071 { \
00072 bool POCO_LIBRARY_API POCO_JOIN(pocoBuildManifest, name)(Poco::ManifestBase* pManifest); \
00073 }
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087 #define POCO_BEGIN_MANIFEST_IMPL(fnName, base) \
00088 bool fnName(Poco::ManifestBase* pManifest_) \
00089 { \
00090 typedef base _Base; \
00091 typedef Poco::Manifest<_Base> _Manifest; \
00092 std::string requiredType(typeid(_Manifest).name()); \
00093 std::string actualType(pManifest_->className()); \
00094 if (requiredType == actualType) \
00095 { \
00096 Poco::Manifest<_Base>* pManifest = static_cast<_Manifest*>(pManifest_);
00097
00098
00099 #define POCO_BEGIN_MANIFEST(base) \
00100 POCO_BEGIN_MANIFEST_IMPL(pocoBuildManifest, base)
00101
00102
00103 #define POCO_BEGIN_NAMED_MANIFEST(name, base) \
00104 POCO_DECLARE_NAMED_MANIFEST(name) \
00105 POCO_BEGIN_MANIFEST_IMPL(POCO_JOIN(pocoBuildManifest, name), base)
00106
00107
00108 #define POCO_END_MANIFEST \
00109 return true; \
00110 } \
00111 else return false; \
00112 }
00113
00114
00115 #define POCO_EXPORT_CLASS(cls) \
00116 pManifest->insert(new Poco::MetaObject<cls, _Base>(#cls));
00117
00118
00119 #define POCO_EXPORT_SINGLETON(cls) \
00120 pManifest->insert(new Poco::MetaSingleton<cls, _Base>(#cls));
00121
00122
00123 #endif // Foundation_ClassLibrary_INCLUDED