summaryrefslogtreecommitdiff
path: root/codemaker
diff options
context:
space:
mode:
authorMatúš Kukan <matus.kukan@collabora.com>2014-01-27 10:09:06 +0100
committerMatúš Kukan <matus.kukan@collabora.com>2014-01-28 18:52:21 +0100
commit3774a6fd94bfb274cc6b354ad7dadde4fce20113 (patch)
treeeac9664d7ec0b17e01f2851f3eb8cd25e5d5939c /codemaker
parent478ec0126ba8b2d89fadcc02b52bfb29c2edb9d8 (diff)
Support direct ctor calls for singletons too.
Change-Id: I6db797c950b8222b3ad95faff86adf5e7b41ff4b
Diffstat (limited to 'codemaker')
-rw-r--r--codemaker/source/cppumaker/cpputype.cxx34
1 files changed, 31 insertions, 3 deletions
diff --git a/codemaker/source/cppumaker/cpputype.cxx b/codemaker/source/cppumaker/cpputype.cxx
index 7af4fb4b32d9..d172d29e9430 100644
--- a/codemaker/source/cppumaker/cpputype.cxx
+++ b/codemaker/source/cppumaker/cpputype.cxx
@@ -3742,6 +3742,18 @@ void SingletonType::dumpHxxFile(
includes.addRtlUstringH();
includes.addRtlUstringHxx();
includes.dump(o, 0);
+ o << ("\n#if defined ANDROID || defined IOS //TODO\n"
+ "#include <com/sun/star/lang/XInitialization.hpp>\n"
+ "#include <osl/detail/component-defines.h>\n#endif\n\n"
+ "#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_")
+ << name_.replaceAll(".", "_dot_")
+ << " && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_"
+ << name_.replaceAll(".", "_dot_") << ") && defined LO_URE_CTOR_FUN_"
+ << name_.replaceAll(".", "_dot_")
+ << "\nextern \"C\" ::css::uno::XInterface * SAL_CALL LO_URE_CTOR_FUN_"
+ << name_.replaceAll(".", "_dot_")
+ << "(::css::uno::XComponentContext *, ::css::uno::Sequence< "
+ "::css::uno::Any > const &);\n#endif\n";
o << "\n";
if (codemaker::cppumaker::dumpNamespaceOpen(o, name_, false)) {
o << "\n";
@@ -3758,10 +3770,26 @@ void SingletonType::dumpHxxFile(
inc();
o << indent() << "assert(the_context.is());\n" << indent()
<< "::css::uno::Reference< " << scopedBaseName
- << " > instance;\n" << indent()
- << ("if (!(the_context->getValueByName("
+ << " > instance;\n"
+ << ("#if defined LO_URE_CURRENT_ENV && defined "
+ "LO_URE_CTOR_ENV_")
+ << name_.replaceAll(".", "_dot_")
+ << " && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_"
+ << name_.replaceAll(".", "_dot_")
+ << ") && defined LO_URE_CTOR_FUN_"
+ << name_.replaceAll(".", "_dot_") << "\n" << indent()
+ << "the_instance = ::css::uno::Reference< " << scopedBaseName
+ << (" >(::css::uno::Reference< ::css::uno::XInterface >("
+ "static_cast< ::css::uno::XInterface * >((*"
+ "LO_URE_CTOR_FUN_")
+ << name_.replaceAll(".", "_dot_")
+ << (")(the_context.get(), ::css::uno::Sequence<"
+ " ::css::uno::Any >())), ::SAL_NO_ACQUIRE),"
+ " ::css::uno::UNO_QUERY);\n#else\n")
+ << indent() << ("the_context->getValueByName("
"::rtl::OUString( \"/singletons/")
- << name_ << "\" )) >>= instance) || !instance.is()) {\n";
+ << name_ << "\" )) >>= instance;\n" << "#endif\n"
+ << indent() << "if (!instance.is()) {\n";
inc();
o << indent()
<< ("throw ::css::uno::DeploymentException("