summaryrefslogtreecommitdiff
path: root/comphelper
diff options
context:
space:
mode:
authorMatúš Kukan <matus.kukan@gmail.com>2011-07-21 13:46:53 +0200
committerMatúš Kukan <matus.kukan@gmail.com>2011-07-21 13:47:30 +0200
commit74140442bbf39e19bdc05f1cfb975f5a11751f2c (patch)
treec9e87f47c6106093d72b18d218172a05763251f0 /comphelper
parentd423fd54604ee9fa60c028528c93d5b6c25fbb71 (diff)
Drop macros from componentmodule.hxx
Diffstat (limited to 'comphelper')
-rw-r--r--comphelper/inc/comphelper/componentmodule.hxx92
-rw-r--r--comphelper/source/inc/comphelper_module.hxx50
-rw-r--r--comphelper/source/misc/comphelper_module.cxx19
-rw-r--r--comphelper/source/misc/comphelper_services.cxx7
4 files changed, 73 insertions, 95 deletions
diff --git a/comphelper/inc/comphelper/componentmodule.hxx b/comphelper/inc/comphelper/componentmodule.hxx
index 198d6c37bb20..5893313c8497 100644
--- a/comphelper/inc/comphelper/componentmodule.hxx
+++ b/comphelper/inc/comphelper/componentmodule.hxx
@@ -270,98 +270,6 @@ namespace comphelper
) );
}
- //==========================================================================
- //= helpers
- //==========================================================================
-
- //==========================================================================
- // declaring a OModule for a component library
-
-#define DECLARE_COMPONENT_MODULE( ModuleClass, ClientClass ) \
- /* -------------------------------------------------------------------- */ \
- class ModuleClass : public ::comphelper::OModule \
- { \
- friend struct ModuleClass##Creator; \
- typedef ::comphelper::OModule BaseClass; \
- \
- public: \
- static ModuleClass& getInstance(); \
- \
- private: \
- ModuleClass(); \
- }; \
- \
- /* -------------------------------------------------------------------- */ \
- class ClientClass : public ::comphelper::OModuleClient \
- { \
- private: \
- typedef ::comphelper::OModuleClient BaseClass; \
- \
- public: \
- ClientClass() : BaseClass( ModuleClass::getInstance() ) \
- { \
- } \
- }; \
- \
- /* -------------------------------------------------------------------- */ \
- template < class TYPE > \
- class OAutoRegistration : public ::comphelper::OAutoRegistration< TYPE > \
- { \
- private: \
- typedef ::comphelper::OAutoRegistration< TYPE > BaseClass; \
- \
- public: \
- OAutoRegistration() : BaseClass( ModuleClass::getInstance() ) \
- { \
- } \
- }; \
- /* -------------------------------------------------------------------- */ \
- template < class TYPE > \
- class OSingletonRegistration : public ::comphelper::OSingletonRegistration< TYPE > \
- { \
- private: \
- typedef ::comphelper::OSingletonRegistration< TYPE > BaseClass; \
- \
- public: \
- OSingletonRegistration() : BaseClass( ModuleClass::getInstance() ) \
- { \
- } \
- };
-
- //==========================================================================
- //= implementing a OModule for a component library
-
-#define IMPLEMENT_COMPONENT_MODULE( ModuleClass ) \
- struct ModuleClass##Creator \
- { \
- ModuleClass m_aModuleClass; \
- }; \
- namespace \
- { \
- class the##ModuleClass##Instance : public rtl::Static<ModuleClass##Creator, the##ModuleClass##Instance> {}; \
- } \
- \
- ModuleClass::ModuleClass() \
- :BaseClass() \
- { \
- } \
- \
- ModuleClass& ModuleClass::getInstance() \
- { \
- return the##ModuleClass##Instance::get().m_aModuleClass; \
- } \
-
- //==========================================================================
- //= implementing the API of a component library (component_*)
-
-#define IMPLEMENT_COMPONENT_LIBRARY_API( module_class, initializer_function ) \
- extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory( \
- const sal_Char* pImplementationName, void* pServiceManager, void* pRegistryKey ) \
- { \
- initializer_function(); \
- return module_class::getInstance().getComponentFactory( pImplementationName, pServiceManager, pRegistryKey ); \
- }
-
//........................................................................
} // namespace comphelper
//........................................................................
diff --git a/comphelper/source/inc/comphelper_module.hxx b/comphelper/source/inc/comphelper_module.hxx
index 9f8e32656715..dfa364df1983 100644
--- a/comphelper/source/inc/comphelper_module.hxx
+++ b/comphelper/source/inc/comphelper_module.hxx
@@ -35,7 +35,55 @@ namespace comphelper { namespace module
{
//........................................................................
- DECLARE_COMPONENT_MODULE( ComphelperModule, ComphelperModuleClient )
+ class ComphelperModule : public ::comphelper::OModule
+ {
+ friend struct ComphelperModuleCreator;
+ typedef ::comphelper::OModule BaseClass;
+
+ public:
+ static ComphelperModule& getInstance();
+
+ private:
+ ComphelperModule();
+ };
+
+ /* -------------------------------------------------------------------- */
+ class ComphelperModuleClient : public ::comphelper::OModuleClient
+ {
+ private:
+ typedef ::comphelper::OModuleClient BaseClass;
+
+ public:
+ ComphelperModuleClient() : BaseClass( ComphelperModule::getInstance() )
+ {
+ }
+ };
+
+ /* -------------------------------------------------------------------- */
+ template < class TYPE >
+ class OAutoRegistration : public ::comphelper::OAutoRegistration< TYPE >
+ {
+ private:
+ typedef ::comphelper::OAutoRegistration< TYPE > BaseClass;
+
+ public:
+ OAutoRegistration() : BaseClass( ComphelperModule::getInstance() )
+ {
+ }
+ };
+
+ /* -------------------------------------------------------------------- */
+ template < class TYPE >
+ class OSingletonRegistration : public ::comphelper::OSingletonRegistration< TYPE >
+ {
+ private:
+ typedef ::comphelper::OSingletonRegistration< TYPE > BaseClass;
+
+ public:
+ OSingletonRegistration() : BaseClass( ComphelperModule::getInstance() )
+ {
+ }
+ };
//........................................................................
} } // namespace comphelper::module
diff --git a/comphelper/source/misc/comphelper_module.cxx b/comphelper/source/misc/comphelper_module.cxx
index 8b9ee4221dfc..b2bdad6665cb 100644
--- a/comphelper/source/misc/comphelper_module.cxx
+++ b/comphelper/source/misc/comphelper_module.cxx
@@ -35,7 +35,24 @@ namespace comphelper { namespace module
{
//........................................................................
- IMPLEMENT_COMPONENT_MODULE( ComphelperModule );
+ struct ComphelperModuleCreator
+ {
+ ComphelperModule m_aComphelperModule;
+ };
+ namespace
+ {
+ class theComphelperModuleInstance : public rtl::Static<ComphelperModuleCreator, theComphelperModuleInstance> {};
+ }
+
+ ComphelperModule::ComphelperModule()
+ :BaseClass()
+ {
+ }
+
+ ComphelperModule& ComphelperModule::getInstance()
+ {
+ return theComphelperModuleInstance::get().m_aComphelperModule;
+ }
//........................................................................
} } // namespace comphelper::module
diff --git a/comphelper/source/misc/comphelper_services.cxx b/comphelper/source/misc/comphelper_services.cxx
index 32d1c53aff93..ad5558fb8ee7 100644
--- a/comphelper/source/misc/comphelper_services.cxx
+++ b/comphelper/source/misc/comphelper_services.cxx
@@ -85,6 +85,11 @@ namespace comphelper { namespace module
} } // namespace comphelper::module
//........................................................................
-IMPLEMENT_COMPONENT_LIBRARY_API( ::comphelper::module::ComphelperModule, ::comphelper::module::initializeModule )
+extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory(
+ const sal_Char* pImplementationName, void* pServiceManager, void* pRegistryKey )
+{
+ ::comphelper::module::initializeModule();
+ return ::comphelper::module::ComphelperModule::getInstance().getComponentFactory( pImplementationName, pServiceManager, pRegistryKey );
+}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */