tdf#74608: Constructor function for SimpleLogRing singleton
Change-Id: Ia8c2f214b635114ecac4a2ceb06628a2f18b6411 Reviewed-on: https://gerrit.libreoffice.org/22020 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
This commit is contained in:
parent
f84b8c0346
commit
1b6a84a5a2
@ -25,7 +25,6 @@
|
||||
void createRegistryInfo_Map();
|
||||
void createRegistryInfo_OInstanceLocker();
|
||||
void createRegistryInfo_OPropertyBag();
|
||||
void createRegistryInfo_OSimpleLogRing();
|
||||
void createRegistryInfo_SequenceInputStream();
|
||||
void createRegistryInfo_SequenceOutputStream();
|
||||
void createRegistryInfo_UNOMemoryStream();
|
||||
|
@ -40,7 +40,6 @@ namespace comphelper { namespace module
|
||||
createRegistryInfo_UNOMemoryStream();
|
||||
createRegistryInfo_OInstanceLocker();
|
||||
createRegistryInfo_Map();
|
||||
createRegistryInfo_OSimpleLogRing();
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -20,12 +20,11 @@
|
||||
|
||||
#include <com/sun/star/frame/DoubleInitializationException.hpp>
|
||||
#include <com/sun/star/lang/IllegalArgumentException.hpp>
|
||||
|
||||
#include <comphelper_module.hxx>
|
||||
#include <comphelper_services.hxx>
|
||||
#include <com/sun/star/uno/XComponentContext.hpp>
|
||||
#include <cppuhelper/supportsservice.hxx>
|
||||
|
||||
#include "documentiologring.hxx"
|
||||
#include <rtl/ref.hxx>
|
||||
|
||||
using namespace ::com::sun::star;
|
||||
|
||||
@ -46,31 +45,6 @@ OSimpleLogRing::~OSimpleLogRing()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
uno::Sequence< OUString > SAL_CALL OSimpleLogRing::getSupportedServiceNames_static()
|
||||
{
|
||||
uno::Sequence<OUString> aResult { getServiceName_static() };
|
||||
return aResult;
|
||||
}
|
||||
|
||||
|
||||
OUString SAL_CALL OSimpleLogRing::getImplementationName_static()
|
||||
{
|
||||
return OUString( "com.sun.star.comp.logging.SimpleLogRing" );
|
||||
}
|
||||
|
||||
|
||||
OUString SAL_CALL OSimpleLogRing::getServiceName_static()
|
||||
{
|
||||
return OUString( "com.sun.star.logging.SimpleLogRing" );
|
||||
}
|
||||
|
||||
|
||||
uno::Reference< uno::XInterface > SAL_CALL OSimpleLogRing::Create( SAL_UNUSED_PARAMETER const uno::Reference< uno::XComponentContext >& )
|
||||
{
|
||||
return static_cast< cppu::OWeakObject* >( new OSimpleLogRing );
|
||||
}
|
||||
|
||||
// XSimpleLogRing
|
||||
|
||||
void SAL_CALL OSimpleLogRing::logString( const OUString& aMessage ) throw (uno::RuntimeException, std::exception)
|
||||
@ -135,7 +109,7 @@ void SAL_CALL OSimpleLogRing::initialize( const uno::Sequence< uno::Any >& aArgu
|
||||
// XServiceInfo
|
||||
OUString SAL_CALL OSimpleLogRing::getImplementationName() throw (uno::RuntimeException, std::exception)
|
||||
{
|
||||
return getImplementationName_static();
|
||||
return OUString("com.sun.star.comp.logging.SimpleLogRing");
|
||||
}
|
||||
|
||||
sal_Bool SAL_CALL OSimpleLogRing::supportsService( const OUString& aServiceName ) throw (uno::RuntimeException, std::exception)
|
||||
@ -145,15 +119,33 @@ sal_Bool SAL_CALL OSimpleLogRing::supportsService( const OUString& aServiceName
|
||||
|
||||
uno::Sequence< OUString > SAL_CALL OSimpleLogRing::getSupportedServiceNames() throw (uno::RuntimeException, std::exception)
|
||||
{
|
||||
return getSupportedServiceNames_static();
|
||||
return { "com.sun.star.logging.SimpleLogRing" };
|
||||
}
|
||||
|
||||
} // namespace comphelper
|
||||
|
||||
void createRegistryInfo_OSimpleLogRing()
|
||||
namespace {
|
||||
|
||||
struct Instance {
|
||||
explicit Instance():
|
||||
instance(new comphelper::OSimpleLogRing())
|
||||
{}
|
||||
|
||||
css::uno::Reference<cppu::OWeakObject> instance;
|
||||
};
|
||||
|
||||
struct Singleton:
|
||||
public rtl::Static<Instance, Singleton>
|
||||
{};
|
||||
|
||||
}
|
||||
|
||||
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
|
||||
com_sun_star_comp_logging_SimpleLogRing(
|
||||
css::uno::XComponentContext *,
|
||||
css::uno::Sequence<css::uno::Any> const &)
|
||||
{
|
||||
static ::comphelper::module::OAutoRegistration< ::comphelper::OSimpleLogRing > aAutoRegistration;
|
||||
static ::comphelper::module::OSingletonRegistration< ::comphelper::OSimpleLogRing > aSingletonRegistration;
|
||||
return cppu::acquire(Singleton::get().instance.get());
|
||||
}
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||
|
@ -48,16 +48,6 @@ public:
|
||||
OSimpleLogRing();
|
||||
virtual ~OSimpleLogRing();
|
||||
|
||||
static css::uno::Sequence< OUString > SAL_CALL
|
||||
getSupportedServiceNames_static();
|
||||
|
||||
static OUString SAL_CALL getImplementationName_static();
|
||||
|
||||
static OUString SAL_CALL getServiceName_static();
|
||||
|
||||
static css::uno::Reference< css::uno::XInterface > SAL_CALL
|
||||
Create( const css::uno::Reference< css::uno::XComponentContext >& rxContext );
|
||||
|
||||
// XSimpleLogRing
|
||||
virtual void SAL_CALL logString( const OUString& aMessage ) throw (css::uno::RuntimeException, std::exception) override;
|
||||
virtual css::uno::Sequence< OUString > SAL_CALL getCollectedLog() throw (css::uno::RuntimeException, std::exception) override;
|
||||
|
@ -46,7 +46,8 @@
|
||||
<implementation name="com.sun.star.comp.embed.InstanceLocker">
|
||||
<service name="com.sun.star.embed.InstanceLocker"/>
|
||||
</implementation>
|
||||
<implementation name="com.sun.star.comp.logging.SimpleLogRing">
|
||||
<implementation name="com.sun.star.comp.logging.SimpleLogRing"
|
||||
constructor="com_sun_star_comp_logging_SimpleLogRing">
|
||||
<service name="com.sun.star.logging.SimpleLogRing"/>
|
||||
<singleton name="com.sun.star.logging.DocumentIOLogRing"/>
|
||||
</implementation>
|
||||
|
Loading…
x
Reference in New Issue
Block a user