diff options
author | Stephan Bergmann <stephan.bergmann@allotropia.de> | 2024-01-18 21:10:35 +0100 |
---|---|---|
committer | Stephan Bergmann <stephan.bergmann@allotropia.de> | 2024-01-19 08:12:18 +0100 |
commit | 2bc1c113a4b37e97d9faf9c88aec01d5a0af7dae (patch) | |
tree | 454dca4b5db69d02dc518220ee476857116cc7f6 /codemaker | |
parent | 229864a103b6ba8714a62609167be2deae16b987 (diff) |
Clean up generated embind code a bit
For one, no need to wrap in #ifdef EMSCRIPTEN code that is only ever fed into
emcc anyway. For another, better use fully qualified names throughout generated
code, to avoid unexpected collisions.
Change-Id: I939728c7e0601e5fb3f3634bbd62f35042d91105
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162266
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
Diffstat (limited to 'codemaker')
-rw-r--r-- | codemaker/source/cppumaker/cpputype.cxx | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/codemaker/source/cppumaker/cpputype.cxx b/codemaker/source/cppumaker/cpputype.cxx index f600cff8ad8c..cfb1fd750a5f 100644 --- a/codemaker/source/cppumaker/cpputype.cxx +++ b/codemaker/source/cppumaker/cpputype.cxx @@ -610,12 +610,9 @@ void CppuType::dumpHFileContent( void CppuType::dumpEmbindCppFile(FileStream &out) { - out << "#ifdef EMSCRIPTEN\n"; out << "#include <emscripten/bind.h>\n" "#include <" << name_.replace('.', '/') << ".hpp>\n"; - out << "using namespace emscripten;\n\n"; dumpEmbindDeclaration(out); - out << "#endif\n"; } void CppuType::dumpGetCppuType(FileStream & out) @@ -1232,7 +1229,7 @@ void InterfaceType::dumpEmbindDeclaration(FileStream & out) codemaker::cppumaker::dumpTypeIdentifier(out, name_); out << ") {\n"; - out << "\nclass_<" << codemaker::cpp::scopedCppName(u2b(name_)) << ">(\""; + out << "\n::emscripten::class_<" << codemaker::cpp::scopedCppName(u2b(name_)) << ">(\""; codemaker::cppumaker::dumpTypeFullWithDecorator(out, name_, u"$"); codemaker::cppumaker::dumpTypeIdentifier(out, name_); out << "\")\n"; @@ -1245,7 +1242,7 @@ void InterfaceType::dumpEmbindDeclaration(FileStream & out) dec(); // dump reference bindings. - out << "\nclass_<::css::uno::Reference<" << codemaker::cpp::scopedCppName(u2b(name_)) << ">, base<::css::uno::BaseReference>>(\""; + out << "\n::emscripten::class_<::css::uno::Reference<" << codemaker::cpp::scopedCppName(u2b(name_)) << ">, ::emscripten::base<::css::uno::BaseReference>>(\""; codemaker::cppumaker::dumpTypeFullWithDecorator(out, name_, u"$"); codemaker::cppumaker::dumpTypeIdentifier(out, name_); out << "Ref\")\n"; @@ -1253,8 +1250,8 @@ void InterfaceType::dumpEmbindDeclaration(FileStream & out) out << indent() << ".constructor<>()\n" << indent() << ".constructor<::css::uno::BaseReference, ::css::uno::UnoReference_Query>()\n" << indent() << ".function(\"is\", &::css::uno::Reference<" << codemaker::cpp::scopedCppName(u2b(name_)) << ">::is)\n" - << indent() << ".function(\"get\", &::css::uno::Reference<" << codemaker::cpp::scopedCppName(u2b(name_)) << ">::get, allow_raw_pointers())\n" - << indent() << ".function(\"set\", emscripten::select_overload<bool(const ::css::uno::Any&, com::sun::star::uno::UnoReference_Query)>(&::css::uno::Reference<" << codemaker::cpp::scopedCppName(u2b(name_)) << ">::set))\n"; + << indent() << ".function(\"get\", &::css::uno::Reference<" << codemaker::cpp::scopedCppName(u2b(name_)) << ">::get, ::emscripten::allow_raw_pointers())\n" + << indent() << ".function(\"set\", ::emscripten::select_overload<bool(const ::css::uno::Any&, com::sun::star::uno::UnoReference_Query)>(&::css::uno::Reference<" << codemaker::cpp::scopedCppName(u2b(name_)) << ">::set))\n"; dumpEmbindAttributeBindings(out); dumpEmbindMethodBindings(out, true); out << indent() << ";\n"; @@ -1447,7 +1444,7 @@ void InterfaceType::dumpEmbindWrapperFunc(FileStream& out, } dumpParameters(/*bDumpType=*/false); - out << "); }, allow_raw_pointers() )\n"; + out << "); }, ::emscripten::allow_raw_pointers() )\n"; } void InterfaceType::dumpEmbindMethodBindings(FileStream & out, bool bDumpForReference) const |