Kaydet (Commit) f7b19895 authored tarafından Caolán McNamara's avatar Caolán McNamara

Convert com.sun.star.comp.stoc.CoreReflection to direct construction

Change-Id: Iac6f30dbb9173e2ccc38b236efc4715ba7f2b67f
Reviewed-on: https://gerrit.libreoffice.org/42289Reviewed-by: 's avatarStephan Bergmann <sbergman@redhat.com>
Tested-by: 's avatarJenkins <ci@libreoffice.org>
üst 417bcf6b
...@@ -23,7 +23,6 @@ import xml.etree.ElementTree as ET ...@@ -23,7 +23,6 @@ import xml.etree.ElementTree as ET
core_factory_list = [ core_factory_list = [
("libembobj.a", "embobj_component_getFactory"), ("libembobj.a", "embobj_component_getFactory"),
("libevtattlo.a", "evtatt_component_getFactory"), ("libevtattlo.a", "evtatt_component_getFactory"),
("libreflectionlo.a", "reflection_component_getFactory"),
("libcomphelper.a", "comphelp_component_getFactory"), ("libcomphelper.a", "comphelp_component_getFactory"),
("libconfigmgrlo.a", "configmgr_component_getFactory"), ("libconfigmgrlo.a", "configmgr_component_getFactory"),
("libdrawinglayerlo.a", "drawinglayer_component_getFactory"), ("libdrawinglayerlo.a", "drawinglayer_component_getFactory"),
...@@ -190,6 +189,8 @@ core_constructor_list = [ ...@@ -190,6 +189,8 @@ core_constructor_list = [
"com_sun_star_comp_embed_OLESimpleStorage", "com_sun_star_comp_embed_OLESimpleStorage",
# stoc/source/inspect/introspection.component # stoc/source/inspect/introspection.component
"com_sun_star_comp_stoc_Introspection_get_implementation", "com_sun_star_comp_stoc_Introspection_get_implementation",
# stoc/source/corereflection/reflection.component
"com_sun_star_comp_stoc_CoreReflection_get_implementation",
# stoc/util/stocservices.component # stoc/util/stocservices.component
"com_sun_star_comp_stoc_OServiceManagerWrapper_get_implementation", "com_sun_star_comp_stoc_OServiceManagerWrapper_get_implementation",
"com_sun_star_comp_stoc_TypeConverter_get_implementation", "com_sun_star_comp_stoc_TypeConverter_get_implementation",
......
...@@ -43,19 +43,6 @@ using namespace osl; ...@@ -43,19 +43,6 @@ using namespace osl;
namespace stoc_corefl namespace stoc_corefl
{ {
#define IMPLNAME "com.sun.star.comp.stoc.CoreReflection"
static Sequence< OUString > core_getSupportedServiceNames()
{
Sequence< OUString > seqNames { "com.sun.star.reflection.CoreReflection" };
return seqNames;
}
static OUString core_getImplementationName()
{
return OUString(IMPLNAME);
}
IdlReflectionServiceImpl::IdlReflectionServiceImpl( IdlReflectionServiceImpl::IdlReflectionServiceImpl(
const Reference< XComponentContext > & xContext ) const Reference< XComponentContext > & xContext )
: OComponentHelper( _aComponentMutex ) : OComponentHelper( _aComponentMutex )
...@@ -140,7 +127,7 @@ void IdlReflectionServiceImpl::dispose() ...@@ -140,7 +127,7 @@ void IdlReflectionServiceImpl::dispose()
OUString IdlReflectionServiceImpl::getImplementationName() OUString IdlReflectionServiceImpl::getImplementationName()
{ {
return core_getImplementationName(); return OUString("com.sun.star.comp.stoc.CoreReflection");
} }
sal_Bool IdlReflectionServiceImpl::supportsService( const OUString & rServiceName ) sal_Bool IdlReflectionServiceImpl::supportsService( const OUString & rServiceName )
...@@ -150,7 +137,8 @@ sal_Bool IdlReflectionServiceImpl::supportsService( const OUString & rServiceNam ...@@ -150,7 +137,8 @@ sal_Bool IdlReflectionServiceImpl::supportsService( const OUString & rServiceNam
Sequence< OUString > IdlReflectionServiceImpl::getSupportedServiceNames() Sequence< OUString > IdlReflectionServiceImpl::getSupportedServiceNames()
{ {
return core_getSupportedServiceNames(); Sequence< OUString > seqNames { "com.sun.star.reflection.CoreReflection" };
return seqNames;
} }
// XIdlReflection // XIdlReflection
...@@ -390,32 +378,35 @@ uno_Interface * IdlReflectionServiceImpl::mapToUno( ...@@ -390,32 +378,35 @@ uno_Interface * IdlReflectionServiceImpl::mapToUno(
static_cast<XWeak *>(static_cast<OWeakObject *>(this)) ); static_cast<XWeak *>(static_cast<OWeakObject *>(this)) );
} }
/// @throws css::uno::Exception
Reference< XInterface > SAL_CALL IdlReflectionServiceImpl_create(
const Reference< XComponentContext > & xContext )
{
return Reference< XInterface >( static_cast<XWeak *>(static_cast<OWeakObject *>(new IdlReflectionServiceImpl( xContext ))) );
} }
}
namespace {
using namespace stoc_corefl; struct Instance {
explicit Instance(
css::uno::Reference<css::uno::XComponentContext> const & context):
instance(new stoc_corefl::IdlReflectionServiceImpl(context))
{}
static const struct ImplementationEntry g_entries[] = rtl::Reference<cppu::OWeakObject> instance;
{
{
IdlReflectionServiceImpl_create, core_getImplementationName,
core_getSupportedServiceNames, createSingleComponentFactory,
nullptr, 0
},
{ nullptr, nullptr, nullptr, nullptr, nullptr, 0 }
}; };
extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL reflection_component_getFactory( struct Singleton:
const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey ) public rtl::StaticWithArg<
Instance, css::uno::Reference<css::uno::XComponentContext>, Singleton>
{};
}
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
com_sun_star_comp_stoc_CoreReflection_get_implementation(
css::uno::XComponentContext * context,
css::uno::Sequence<css::uno::Any> const & arguments)
{ {
return component_getFactoryHelper( pImplName, pServiceManager, pRegistryKey , g_entries ); SAL_WARN_IF(
arguments.hasElements(), "stoc", "unexpected singleton arguments");
return cppu::acquire(Singleton::get(context).instance.get());
} }
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -18,8 +18,9 @@ ...@@ -18,8 +18,9 @@
--> -->
<component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@" <component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
prefix="reflection" xmlns="http://openoffice.org/2010/uno-components"> xmlns="http://openoffice.org/2010/uno-components">
<implementation name="com.sun.star.comp.stoc.CoreReflection"> <implementation name="com.sun.star.comp.stoc.CoreReflection"
constructor="com_sun_star_comp_stoc_CoreReflection_get_implementation">
<service name="com.sun.star.reflection.CoreReflection"/> <service name="com.sun.star.reflection.CoreReflection"/>
<singleton name="com.sun.star.reflection.theCoreReflection"/> <singleton name="com.sun.star.reflection.theCoreReflection"/>
</implementation> </implementation>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment