diff options
author | Tor Lillqvist <tml@iki.fi> | 2011-08-08 12:50:52 +0300 |
---|---|---|
committer | Tor Lillqvist <tml@iki.fi> | 2011-08-08 13:01:20 +0300 |
commit | 2fdacd0142fea608423c417a0b06e54e6a7915a3 (patch) | |
tree | 7f66c847880e9924685897689233f0dbddd9e39a /cppuhelper | |
parent | 5207c9fdde58c3e4f1b5329cb8e7177129b2905d (diff) |
Move function to the file where it is used
Diffstat (limited to 'cppuhelper')
-rw-r--r-- | cppuhelper/source/bootstrap.cxx | 60 | ||||
-rw-r--r-- | cppuhelper/source/servicefactory.cxx | 71 |
2 files changed, 63 insertions, 68 deletions
diff --git a/cppuhelper/source/bootstrap.cxx b/cppuhelper/source/bootstrap.cxx index 5b4a58dc1c25..0da5cb0bdfd5 100644 --- a/cppuhelper/source/bootstrap.cxx +++ b/cppuhelper/source/bootstrap.cxx @@ -119,66 +119,6 @@ Bootstrap const & get_unorc() SAL_THROW( () ) return *(Bootstrap const *)&s_bstrap; } - -void addFactories( - char const * const * ppNames /* lib, implname, ..., 0 */, - OUString const & bootstrapPath, - Reference< lang::XMultiComponentFactory > const & xMgr, - Reference< registry::XRegistryKey > const & xKey ) - SAL_THROW( (Exception) ) -{ - Reference< container::XSet > xSet( xMgr, UNO_QUERY ); - OSL_ASSERT( xSet.is() ); - Reference< lang::XMultiServiceFactory > xSF( xMgr, UNO_QUERY ); - - while (*ppNames) - { - OUString lib( OUString::createFromAscii( *ppNames++ ) ); - OUString implName( OUString::createFromAscii( *ppNames++ ) ); - - Any aFac( makeAny( loadSharedLibComponentFactory( - lib, bootstrapPath, implName, xSF, xKey ) ) ); - xSet->insert( aFac ); -#if OSL_DEBUG_LEVEL > 1 - if (xSet->has( aFac )) - { - Reference< lang::XServiceInfo > xInfo; - if (aFac >>= xInfo) - { - ::fprintf( - stderr, "> implementation %s supports: ", ppNames[ -1 ] ); - Sequence< OUString > supported( - xInfo->getSupportedServiceNames() ); - for ( sal_Int32 nPos = supported.getLength(); nPos--; ) - { - OString str( OUStringToOString( - supported[ nPos ], RTL_TEXTENCODING_ASCII_US ) ); - ::fprintf( stderr, nPos ? "%s, " : "%s\n", str.getStr() ); - } - } - else - { - ::fprintf( - stderr, - "> implementation %s provides NO lang::XServiceInfo!!!\n", - ppNames[ -1 ] ); - } - } -#endif -#if OSL_DEBUG_LEVEL > 0 - if (! xSet->has( aFac )) - { - OStringBuffer buf( 64 ); - buf.append( "### failed inserting shared lib \"" ); - buf.append( ppNames[ -2 ] ); - buf.append( "\"!!!" ); - OString str( buf.makeStringAndClear() ); - OSL_FAIL( str.getStr() ); - } -#endif - } -} - // private forward decl Reference< lang::XMultiComponentFactory > bootstrapInitialSF( OUString const & rBootstrapPath ) diff --git a/cppuhelper/source/servicefactory.cxx b/cppuhelper/source/servicefactory.cxx index 742f94ac5f97..1e40cf30f277 100644 --- a/cppuhelper/source/servicefactory.cxx +++ b/cppuhelper/source/servicefactory.cxx @@ -33,6 +33,7 @@ #include "rtl/string.hxx" #include "rtl/bootstrap.hxx" +#include "rtl/strbuf.hxx" #include "osl/diagnose.h" #include "osl/file.h" #include "osl/module.h" @@ -67,14 +68,6 @@ namespace css = com::sun::star; namespace cppu { -// private forward decl -void addFactories( - char const * const * ppNames /* lib, implname, ..., 0 */, - OUString const & bootstrapPath, - Reference< lang::XMultiComponentFactory > const & xMgr, - Reference< registry::XRegistryKey > const & xKey ) - SAL_THROW( (Exception) ); - Reference< security::XAccessController > createDefaultAccessController() SAL_THROW( () ); @@ -321,6 +314,68 @@ static void add_access_control_entries( context_values.push_back( entry ); } +namespace { +void addFactories( + char const * const * ppNames /* lib, implname, ..., 0 */, + OUString const & bootstrapPath, + Reference< lang::XMultiComponentFactory > const & xMgr, + Reference< registry::XRegistryKey > const & xKey ) + SAL_THROW( (Exception) ) +{ + Reference< container::XSet > xSet( xMgr, UNO_QUERY ); + OSL_ASSERT( xSet.is() ); + Reference< lang::XMultiServiceFactory > xSF( xMgr, UNO_QUERY ); + + while (*ppNames) + { + OUString lib( OUString::createFromAscii( *ppNames++ ) ); + OUString implName( OUString::createFromAscii( *ppNames++ ) ); + + Any aFac( makeAny( loadSharedLibComponentFactory( + lib, bootstrapPath, implName, xSF, xKey ) ) ); + xSet->insert( aFac ); +#if OSL_DEBUG_LEVEL > 1 + if (xSet->has( aFac )) + { + Reference< lang::XServiceInfo > xInfo; + if (aFac >>= xInfo) + { + ::fprintf( + stderr, "> implementation %s supports: ", ppNames[ -1 ] ); + Sequence< OUString > supported( + xInfo->getSupportedServiceNames() ); + for ( sal_Int32 nPos = supported.getLength(); nPos--; ) + { + OString str( OUStringToOString( + supported[ nPos ], RTL_TEXTENCODING_ASCII_US ) ); + ::fprintf( stderr, nPos ? "%s, " : "%s\n", str.getStr() ); + } + } + else + { + ::fprintf( + stderr, + "> implementation %s provides NO lang::XServiceInfo!!!\n", + ppNames[ -1 ] ); + } + } +#endif +#if OSL_DEBUG_LEVEL > 0 + if (! xSet->has( aFac )) + { + OStringBuffer buf( 64 ); + buf.append( "### failed inserting shared lib \"" ); + buf.append( ppNames[ -2 ] ); + buf.append( "\"!!!" ); + OString str( buf.makeStringAndClear() ); + OSL_FAIL( str.getStr() ); + } +#endif + } +} + +} // namespace + Reference< lang::XMultiComponentFactory > bootstrapInitialSF( OUString const & rBootstrapPath ) SAL_THROW( (Exception) ) |