From 48d64f3c5deb44008a3ceffff360c210bf596a91 Mon Sep 17 00:00:00 2001 From: RĂ¼diger Timm Date: Wed, 30 Jan 2008 08:34:45 +0000 Subject: INTEGRATION: CWS dba24d (1.5.58); FILE MERGED 2007/11/22 13:03:25 fs 1.5.58.1: #i81658# +OLegacySingleRegistration --- comphelper/inc/comphelper/componentmodule.hxx | 43 ++++++++++++++++++++++++--- 1 file changed, 39 insertions(+), 4 deletions(-) (limited to 'comphelper') diff --git a/comphelper/inc/comphelper/componentmodule.hxx b/comphelper/inc/comphelper/componentmodule.hxx index 5fa19bbf5819..f6853288219e 100644 --- a/comphelper/inc/comphelper/componentmodule.hxx +++ b/comphelper/inc/comphelper/componentmodule.hxx @@ -4,9 +4,9 @@ * * $RCSfile: componentmodule.hxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: hr $ $Date: 2007-06-27 14:53:24 $ + * last change: $Author: rt $ $Date: 2008-01-30 09:34:45 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -35,9 +35,8 @@ #ifndef COMPHELPER_INC_COMPHELPER_COMPONENTMODULE_HXX #define COMPHELPER_INC_COMPHELPER_COMPONENTMODULE_HXX -#ifndef INCLUDED_COMPHELPERDLLAPI_H #include -#endif +#include /** === begin UNO includes === **/ #ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_ @@ -298,6 +297,7 @@ namespace comphelper }; template + //-------------------------------------------------------------------------- OSingletonRegistration::OSingletonRegistration( OModule& _rModule ) { _rModule.registerImplementation( ComponentDescription( @@ -309,6 +309,29 @@ namespace comphelper ) ); } + //========================================================================== + //= OLegacySingletonRegistration + //========================================================================== + template + class OLegacySingletonRegistration + { + public: + OLegacySingletonRegistration( OModule& _rModule ); + }; + + //-------------------------------------------------------------------------- + template + OLegacySingletonRegistration::OLegacySingletonRegistration( OModule& _rModule ) + { + _rModule.registerImplementation( ComponentDescription( + TYPE::getImplementationName_static(), + TYPE::getSupportedServiceNames_static(), + ::rtl::OUString(), + &TYPE::Create, + &::comphelper::createLegacySingletonFactory + ) ); + } + //========================================================================== //= helpers //========================================================================== @@ -366,6 +389,18 @@ namespace comphelper { \ } \ }; \ + /* -------------------------------------------------------------------- */ \ + template < class TYPE > \ + class OLegacySingletonRegistration : public ::comphelper::OLegacySingletonRegistration< TYPE > \ + { \ + private: \ + typedef ::comphelper::OLegacySingletonRegistration< TYPE > BaseClass; \ + \ + public: \ + OLegacySingletonRegistration() : BaseClass( ModuleClass::getInstance() ) \ + { \ + } \ + }; \ //========================================================================== //= implementing a OModule for a component library -- cgit