Kaydet (Commit) 6059652f authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Move addSingletonContextEntries to ServiceManager

Change-Id: I2a4c5b1f1f735e2bf5a8670d2f957f84388f0164
üst 882aaee5
......@@ -92,22 +92,7 @@ cppu::defaultBootstrap_InitialComponentContext(rtl::OUString const & iniUri)
css::uno::makeAny(
cppuhelper::detail::create_bootstrap_macro_expander_factory()),
true));
cppuhelper::ServiceManager::Data const & data = smgr->getData();
for (cppuhelper::ServiceManager::Data::ImplementationMap::const_iterator i(
data.singletons.begin());
i != data.singletons.end(); ++i)
{
assert(!i->second.empty());
assert(i->second[0].get() != 0);
SAL_INFO_IF(
i->second.size() > 1, "cppuhelper",
"Arbitrarily chosing " << i->second[0]->info->name
<< " among multiple implementations for " << i->first);
context_values.push_back(
cppu::ContextEntry_Init(
"/singletons/" + i->first,
css::uno::makeAny(i->second[0]->info->name), true));
}
smgr->addSingletonContextEntries(&context_values);
context_values.push_back(
cppu::ContextEntry_Init(
"/services/com.sun.star.security.AccessController/mode",
......
......@@ -29,6 +29,7 @@
#include "com/sun/star/uno/Reference.hxx"
#include "com/sun/star/uno/XComponentContext.hpp"
#include "cppuhelper/bootstrap.hxx"
#include "cppuhelper/component_context.hxx"
#include "cppuhelper/implbase1.hxx"
#include "cppuhelper/implbase3.hxx"
#include "cppuhelper/shlib.hxx"
......@@ -38,6 +39,7 @@
#include "rtl/ref.hxx"
#include "rtl/uri.hxx"
#include "rtl/ustring.hxx"
#include "sal/log.hxx"
#include "xmlreader/xmlreader.hxx"
#include "paths.hxx"
......@@ -596,6 +598,26 @@ void FactoryWrapper::loadImplementation(
}
void cppuhelper::ServiceManager::addSingletonContextEntries(
std::vector< cppu::ContextEntry_Init > * entries) const
{
assert(entries != 0);
for (Data::ImplementationMap::const_iterator i(data_.singletons.begin());
i != data_.singletons.end(); ++i)
{
assert(!i->second.empty());
assert(i->second[0].get() != 0);
SAL_INFO_IF(
i->second.size() > 1, "cppuhelper",
"Arbitrarily chosing " << i->second[0]->info->name
<< " among multiple implementations for " << i->first);
entries->push_back(
cppu::ContextEntry_Init(
"/singletons/" + i->first,
css::uno::makeAny(i->second[0]->info->name), true));
}
}
void cppuhelper::ServiceManager::loadImplementation(
css::uno::Reference< css::uno::XComponentContext > const & context,
boost::shared_ptr< Data::ImplementationInfo > const & info,
......
......@@ -34,6 +34,8 @@
#include "registry/registry.hxx"
#include "rtl/ustring.hxx"
namespace cppu { struct ContextEntry_Init; }
namespace cppuhelper {
typedef cppu::WeakComponentImplHelper8<
......@@ -142,13 +144,14 @@ public:
context_ = context;
}
void addSingletonContextEntries(
std::vector< cppu::ContextEntry_Init > * entries) const;
css::uno::Reference< css::uno::XComponentContext > getContext() const {
assert(context_.is());
return context_;
}
Data const & getData() const { return data_; }
void loadImplementation(
css::uno::Reference< css::uno::XComponentContext > const & context,
boost::shared_ptr< Data::ImplementationInfo > const & info,
......
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