WIP: Direct service ctor calls at least on Android/iOS

Change-Id: I8a1907bc4b8f2134efb15d38a0fb5176b4384317
This commit is contained in:
Stephan Bergmann
2013-12-19 14:42:10 +01:00
parent 9dccff429d
commit 15abebbde5
2 changed files with 72 additions and 3 deletions

View File

@@ -3408,6 +3408,17 @@ void ServiceType::dumpHxxFile(
OUString headerDefine(dumpHeaderDefine(o, "HPP"));
o << "\n";
includes.dump(o, 0);
if (!entity_->getConstructors().empty()) {
o << ("\n#if defined ANDROID || defined IOS //TODO\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\" void * SAL_CALL LO_URE_CTOR_FUN_"
<< name_.replaceAll(".", "_dot_") << "(void *, void *);\n#endif\n";
}
o << "\n";
if (codemaker::cppumaker::dumpNamespaceOpen(o, name_, false)) {
o << "\n";
@@ -3436,14 +3447,28 @@ void ServiceType::dumpHxxFile(
<< "::css::uno::Reference< " << scopedBaseName
<< " > the_instance;\n" << indent() << "try {\n";
inc();
o << indent()
<< "the_instance = ::css::uno::Reference< "
o << ("#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 >().get())), ::SAL_NO_ACQUIRE),"
" ::css::uno::UNO_QUERY);\n#else\n")
<< indent() << "the_instance = ::css::uno::Reference< "
<< scopedBaseName
<< (" >(the_context->getServiceManager()->"
"createInstanceWithContext(::rtl::OUString("
" \"")
<< name_
<< "\" ), the_context), ::css::uno::UNO_QUERY);\n";
<< "\" ), the_context), ::css::uno::UNO_QUERY);\n#endif\n";
dec();
o << indent()
<< "} catch (const ::css::uno::RuntimeException &) {\n";

View File

@@ -0,0 +1,44 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#ifndef INCLUDED_OSL_DETAIL_COMPONENT_DEFINES_H
#define INCLUDED_OSL_DETAIL_COMPONENT_DEFINES_H
/* Experimental direct constructor calls, under construction */
#define LO_URE_CURRENT_ENV 1 /*TODO*/
#define LO_URE_CTOR_ENV_com_dot_sun_dot_star_dot_comp_dot_extensions_dot_xml_dot_sax_dot_FastParser 1 /*TODO*/
#define LO_URE_CTOR_FUN_com_dot_sun_dot_star_dot_comp_dot_extensions_dot_xml_dot_sax_dot_FastParser com_sun_star_comp_extensions_xml_sax_FastParser
#define LO_URE_CTOR_ENV_com_dot_sun_dot_star_dot_comp_dot_extensions_dot_xml_dot_sax_dot_ParserExpat 1 /*TODO*/
#define LO_URE_CTOR_FUN_com_dot_sun_dot_star_dot_comp_dot_extensions_dot_xml_dot_sax_dot_ParserExpat com_sun_star_comp_extensions_xml_sax_ParserExpat
#define LO_URE_CTOR_ENV_com_dot_sun_dot_star_dot_comp_dot_stoc_dot_DLLComponentLoader 1 /*TODO*/
#define LO_URE_CTOR_FUN_com_dot_sun_dot_star_dot_comp_dot_stoc_dot_DLLComponentLoader com_sun_star_comp_stoc_DLLComponentLoader
#define LO_URE_CTOR_ENV_com_dot_sun_dot_star_dot_comp_dot_stoc_dot_ImplementationRegistration 1 /*TODO*/
#define LO_URE_CTOR_FUN_com_dot_sun_dot_star_dot_comp_dot_stoc_dot_ImplementationRegistration com_sun_star_comp_stoc_ImplementationRegistration
#define LO_URE_CTOR_ENV_com_dot_sun_dot_star_dot_comp_dot_stoc_dot_NestedRegistry 1 /*TODO*/
#define LO_URE_CTOR_FUN_com_dot_sun_dot_star_dot_comp_dot_stoc_dot_NestedRegistry com_sun_star_comp_stoc_NestedRegistry
#define LO_URE_CTOR_ENV_com_dot_sun_dot_star_dot_comp_dot_stoc_dot_ORegistryServiceManager 1 /*TODO*/
#define LO_URE_CTOR_FUN_com_dot_sun_dot_star_dot_comp_dot_stoc_dot_ORegistryServiceManager com_sun_star_comp_stoc_ORegistryServiceManager
#define LO_URE_CTOR_ENV_com_dot_sun_dot_star_dot_comp_dot_stoc_dot_OServiceManager 1 /*TODO*/
#define LO_URE_CTOR_FUN_com_dot_sun_dot_star_dot_comp_dot_stoc_dot_OServiceManager com_sun_star_comp_stoc_OServiceManager
#define LO_URE_CTOR_ENV_com_dot_sun_dot_star_dot_comp_dot_stoc_dot_OServiceManagerWrapper 1 /*TODO*/
#define LO_URE_CTOR_FUN_com_dot_sun_dot_star_dot_comp_dot_stoc_dot_OServiceManagerWrapper com_sun_star_comp_stoc_OServiceManagerWrapper
#define LO_URE_CTOR_ENV_com_dot_sun_dot_star_dot_comp_dot_stoc_dot_SimpleRegistry 1 /*TODO*/
#define LO_URE_CTOR_FUN_com_dot_sun_dot_star_dot_comp_dot_stoc_dot_SimpleRegistry com_sun_star_comp_stoc_SimpleRegistry
#define LO_URE_CTOR_ENV_com_dot_sun_dot_star_dot_extensions_dot_xml_dot_sax_dot_Writer 1 /*TODO*/
#define LO_URE_CTOR_FUN_com_dot_sun_dot_star_dot_extensions_dot_xml_dot_sax_dot_Writer com_sun_star_extensions_xml_sax_Writer
#define LO_URE_CTOR_ENV_com_dot_sun_dot_star_dot_security_dot_comp_dot_stoc_dot_AccessController 1 /*TODO*/
#define LO_URE_CTOR_FUN_com_dot_sun_dot_star_dot_security_dot_comp_dot_stoc_dot_AccessController com_sun_star_security_comp_stoc_AccessController
#define LO_URE_CTOR_ENV_com_dot_sun_dot_star_dot_security_dot_comp_dot_stoc_dot_FilePolicy 1 /*TODO*/
#define LO_URE_CTOR_FUN_com_dot_sun_dot_star_dot_security_dot_comp_dot_stoc_dot_FilePolicy com_sun_star_security_comp_stoc_FilePolicy
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */