summaryrefslogtreecommitdiff
path: root/cppuhelper
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2013-01-15 17:22:16 +0100
committerStephan Bergmann <sbergman@redhat.com>2013-01-16 11:39:02 +0100
commitaed1f0d5d543c534b4b9c3517802a24e700f0b5a (patch)
treef17bca0ce3036020ec6b2343c2405155f65bd476 /cppuhelper
parent3250fad6374ef276e198faabbb1d655adeeb28f0 (diff)
Simplify defaultbootstrap.cxx
Change-Id: Ice206b1dabf8dbcad613f886574e737c039d2119
Diffstat (limited to 'cppuhelper')
-rw-r--r--cppuhelper/source/defaultbootstrap.cxx70
1 files changed, 32 insertions, 38 deletions
diff --git a/cppuhelper/source/defaultbootstrap.cxx b/cppuhelper/source/defaultbootstrap.cxx
index 23411b1ffbb4..e4b3cd537117 100644
--- a/cppuhelper/source/defaultbootstrap.cxx
+++ b/cppuhelper/source/defaultbootstrap.cxx
@@ -52,12 +52,33 @@
namespace {
-css::uno::Reference< css::uno::XComponentContext > bootstrapComponentContext(
- css::uno::Reference< css::registry::XSimpleRegistry > const & typeRegistry,
- rtl::OUString const & serviceUris, rtl::Bootstrap const & bootstrap)
+rtl::OUString getBootstrapVariable(
+ rtl::Bootstrap const & bootstrap, rtl::OUString const & name)
{
+ rtl::OUString v;
+ if (!bootstrap.getFrom(name, v)) {
+ throw css::uno::DeploymentException(
+ "Cannot obtain " + name + " from uno ini",
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ return v;
+}
+
+}
+
+css::uno::Reference< css::uno::XComponentContext >
+cppu::defaultBootstrap_InitialComponentContext(rtl::OUString const & iniUri)
+ SAL_THROW((css::uno::Exception))
+{
+ rtl::Bootstrap bs(iniUri);
+ if (bs.getHandle() == 0) {
+ throw css::uno::DeploymentException(
+ "Cannot open uno ini " + iniUri,
+ css::uno::Reference< css::uno::XInterface >());
+ }
rtl::Reference< cppuhelper::ServiceManager > smgr(
- new cppuhelper::ServiceManager(serviceUris));
+ new cppuhelper::ServiceManager(
+ getBootstrapVariable(bs, "UNO_SERVICES")));
cppu::ContextEntry_Init entry;
std::vector< cppu::ContextEntry_Init > context_values;
context_values.push_back(
@@ -95,7 +116,7 @@ css::uno::Reference< css::uno::XComponentContext > bootstrapComponentContext(
"/singletons/" + i->first,
css::uno::makeAny(i->second[0]->info->name), true));
}
- cppu::add_access_control_entries(&context_values, bootstrap);
+ cppu::add_access_control_entries(&context_values, bs);
assert(!context_values.empty());
css::uno::Reference< css::uno::XComponentContext > context(
createComponentContext(
@@ -106,9 +127,13 @@ css::uno::Reference< css::uno::XComponentContext > bootstrapComponentContext(
context->getValueByName(
"/singletons/com.sun.star.reflection.theTypeDescriptionManager"),
css::uno::UNO_QUERY_THROW);
- if (typeRegistry.is()) {
+ css::uno::Reference< css::registry::XSimpleRegistry > typereg(
+ cppuhelper::createTypeRegistry(
+ getBootstrapVariable(bs, "UNO_TYPES"),
+ getBootstrapVariable(bs, "URE_INTERNAL_LIB_DIR")));
+ if (typereg.is()) {
css::uno::Sequence< css::uno::Any > arg(1);
- arg[0] <<= typeRegistry;
+ arg[0] <<= typereg;
css::uno::Reference< css::container::XSet >(
tdmgr, css::uno::UNO_QUERY_THROW)->
insert(
@@ -122,37 +147,6 @@ css::uno::Reference< css::uno::XComponentContext > bootstrapComponentContext(
return context;
}
-rtl::OUString getBootstrapVariable(
- rtl::Bootstrap const & bootstrap, rtl::OUString const & name)
-{
- rtl::OUString v;
- if (!bootstrap.getFrom(name, v)) {
- throw css::uno::DeploymentException(
- "Cannot obtain " + name + " from uno ini",
- css::uno::Reference< css::uno::XInterface >());
- }
- return v;
-}
-
-}
-
-css::uno::Reference< css::uno::XComponentContext >
-cppu::defaultBootstrap_InitialComponentContext(rtl::OUString const & iniUri)
- SAL_THROW((css::uno::Exception))
-{
- rtl::Bootstrap bs(iniUri);
- if (bs.getHandle() == 0) {
- throw css::uno::DeploymentException(
- "Cannot open uno ini " + iniUri,
- css::uno::Reference< css::uno::XInterface >());
- }
- return bootstrapComponentContext(
- cppuhelper::createTypeRegistry(
- getBootstrapVariable(bs, "UNO_TYPES"),
- getBootstrapVariable(bs, "URE_INTERNAL_LIB_DIR")),
- getBootstrapVariable(bs, "UNO_SERVICES"), bs);
-}
-
css::uno::Reference< css::uno::XComponentContext >
cppu::defaultBootstrap_InitialComponentContext()
SAL_THROW((css::uno::Exception))