summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephan Bergmann <stephan.bergmann@allotropia.de>2024-04-19 10:35:14 +0200
committerStephan Bergmann <stephan.bergmann@allotropia.de>2024-04-20 11:57:16 +0200
commit1bf2d3fa8ed016eaf71d8b3acc3fc779ee32e223 (patch)
tree77b7e5c30f093ab8392ac0e2099243991cd3d500
parent1c8893876015b667fba5dabbc9d4422896021898 (diff)
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.bergmann@allotropia.de>
-rw-r--r--static/source/embindmaker/embindmaker.cxx7
-rw-r--r--static/source/unoembindhelpers/PrimaryBindings.cxx5
-rw-r--r--unotest/source/embindtest/embindtest.js2
3 files changed, 7 insertions, 7 deletions
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())\n"
- " .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; })\n";
+ "}, ::emscripten::allow_raw_pointers())\n";
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(