summaryrefslogtreecommitdiffstats
path: root/codemaker/source/cppumaker/cpputype.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'codemaker/source/cppumaker/cpputype.cxx')
-rw-r--r--codemaker/source/cppumaker/cpputype.cxx204
1 files changed, 0 insertions, 204 deletions
diff --git a/codemaker/source/cppumaker/cpputype.cxx b/codemaker/source/cppumaker/cpputype.cxx
index 2b995e1d31ae..9ae5d689072e 100644
--- a/codemaker/source/cppumaker/cpputype.cxx
+++ b/codemaker/source/cppumaker/cpputype.cxx
@@ -159,7 +159,6 @@ OString getFileExtension(FileType eFileType)
default:
case FileType::HDL: return ".hdl"_ostr;
case FileType::HPP: return ".hpp"_ostr;
- case FileType::EMBIND_CXX: return "_embind.cxx"_ostr;
}
}
@@ -189,8 +188,6 @@ public:
virtual void dumpHppFile(FileStream& o, codemaker::cppumaker::Includes & includes) = 0;
- void dumpEmbindCppFile(FileStream& o);
-
OUString dumpHeaderDefine(FileStream& o, std::u16string_view extension) const;
void dumpGetCppuType(FileStream & out);
@@ -241,8 +238,6 @@ protected:
assert(false); // this cannot happen
}
- virtual void dumpEmbindDeclaration(FileStream &) {};
-
virtual void dumpFiles(OUString const & uri, CppuOptions const & options);
virtual void addLightGetCppuTypeIncludes(
@@ -324,8 +319,6 @@ void CppuType::dumpFiles(OUString const & uri, CppuOptions const & options)
{
dumpFile(uri, name_, FileType::HDL, options);
dumpFile(uri, name_, FileType::HPP, options);
- if(options.isValid("-W"_ostr))
- dumpFile(uri, name_, FileType::EMBIND_CXX, options);
}
void CppuType::addLightGetCppuTypeIncludes(
@@ -460,9 +453,6 @@ void CppuType::dumpFile(
case FileType::HDL:
dumpHdlFile(out, includes);
break;
- case FileType::EMBIND_CXX:
- dumpEmbindCppFile(out);
- break;
}
} catch (...) {
out.close();
@@ -608,13 +598,6 @@ void CppuType::dumpHFileContent(
out << " *);\n\n#endif\n";
}
-void CppuType::dumpEmbindCppFile(FileStream &out)
-{
- out << "#include <emscripten/bind.h>\n"
- "#include <" << name_.replace('.', '/') << ".hpp>\n";
- dumpEmbindDeclaration(out);
-}
-
void CppuType::dumpGetCppuType(FileStream & out)
{
if (name_ == "com.sun.star.uno.XInterface") {
@@ -1136,14 +1119,10 @@ public:
OUString const & name, rtl::Reference< TypeManager > const & typeMgr);
virtual void dumpDeclaration(FileStream& o) override;
- virtual void dumpEmbindDeclaration(FileStream& o) override;
void dumpHppFile(FileStream& o, codemaker::cppumaker::Includes & includes) override;
void dumpAttributes(FileStream& o) const;
- void dumpEmbindAttributeBindings(FileStream& o) const;
void dumpMethods(FileStream& o) const;
- void dumpEmbindMethodBindings(FileStream& o, bool bDumpForReference=false) const;
- void dumpEmbindWrapperFunc(FileStream& o, const unoidl::InterfaceTypeEntity::Method& method, bool bDumpForReference=false) const;
void dumpNormalGetCppuType(FileStream& o) override;
void dumpComprehensiveGetCppuType(FileStream& o) override;
void dumpCppuAttributeRefs(FileStream& o, sal_uInt32& index);
@@ -1214,53 +1193,6 @@ void InterfaceType::dumpDeclaration(FileStream & out)
out << "};\n\n";
}
-void InterfaceType::dumpEmbindDeclaration(FileStream & out)
-{
- // TODO: This is a temporary workaround that likely causes the Embind UNO
- // bindings to leak memory. Reference counting and cloning mechanisms of
- // Embind should be investigated to figure out what exactly we need here.
- out << "namespace emscripten { namespace internal { \n"
- "template<> void raw_destructor<" << codemaker::cpp::scopedCppName(u2b(name_))
- << ">(" << codemaker::cpp::scopedCppName(u2b(name_)) << "*){}\n"
- "}}\n";
-
- out << "EMSCRIPTEN_BINDINGS(uno_bindings_";
- codemaker::cppumaker::dumpTypeFullWithDecorator(out, name_, u"_");
- codemaker::cppumaker::dumpTypeIdentifier(out, name_);
- out << ") {\n";
-
- out << "\n::emscripten::class_<" << codemaker::cpp::scopedCppName(u2b(name_)) << ">(\"";
- codemaker::cppumaker::dumpTypeFullWithDecorator(out, name_, u"$");
- codemaker::cppumaker::dumpTypeIdentifier(out, name_);
- out << "\")\n";
-
- inc();
- // dump bindings for attributes and methods.
- dumpEmbindAttributeBindings(out);
- dumpEmbindMethodBindings(out);
- out << indent() << ";\n";
- dec();
-
- // dump reference bindings.
- 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";
- inc();
- 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, ::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";
- dec();
-
- out << "}\n";
-}
-
-
void InterfaceType::dumpHppFile(
FileStream & out, codemaker::cppumaker::Includes & includes)
{
@@ -1312,31 +1244,6 @@ void InterfaceType::dumpAttributes(FileStream & out) const
}
}
-void InterfaceType::dumpEmbindAttributeBindings(FileStream& out) const
-{
- if (!entity_->getDirectAttributes().empty())
- {
- out << indent() << "// Bindings for attributes\n";
- }
- for (const unoidl::InterfaceTypeEntity::Attribute& attr : entity_->getDirectAttributes())
- {
- if (m_isDeprecated || isDeprecated(attr.annotations))
- continue;
-
- out << indent();
- out << ".function(\"";
- out << "get" << attr.name << "\", &" << codemaker::cpp::scopedCppName(u2b(name_)) << "::get"
- << attr.name << ")\n";
- if (!attr.readOnly)
- {
- out << indent();
- out << ".function(\"";
- out << "set" << attr.name << "\", &" << codemaker::cpp::scopedCppName(u2b(name_))
- << "::set" << attr.name << ")\n";
- }
- }
-}
-
void InterfaceType::dumpMethods(FileStream & out) const
{
if (!entity_->getDirectMethods().empty()) {
@@ -1377,115 +1284,6 @@ void InterfaceType::dumpMethods(FileStream & out) const
}
}
-void InterfaceType::dumpEmbindWrapperFunc(FileStream& out,
- const unoidl::InterfaceTypeEntity::Method& method,
- bool bDumpForReference) const
-{
- out << indent();
- out << ".function(\"" << method.name << "\", ";
- out << indent() << "+[](";
- if (bDumpForReference)
- out << "::css::uno::Reference<";
- out << codemaker::cpp::scopedCppName(u2b(name_));
- if (bDumpForReference)
- out << ">";
- out << "* self";
- if(!method.parameters.empty())
- out << ",";
-
- auto dumpParameters = [&](bool bDumpType)
- {
- // dumpParams with references as pointers
- if (!method.parameters.empty())
- {
- out << " ";
- for (std::vector<unoidl::InterfaceTypeEntity::Method::Parameter>::const_iterator
- parameter(method.parameters.begin());
- parameter != method.parameters.end();)
- {
- bool isConst;
- bool isRef;
- if (parameter->direction
- == unoidl::InterfaceTypeEntity::Method::Parameter::DIRECTION_IN)
- {
- isConst = passByReference(parameter->type);
- isRef = isConst;
- }
- else
- {
- isConst = false;
- isRef = true;
- }
- // for the embind wrapper, we define a pointer instead of a reference.
- if (bDumpType)
- dumpType(out, parameter->type, isConst, /*isRef=*/false);
- if (isRef)
- out << "*";
-
- out << " " << parameter->name;
- ++parameter;
- if (parameter != method.parameters.end())
- {
- out << ", ";
- }
- }
- out << " ";
- }
- };
- dumpParameters(/*bDumpType=*/true);
-
- if (bDumpForReference)
- {
- out << ") { return self->get()->" << method.name << "(";
- }
- else
- {
- out << ") { return self->" << method.name << "(";
- }
-
- dumpParameters(/*bDumpType=*/false);
- out << "); }, ::emscripten::allow_raw_pointers() )\n";
-}
-
-void InterfaceType::dumpEmbindMethodBindings(FileStream & out, bool bDumpForReference) const
-{
- if (!entity_->getDirectMethods().empty()) {
- out << indent() << "// Bindings for methods\n";
- }
- for (const unoidl::InterfaceTypeEntity::Method& method : entity_->getDirectMethods()) {
- if( m_isDeprecated || isDeprecated(method.annotations) )
- continue;
-
- // if dumping the method binding for a reference implementation
- // dump wrapper.
- if(bDumpForReference)
- {
- dumpEmbindWrapperFunc(out, method, true);
- continue;
- }
-
- bool bHasOutParams = std::any_of(
- method.parameters.begin(), method.parameters.end(),
- [](const auto& parameter) {
- return parameter.direction
- != unoidl::InterfaceTypeEntity::Method::Parameter::DIRECTION_IN;
- });
-
- if (bHasOutParams)
- {
- dumpEmbindWrapperFunc(out, method, false);
- continue;
- }
-
- out << indent();
- out << ".function(\"" << method.name << "\", &"
- << codemaker::cpp::scopedCppName(u2b(name_))
- << "::" << method.name << ")\n";
- }
-}
-
-
-
void InterfaceType::dumpNormalGetCppuType(FileStream & out)
{
dumpGetCppuTypePreamble(out);
@@ -3748,8 +3546,6 @@ private:
virtual void dumpFiles(OUString const & uri, CppuOptions const & options) override {
dumpFile(uri, name_, FileType::HPP, options);
- if(options.isValid("-W"_ostr))
- dumpFile(uri, name_, FileType::EMBIND_CXX, options);
}
};