25#include <com/sun/star/uno/XNamingService.hpp>
26#include <com/sun/star/lang/XServiceInfo.hpp>
29#include <unordered_map>
34using namespace css::uno;
35using namespace css::lang;
36using namespace css::registry;
46class NamingService_Impl
47 :
public WeakImplHelper < XServiceInfo, XNamingService >
59 virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getRegisteredObject(
const OUString& Name )
override;
60 virtual void SAL_CALL registerObject(
const OUString& Name,
const css::uno::Reference< css::uno::XInterface >& Object )
override;
61 virtual void SAL_CALL revokeObject(
const OUString& Name )
override;
68NamingService_Impl::NamingService_Impl() {}
71OUString NamingService_Impl::getImplementationName()
73 return "com.sun.star.comp.stoc.NamingService";
77sal_Bool NamingService_Impl::supportsService(
const OUString & rServiceName )
83Sequence< OUString > NamingService_Impl::getSupportedServiceNames()
85 return {
"com.sun.star.uno.NamingService" };
89Reference< XInterface > NamingService_Impl::getRegisteredObject(
const OUString& Name )
91 std::scoped_lock aGuard(
aMutex );
92 Reference< XInterface > xRet;
93 HashMap_OWString_Interface::iterator aIt =
aMap.find( Name );
94 if( aIt !=
aMap.end() )
100void NamingService_Impl::registerObject(
const OUString& Name,
const Reference< XInterface >& Object )
102 std::scoped_lock aGuard(
aMutex );
107void NamingService_Impl::revokeObject(
const OUString& Name )
109 std::scoped_lock aGuard(
aMutex );
115extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
117 css::uno::XComponentContext* , css::uno::Sequence<css::uno::Any>
const&)
119 return cppu::acquire(
new stoc_namingservice::NamingService_Impl());
css::uno::Sequence< OUString > getSupportedServiceNames()
OUString getImplementationName()
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
std::unordered_map< OUString, Reference< XInterface > > HashMap_OWString_Interface
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * stoc_NamingService_Impl_get_implementation(css::uno::XComponentContext *, css::uno::Sequence< css::uno::Any > const &)
HashMap_OWString_Interface aMap