summaryrefslogtreecommitdiff
path: root/include/static
diff options
context:
space:
mode:
authorStephan Bergmann <stephan.bergmann@allotropia.de>2024-03-01 14:30:38 +0100
committerStephan Bergmann <stephan.bergmann@allotropia.de>2024-03-04 21:43:09 +0100
commit0bab5cda2123ecc7f3775d05ca5103bdef23bfe8 (patch)
treedf5128463025ae19e008fc6ae2d436c790a1bba1 /include/static
parent8428368d79118f1d0e09615c5d2b92065b8838d4 (diff)
Add Embing'ing of UNO Any getter for enums
...which taps into the internals of emscripten::val, which is based on std::type_info identifiers, so we need an additional statically-built mapping between UNO (enum, for now) types and std::type_info Change-Id: I9fc1ff33fe31a1e1052504905de446ed2193e014 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164359 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
Diffstat (limited to 'include/static')
-rw-r--r--include/static/unoembindhelpers/PrimaryBindings.hxx13
1 files changed, 13 insertions, 0 deletions
diff --git a/include/static/unoembindhelpers/PrimaryBindings.hxx b/include/static/unoembindhelpers/PrimaryBindings.hxx
index 80b55d5278ac..13ddd05cce26 100644
--- a/include/static/unoembindhelpers/PrimaryBindings.hxx
+++ b/include/static/unoembindhelpers/PrimaryBindings.hxx
@@ -14,11 +14,14 @@
#include <cstdint>
#include <limits>
#include <stdexcept>
+#include <typeinfo>
#include <emscripten/bind.h>
#include <com/sun/star/uno/Reference.hxx>
#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/uno/Type.hxx>
+#include <cppu/unotype.hxx>
#include <sal/types.h>
template <typename T> struct emscripten::smart_ptr_trait<css::uno::Reference<T>>
@@ -33,6 +36,11 @@ template <typename T> struct emscripten::smart_ptr_trait<css::uno::Reference<T>>
namespace unoembindhelpers
{
+namespace detail
+{
+void registerUnoType(css::uno::Type const& type, std::type_info const* id);
+}
+
enum class uno_Reference
{
FromAny
@@ -76,6 +84,11 @@ void checkSequenceAccess(css::uno::Sequence<T> const& sequence, sal_Int32 index)
}
}
+template <typename T> void registerUnoType()
+{
+ detail::registerUnoType(cppu::UnoType<T>::get(), &typeid(T));
+}
+
template <typename T> void registerSequence(char const* name)
{
emscripten::class_<css::uno::Sequence<T>>(name)