static/source/embindmaker/embindmaker.cxx | 7 +------ static/source/unoembindhelpers/PrimaryBindings.cxx | 5 +++++ unotest/source/embindtest/embindtest.js | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-)
New commits: commit 1bf2d3fa8ed016eaf71d8b3acc3fc779ee32e223 Author: Stephan Bergmann <stephan.bergm...@allotropia.de> AuthorDate: Fri Apr 19 10:35:14 2024 +0200 Commit: Stephan Bergmann <stephan.bergm...@allotropia.de> CommitDate: Sat Apr 20 11:57:16 2024 +0200 Embind: Drop $equals, add sameUnoObject $equals was the last remaining special $... method that we added to the UNO interfaces, and it looks better anyway to turn it into a symmetric free function (that can be called with null for either argument) that is actually independent of specific interface types Change-Id: I22a1d08b8b15a0ed2dd37fa9fbc95f568641dec3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166317 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <stephan.bergm...@allotropia.de> diff --git a/static/source/embindmaker/embindmaker.cxx b/static/source/embindmaker/embindmaker.cxx index f9540c1f006b..6c0017ccb8c2 100644 --- a/static/source/embindmaker/embindmaker.cxx +++ b/static/source/embindmaker/embindmaker.cxx @@ -1088,12 +1088,7 @@ SAL_IMPLEMENT_MAIN() " .class_function(\"reference\", +[](" << cppName(ifc) << " * the_interface) { return ::com::sun::star::uno::Reference(the_interface); " - "}, ::emscripten::allow_raw_pointers()) " - " .function(\"$equals\", +[](::com::sun::star::uno::Reference<" - << cppName(ifc) - << "> const & the_self, " - "::com::sun::star::uno::Reference<::com::sun::star::uno::XInterface> const & " - "the_other) { return the_self == the_other; }) "; + "}, ::emscripten::allow_raw_pointers()) "; if (bases.size() > 1) { std::set<OUString> visitedBases; diff --git a/static/source/unoembindhelpers/PrimaryBindings.cxx b/static/source/unoembindhelpers/PrimaryBindings.cxx index 7abf88669d02..862cbb1101e2 100644 --- a/static/source/unoembindhelpers/PrimaryBindings.cxx +++ b/static/source/unoembindhelpers/PrimaryBindings.cxx @@ -13,8 +13,10 @@ #include <emscripten/bind.h> #include <com/sun/star/uno/Any.hxx> +#include <com/sun/star/uno/Reference.hxx> #include <com/sun/star/uno/RuntimeException.hpp> #include <com/sun/star/uno/Type.hxx> +#include <com/sun/star/uno/XInterface.hpp> #include <comphelper/processfactory.hxx> #include <cppuhelper/exc_hlp.hxx> #include <o3tl/any.hxx> @@ -401,6 +403,9 @@ EMSCRIPTEN_BINDINGS(PrimaryBindings) function("throwUnoException", +[](css::uno::Type const& type, emscripten::val const& value) { cppu::throwException(constructAny(type, value)); }); + function("sameUnoObject", + +[](css::uno::Reference<css::uno::XInterface> const& ref1, + css::uno::Reference<css::uno::XInterface> const& ref2) { return ref1 == ref2; }); function("rtl_uString_release", +[](std::uintptr_t ptr) { rtl_uString_release(reinterpret_cast<rtl_uString*>(ptr)); }); diff --git a/unotest/source/embindtest/embindtest.js b/unotest/source/embindtest/embindtest.js index 784530597392..6d89a728dbdf 100644 --- a/unotest/source/embindtest/embindtest.js +++ b/unotest/source/embindtest/embindtest.js @@ -308,7 +308,7 @@ Module.addOnPostRun(function() { { let v = test.getAnyInterface(); console.log(v); - console.assert(v.get().$equals(test)); + console.assert(Module.sameUnoObject(v.get(), test)); console.assert(test.isAnyInterface(v)); v.delete(); let a = new Module.uno_Any( commit 1c8893876015b667fba5dabbc9d4422896021898 Author: Stephan Bergmann <stephan.bergm...@allotropia.de> AuthorDate: Fri Apr 19 13:26:49 2024 +0200 Commit: Stephan Bergmann <stephan.bergm...@allotropia.de> CommitDate: Sat Apr 20 11:57:03 2024 +0200 Embind: Don't use new when getting UNO singletons Change-Id: I23265f46b25cb88796267abe28aac1100523e71b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166298 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <stephan.bergm...@allotropia.de> diff --git a/unotest/source/embindtest/embindtest.js b/unotest/source/embindtest/embindtest.js index f3bd0df2740e..784530597392 100644 --- a/unotest/source/embindtest/embindtest.js +++ b/unotest/source/embindtest/embindtest.js @@ -11,7 +11,7 @@ Module.addOnPostRun(function() { console.log('Running embindtest'); let uno = init_unoembind_uno(Module); let css = uno.com.sun.star; - let test = new uno.org.libreoffice.embindtest.Test(Module.getUnoComponentContext()); + let test = uno.org.libreoffice.embindtest.Test(Module.getUnoComponentContext()); console.assert(typeof test === 'object'); { let v = test.getBoolean();