[Libreoffice-commits] .: comphelper/inc comphelper/source svtools/workben

Matus Kukan mkukan at kemper.freedesktop.org
Thu Jul 21 05:07:30 PDT 2011


 comphelper/inc/comphelper/componentmodule.hxx  |   92 -------------------------
 comphelper/source/inc/comphelper_module.hxx    |   50 +++++++++++++
 comphelper/source/misc/comphelper_module.cxx   |   19 ++++-
 comphelper/source/misc/comphelper_services.cxx |    7 +
 svtools/workben/unodialog/udlg_services.cxx    |    7 +
 5 files changed, 79 insertions(+), 96 deletions(-)

New commits:
commit 482657880838bc2e8d9ca3321a77be5cc0170a9f
Author: Matúš Kukan <matus.kukan at gmail.com>
Date:   Thu Jul 21 13:46:53 2011 +0200

    Drop macros from componentmodule.hxx

diff --git a/comphelper/inc/comphelper/componentmodule.hxx b/comphelper/inc/comphelper/componentmodule.hxx
index 6b9945e..5fa6298 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 e338682..d402850 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 2ac0fc7..3c6754d 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 28d8778..0aceae0 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: */
diff --git a/svtools/workben/unodialog/udlg_services.cxx b/svtools/workben/unodialog/udlg_services.cxx
index eb80f93..fb02e90 100644
--- a/svtools/workben/unodialog/udlg_services.cxx
+++ b/svtools/workben/unodialog/udlg_services.cxx
@@ -56,6 +56,11 @@ namespace udlg
 } // namespace udlg
 //........................................................................
 
-IMPLEMENT_COMPONENT_LIBRARY_API( ::udlg::UdlgModule, ::udlg::initializeModule )
+extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory(
+        const sal_Char* pImplementationName, void* pServiceManager, void* pRegistryKey )
+{
+    ::udlg::initializeModule();
+    return ::udlg::UdlgModule::getInstance().getComponentFactory( pImplementationName, pServiceManager, pRegistryKey );
+}
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list