diff options
author | Jörg Budischewski <jbu@openoffice.org> | 2001-06-22 15:32:57 +0000 |
---|---|---|
committer | Jörg Budischewski <jbu@openoffice.org> | 2001-06-22 15:32:57 +0000 |
commit | dc4d9ce57a665d197d6629741418a15e6c770792 (patch) | |
tree | 775aa3fdea8245287feaa17e0700e2212e423883 /io/source/stm/factreg.cxx | |
parent | 099c3e9d5d6e3e79126b40928c175ebfd4078535 (diff) |
#67468# Added unloading and context support
Diffstat (limited to 'io/source/stm/factreg.cxx')
-rw-r--r-- | io/source/stm/factreg.cxx | 201 |
1 files changed, 64 insertions, 137 deletions
diff --git a/io/source/stm/factreg.cxx b/io/source/stm/factreg.cxx index 27b52c826..afc5a4114 100644 --- a/io/source/stm/factreg.cxx +++ b/io/source/stm/factreg.cxx @@ -2,9 +2,9 @@ * * $RCSfile: factreg.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: jl $ $Date: 2001-03-12 15:51:38 $ + * last change: $Author: jbu $ $Date: 2001-06-22 16:32:57 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -61,6 +61,7 @@ #include <osl/diagnose.h> #include <cppuhelper/factory.hxx> +#include <cppuhelper/implementationentry.hxx> #include <com/sun/star/registry/XRegistryKey.hpp> @@ -72,158 +73,84 @@ using namespace ::com::sun::star::registry; #include "factreg.hxx" +namespace io_stm +{ + rtl_StandardModuleCount g_moduleCount = MODULE_COUNT_INIT; +} + using namespace io_stm; -extern "C" +static struct ImplementationEntry g_entries[] = { + { + OPipeImpl_CreateInstance, OPipeImpl_getImplementationName , + OPipeImpl_getSupportedServiceNames, createSingleComponentFactory , + &g_moduleCount.modCnt , 0 + }, + { + OPumpImpl_CreateInstance, OPumpImpl_getImplementationName , + OPumpImpl_getSupportedServiceNames, createSingleComponentFactory , + &g_moduleCount.modCnt , 0 + }, + { + ODataInputStream_CreateInstance, ODataInputStream_getImplementationName, + ODataInputStream_getSupportedServiceNames, createSingleComponentFactory, + &g_moduleCount.modCnt, 0 + }, + { + ODataOutputStream_CreateInstance, ODataOutputStream_getImplementationName, + ODataOutputStream_getSupportedServiceNames, createSingleComponentFactory, + &g_moduleCount.modCnt, 0 + }, + { + OObjectInputStream_CreateInstance, OObjectInputStream_getImplementationName, + OObjectInputStream_getSupportedServiceNames, createSingleComponentFactory, + &g_moduleCount.modCnt, 0 + }, + { + OObjectOutputStream_CreateInstance, OObjectOutputStream_getImplementationName, + OObjectOutputStream_getSupportedServiceNames, createSingleComponentFactory, + &g_moduleCount.modCnt, 0 + }, + { + OMarkableInputStream_CreateInstance, OMarkableInputStream_getImplementationName, + OMarkableInputStream_getSupportedServiceNames, createSingleComponentFactory, + &g_moduleCount.modCnt, 0 + }, + { + OMarkableOutputStream_CreateInstance, OMarkableOutputStream_getImplementationName, + OMarkableOutputStream_getSupportedServiceNames, createSingleComponentFactory, + &g_moduleCount.modCnt, 0 + }, + { 0, 0, 0, 0, 0, 0 } + +}; +extern "C" +{ +sal_Bool SAL_CALL component_canUnload( TimeValue *pTime ) +{ + return g_moduleCount.canUnload( &g_moduleCount , pTime ); +} + +//================================================================================================== void SAL_CALL component_getImplementationEnvironment( const sal_Char ** ppEnvTypeName, uno_Environment ** ppEnv ) { *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } - - +//================================================================================================== sal_Bool SAL_CALL component_writeInfo( void * pServiceManager, void * pRegistryKey ) { - if (pRegistryKey) - { - try - { - Reference< XRegistryKey > xKey( - reinterpret_cast< XRegistryKey * >( pRegistryKey ) ); - - OUString str = OUString::createFromAscii( "/" ); - str += OPipeImpl_getImplementationName(); - str += OUString::createFromAscii( "/UNO/SERVICES" ); - Reference< XRegistryKey > xNewKey = xKey->createKey( str ); - xNewKey->createKey( OPipeImpl_getServiceName() ); - - str = OUString::createFromAscii( "/" ); - str += ODataInputStream_getImplementationName(); - str += OUString::createFromAscii( "/UNO/SERVICES" ); - xNewKey = xKey->createKey( str ); - xNewKey->createKey( ODataInputStream_getServiceName() ); - - str = OUString::createFromAscii( "/" ); - str += ODataOutputStream_getImplementationName(); - str += OUString::createFromAscii( "/UNO/SERVICES" ); - xNewKey = xKey->createKey( str ); - xNewKey->createKey( ODataOutputStream_getServiceName() ); - - str = OUString::createFromAscii( "/" ); - str += OMarkableOutputStream_getImplementationName(); - str += OUString::createFromAscii( "/UNO/SERVICES" ); - xNewKey = xKey->createKey( str ); - xNewKey->createKey( OMarkableOutputStream_getServiceName() ); - - str = OUString::createFromAscii( "/" ); - str += OMarkableInputStream_getImplementationName(); - str += OUString::createFromAscii( "/UNO/SERVICES" ); - xNewKey = xKey->createKey( str ); - xNewKey->createKey( OMarkableInputStream_getServiceName() ); - - str = OUString::createFromAscii( "/" ); - str += OObjectInputStream_getImplementationName(); - str += OUString::createFromAscii( "/UNO/SERVICES" ); - xNewKey = xKey->createKey( str ); - xNewKey->createKey( OObjectInputStream_getServiceName() ); - - str = OUString::createFromAscii( "/" ); - str += OObjectOutputStream_getImplementationName(); - str += OUString::createFromAscii( "/UNO/SERVICES" ); - xNewKey = xKey->createKey( str ); - xNewKey->createKey( OObjectOutputStream_getServiceName() ); - - str = OUString::createFromAscii( "/" ); - str += OPumpImpl_getImplementationName(); - str += OUString::createFromAscii( "/UNO/SERVICES" ); - xNewKey = xKey->createKey( str ); - xNewKey->createKey( OPumpImpl_getServiceName() ); - - return sal_True; - } - catch (InvalidRegistryException &) - { - OSL_ENSURE( sal_False, "### InvalidRegistryException!" ); - } - } - return sal_False; + return component_writeInfoHelper( pServiceManager, pRegistryKey, g_entries ); } - - -// createSingleFactory( -// reinterpret_cast< XMultiServiceFactory * >( pServiceManager ), -// OUString::createFromAscii( pImplName ), -// acceptor_CreateInstance, acceptor_getSupportedServiceNames() ) ); - +//================================================================================================== void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey ) { - void * pRet = 0; - - if (pServiceManager ) - { - Reference< XSingleServiceFactory > xRet; - Reference< XMultiServiceFactory > xSMgr = - reinterpret_cast< XMultiServiceFactory * > ( pServiceManager ); - - OUString aImplementationName = OUString::createFromAscii( pImplName ); - - if (aImplementationName == OPipeImpl_getImplementationName() ) - { - xRet = createSingleFactory( xSMgr, aImplementationName, - OPipeImpl_CreateInstance, - OPipeImpl_getSupportedServiceNames() ); - } - else if( aImplementationName == ODataInputStream_getImplementationName() ) { - xRet = createSingleFactory( xSMgr , aImplementationName, - ODataInputStream_CreateInstance, - ODataInputStream_getSupportedServiceNames() ); - } - else if( aImplementationName == ODataOutputStream_getImplementationName() ) { - xRet = createSingleFactory( xSMgr , aImplementationName, - ODataOutputStream_CreateInstance, - ODataOutputStream_getSupportedServiceNames() ); - } - else if( aImplementationName == OMarkableOutputStream_getImplementationName() ) { - xRet = createSingleFactory( xSMgr , aImplementationName, - OMarkableOutputStream_CreateInstance, - OMarkableOutputStream_getSupportedServiceNames() ); - } - else if( aImplementationName == OMarkableInputStream_getImplementationName() ) { - xRet = createSingleFactory( xSMgr , aImplementationName, - OMarkableInputStream_CreateInstance, - OMarkableInputStream_getSupportedServiceNames() ); - } - else if( aImplementationName == OObjectInputStream_getImplementationName() ) { - xRet = createSingleFactory( xSMgr , aImplementationName, - OObjectInputStream_CreateInstance, - OObjectInputStream_getSupportedServiceNames() ); - } - else if( aImplementationName == OObjectOutputStream_getImplementationName() ) { - xRet = createSingleFactory( xSMgr , aImplementationName, - OObjectOutputStream_CreateInstance, - OObjectOutputStream_getSupportedServiceNames() ); - } - else if( aImplementationName == OPumpImpl_getImplementationName() ) { - xRet = createSingleFactory( xSMgr , aImplementationName, - OPumpImpl_CreateInstance, - OPumpImpl_getSupportedServiceNames() ); - } - - if (xRet.is()) - { - xRet->acquire(); - pRet = xRet.get(); - } - } - - return pRet; + return component_getFactoryHelper( pImplName, pServiceManager, pRegistryKey , g_entries ); } - - } |