summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephan Bergmann <stephan.bergmann@allotropia.de>2024-03-01 12:49:40 +0100
committerStephan Bergmann <stephan.bergmann@allotropia.de>2024-03-04 21:42:58 +0100
commit8428368d79118f1d0e09615c5d2b92065b8838d4 (patch)
tree7208963452966880185cbb19ec25b8454abd4ac7
parent82bfc24c9ceb00a730580ad9338ead2f64437d05 (diff)
Improve Embing'ing of UNO Any somewhat
Change-Id: I82e38ac815765b62601076cf61745fe9889451b3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164358 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
-rw-r--r--static/source/unoembindhelpers/PrimaryBindings.cxx141
-rw-r--r--udkapi/org/libreoffice/embindtest/XTest.idl36
-rw-r--r--unotest/source/embindtest/embindtest.cxx182
-rw-r--r--unotest/source/embindtest/embindtest.js201
4 files changed, 513 insertions, 47 deletions
diff --git a/static/source/unoembindhelpers/PrimaryBindings.cxx b/static/source/unoembindhelpers/PrimaryBindings.cxx
index 50048a97ada6..5b76b549cb13 100644
--- a/static/source/unoembindhelpers/PrimaryBindings.cxx
+++ b/static/source/unoembindhelpers/PrimaryBindings.cxx
@@ -12,9 +12,12 @@
#include <emscripten.h>
#include <emscripten/bind.h>
+#include <com/sun/star/uno/Any.hxx>
#include <com/sun/star/uno/RuntimeException.hpp>
#include <com/sun/star/uno/Type.hxx>
#include <comphelper/processfactory.hxx>
+#include <o3tl/any.hxx>
+#include <o3tl/unreachable.hxx>
#include <rtl/string.hxx>
#include <rtl/textcvt.h>
#include <rtl/textenc.h>
@@ -25,6 +28,7 @@
#include <typelib/typedescription.h>
#include <cstdint>
+#include <stdexcept>
#include <string>
#include <typeinfo>
@@ -179,52 +183,97 @@ EMSCRIPTEN_BINDINGS(PrimaryBindings)
});
// Any
- class_<Any>("Any").constructor(+[](const val& rObject, const TypeClass& rUnoType) -> Any {
- switch (rUnoType)
- {
- case TypeClass_VOID:
- break;
- case TypeClass_CHAR:
- return Any{ rObject.as<sal_Int8>() };
- case TypeClass_BOOLEAN:
- return Any{ rObject.as<bool>() };
- case TypeClass_BYTE:
- return Any{ rObject.as<sal_Int8>() };
- case TypeClass_SHORT:
- return Any{ rObject.as<sal_Int16>() };
- case TypeClass_UNSIGNED_SHORT:
- return Any{ rObject.as<sal_uInt16>() };
- case TypeClass_LONG:
- return Any{ rObject.as<sal_Int32>() };
- case TypeClass_UNSIGNED_LONG:
- return Any{ rObject.as<sal_uInt32>() };
- case TypeClass_HYPER:
- return Any{ rObject.as<sal_Int64>() };
- case TypeClass_UNSIGNED_HYPER:
- return Any{ rObject.as<sal_uInt64>() };
- case TypeClass_FLOAT:
- return Any{ rObject.as<float>() };
- case TypeClass_DOUBLE:
- return Any{ rObject.as<double>() };
- case TypeClass_STRING:
- return Any{ OUString(rObject.as<std::u16string>()) };
- case TypeClass_TYPE:
- case TypeClass_ANY:
- case TypeClass_ENUM:
- case TypeClass_STRUCT:
- case TypeClass_EXCEPTION:
- case TypeClass_SEQUENCE:
- case TypeClass_INTERFACE:
- case TypeClass_TYPEDEF:
- case TypeClass_SERVICE:
- case TypeClass_MODULE:
- case TypeClass_INTERFACE_METHOD:
- case TypeClass_INTERFACE_ATTRIBUTE:
- default:
- break;
- }
- return {};
- });
+ class_<Any>("Any")
+ .constructor(+[](const val& rObject, const TypeClass& rUnoType) -> Any {
+ switch (rUnoType)
+ {
+ case TypeClass_VOID:
+ return {};
+ case TypeClass_BOOLEAN:
+ return Any{ rObject.as<bool>() };
+ case TypeClass_BYTE:
+ return Any{ rObject.as<sal_Int8>() };
+ case TypeClass_SHORT:
+ return Any{ rObject.as<sal_Int16>() };
+ case TypeClass_UNSIGNED_SHORT:
+ return Any{ rObject.as<sal_uInt16>() };
+ case TypeClass_LONG:
+ return Any{ rObject.as<sal_Int32>() };
+ case TypeClass_UNSIGNED_LONG:
+ return Any{ rObject.as<sal_uInt32>() };
+ case TypeClass_HYPER:
+ return Any{ rObject.as<sal_Int64>() };
+ case TypeClass_UNSIGNED_HYPER:
+ return Any{ rObject.as<sal_uInt64>() };
+ case TypeClass_FLOAT:
+ return Any{ rObject.as<float>() };
+ case TypeClass_DOUBLE:
+ return Any{ rObject.as<double>() };
+ case TypeClass_CHAR:
+ return Any{ rObject.as<char16_t>() };
+ case TypeClass_STRING:
+ return Any{ OUString(rObject.as<std::u16string>()) };
+ case TypeClass_TYPE:
+ return {}; //TODO
+ case TypeClass_SEQUENCE:
+ return {}; //TODO
+ case TypeClass_ENUM:
+ return {}; //TODO
+ case TypeClass_STRUCT:
+ return {}; //TODO
+ case TypeClass_EXCEPTION:
+ return {}; //TODO
+ case TypeClass_INTERFACE:
+ return {}; //TODO
+ default:
+ throw std::invalid_argument("bad type class");
+ }
+ })
+ .function("get", +[](css::uno::Any const& self) {
+ switch (self.getValueType().getTypeClass())
+ {
+ case css::uno::TypeClass_VOID:
+ return emscripten::val::undefined();
+ case css::uno::TypeClass_BOOLEAN:
+ return emscripten::val(*o3tl::forceAccess<bool>(self));
+ case css::uno::TypeClass_BYTE:
+ return emscripten::val(*o3tl::forceAccess<sal_Int8>(self));
+ case css::uno::TypeClass_SHORT:
+ return emscripten::val(*o3tl::forceAccess<sal_Int16>(self));
+ case css::uno::TypeClass_UNSIGNED_SHORT:
+ return emscripten::val(*o3tl::forceAccess<sal_uInt16>(self));
+ case css::uno::TypeClass_LONG:
+ return emscripten::val(*o3tl::forceAccess<sal_Int32>(self));
+ case css::uno::TypeClass_UNSIGNED_LONG:
+ return emscripten::val(*o3tl::forceAccess<sal_uInt32>(self));
+ case css::uno::TypeClass_HYPER:
+ return emscripten::val(*o3tl::forceAccess<sal_Int64>(self));
+ case css::uno::TypeClass_UNSIGNED_HYPER:
+ return emscripten::val(*o3tl::forceAccess<sal_uInt64>(self));
+ case css::uno::TypeClass_FLOAT:
+ return emscripten::val(*o3tl::forceAccess<float>(self));
+ case css::uno::TypeClass_DOUBLE:
+ return emscripten::val(*o3tl::forceAccess<double>(self));
+ case css::uno::TypeClass_CHAR:
+ return emscripten::val(*o3tl::forceAccess<sal_Unicode>(self));
+ case css::uno::TypeClass_STRING:
+ return emscripten::val(*o3tl::forceAccess<OUString>(self));
+ case css::uno::TypeClass_TYPE:
+ return emscripten::val(*o3tl::forceAccess<css::uno::Type>(self));
+ case css::uno::TypeClass_SEQUENCE:
+ return emscripten::val::undefined(); //TODO
+ case css::uno::TypeClass_ENUM:
+ return emscripten::val::undefined(); //TODO
+ case css::uno::TypeClass_STRUCT:
+ return emscripten::val::undefined(); //TODO
+ case css::uno::TypeClass_EXCEPTION:
+ return emscripten::val::undefined(); //TODO
+ case css::uno::TypeClass_INTERFACE:
+ return emscripten::val::undefined(); //TODO
+ default:
+ O3TL_UNREACHABLE;
+ };
+ });
registerInOutParam<bool>("uno_InOutParam_boolean");
registerInOutParam<sal_Int8>("uno_InOutParam_byte");
diff --git a/udkapi/org/libreoffice/embindtest/XTest.idl b/udkapi/org/libreoffice/embindtest/XTest.idl
index 2ddfb41f2ead..3338cf130f98 100644
--- a/udkapi/org/libreoffice/embindtest/XTest.idl
+++ b/udkapi/org/libreoffice/embindtest/XTest.idl
@@ -40,6 +40,40 @@ interface XTest {
boolean isEnum([in] Enum value);
Struct getStruct();
boolean isStruct([in] Struct value);
+ any getAnyVoid();
+ boolean isAnyVoid([in] any value);
+ any getAnyBoolean();
+ boolean isAnyBoolean([in] any value);
+ any getAnyByte();
+ boolean isAnyByte([in] any value);
+ any getAnyShort();
+ boolean isAnyShort([in] any value);
+ any getAnyUnsignedShort();
+ boolean isAnyUnsignedShort([in] any value);
+ any getAnyLong();
+ boolean isAnyLong([in] any value);
+ any getAnyUnsignedLong();
+ boolean isAnyUnsignedLong([in] any value);
+ any getAnyHyper();
+ boolean isAnyHyper([in] any value);
+ any getAnyUnsignedHyper();
+ boolean isAnyUnsignedHyper([in] any value);
+ any getAnyFloat();
+ boolean isAnyFloat([in] any value);
+ any getAnyDouble();
+ boolean isAnyDouble([in] any value);
+ any getAnyChar();
+ boolean isAnyChar([in] any value);
+ any getAnyString();
+ boolean isAnyString([in] any value);
+ any getAnyType();
+ boolean isAnyType([in] any value);
+ any getAnySequence();
+ boolean isAnySequence([in] any value);
+ any getAnyEnum();
+ boolean isAnyEnum([in] any value);
+ any getAnyStruct();
+ boolean isAnyStruct([in] any value);
sequence<boolean> getSequenceBoolean();
boolean isSequenceBoolean([in] sequence<boolean> value);
sequence<byte> getSequenceByte();
@@ -66,6 +100,8 @@ interface XTest {
boolean isSequenceString([in] sequence<string> value);
sequence<type> getSequenceType();
boolean isSequenceType([in] sequence<type> value);
+ sequence<any> getSequenceAny();
+ boolean isSequenceAny([in] sequence<any> value);
sequence<sequence<string> > getSequenceSequenceString();
boolean isSequenceSequenceString([in] sequence<sequence<string> > value);
sequence<Enum> getSequenceEnum();
diff --git a/unotest/source/embindtest/embindtest.cxx b/unotest/source/embindtest/embindtest.cxx
index 07558a5ed1b7..4570eb4822f8 100644
--- a/unotest/source/embindtest/embindtest.cxx
+++ b/unotest/source/embindtest/embindtest.cxx
@@ -9,11 +9,13 @@
#include <sal/config.h>
+#include <com/sun/star/uno/Any.hxx>
#include <com/sun/star/uno/Sequence.hxx>
#include <com/sun/star/uno/Type.hxx>
#include <cppu/unotype.hxx>
#include <cppuhelper/implbase.hxx>
#include <cppuhelper/weak.hxx>
+#include <o3tl/any.hxx>
#include <org/libreoffice/embindtest/Enum.hpp>
#include <org/libreoffice/embindtest/Struct.hpp>
#include <org/libreoffice/embindtest/XTest.hpp>
@@ -22,7 +24,6 @@
namespace com::sun::star::uno
{
-class Any;
class XComponentContext;
}
@@ -105,6 +106,165 @@ class Test : public cppu::WeakImplHelper<org::libreoffice::embindtest::XTest>
return value == org::libreoffice::embindtest::Struct{ -123456, 100.5, u"hä"_ustr };
}
+ css::uno::Any SAL_CALL getAnyVoid() override { return {}; }
+
+ sal_Bool SAL_CALL isAnyVoid(css::uno::Any const& value) override
+ {
+ return value.getValueType() == cppu::UnoType<void>::get();
+ }
+
+ css::uno::Any SAL_CALL getAnyBoolean() override { return css::uno::Any(true); }
+
+ sal_Bool SAL_CALL isAnyBoolean(css::uno::Any const& value) override
+ {
+ return value.getValueType() == cppu::UnoType<bool>::get()
+ && *o3tl::forceAccess<bool>(value);
+ }
+
+ css::uno::Any SAL_CALL getAnyByte() override { return css::uno::Any(sal_Int8(-12)); }
+
+ sal_Bool SAL_CALL isAnyByte(css::uno::Any const& value) override
+ {
+ return value.getValueType() == cppu::UnoType<sal_Int8>::get()
+ && *o3tl::forceAccess<sal_Int8>(value) == -12;
+ }
+
+ css::uno::Any SAL_CALL getAnyShort() override { return css::uno::Any(sal_Int16(-1234)); }
+
+ sal_Bool SAL_CALL isAnyShort(css::uno::Any const& value) override
+ {
+ return value.getValueType() == cppu::UnoType<sal_Int16>::get()
+ && *o3tl::forceAccess<sal_Int16>(value) == -1234;
+ }
+
+ css::uno::Any SAL_CALL getAnyUnsignedShort() override
+ {
+ return css::uno::Any(sal_uInt16(54321));
+ }
+
+ sal_Bool SAL_CALL isAnyUnsignedShort(css::uno::Any const& value) override
+ {
+ return value.getValueType() == cppu::UnoType<sal_uInt16>::get()
+ && *o3tl::forceAccess<sal_uInt16>(value) == 54321;
+ }
+
+ css::uno::Any SAL_CALL getAnyLong() override { return css::uno::Any(sal_Int32(-123456)); }
+
+ sal_Bool SAL_CALL isAnyLong(css::uno::Any const& value) override
+ {
+ return value.getValueType() == cppu::UnoType<sal_Int32>::get()
+ && *o3tl::forceAccess<sal_Int32>(value) == -123456;
+ }
+
+ css::uno::Any SAL_CALL getAnyUnsignedLong() override
+ {
+ return css::uno::Any(sal_uInt32(3456789012));
+ }
+
+ sal_Bool SAL_CALL isAnyUnsignedLong(css::uno::Any const& value) override
+ {
+ return value.getValueType() == cppu::UnoType<sal_uInt32>::get()
+ && *o3tl::forceAccess<sal_uInt32>(value) == 3456789012;
+ }
+
+ css::uno::Any SAL_CALL getAnyHyper() override { return css::uno::Any(sal_Int64(-123456789)); }
+
+ sal_Bool SAL_CALL isAnyHyper(css::uno::Any const& value) override
+ {
+ return value.getValueType() == cppu::UnoType<sal_Int64>::get()
+ && *o3tl::forceAccess<sal_Int64>(value) == -123456789;
+ }
+
+ css::uno::Any SAL_CALL getAnyUnsignedHyper() override
+ {
+ return css::uno::Any(sal_uInt64(9876543210));
+ }
+
+ sal_Bool SAL_CALL isAnyUnsignedHyper(css::uno::Any const& value) override
+ {
+ return value.getValueType() == cppu::UnoType<sal_uInt64>::get()
+ && *o3tl::forceAccess<sal_uInt64>(value) == 9876543210;
+ }
+
+ css::uno::Any SAL_CALL getAnyFloat() override { return css::uno::Any(-10.25f); }
+
+ sal_Bool SAL_CALL isAnyFloat(css::uno::Any const& value) override
+ {
+ return value.getValueType() == cppu::UnoType<float>::get()
+ && *o3tl::forceAccess<float>(value) == -10.25;
+ }
+
+ css::uno::Any SAL_CALL getAnyDouble() override { return css::uno::Any(100.5); }
+
+ sal_Bool SAL_CALL isAnyDouble(css::uno::Any const& value) override
+ {
+ return value.getValueType() == cppu::UnoType<double>::get()
+ && *o3tl::forceAccess<double>(value) == 100.5;
+ }
+
+ css::uno::Any SAL_CALL getAnyChar() override { return css::uno::Any(u'Ö'); }
+
+ sal_Bool SAL_CALL isAnyChar(css::uno::Any const& value) override
+ {
+ return value.getValueType() == cppu::UnoType<sal_Unicode>::get()
+ && *o3tl::forceAccess<sal_Unicode>(value) == u'Ö';
+ }
+
+ css::uno::Any SAL_CALL getAnyString() override { return css::uno::Any(u"hä"_ustr); }
+
+ sal_Bool SAL_CALL isAnyString(css::uno::Any const& value) override
+ {
+ return value.getValueType() == cppu::UnoType<OUString>::get()
+ && *o3tl::forceAccess<OUString>(value) == u"hä";
+ }
+
+ css::uno::Any SAL_CALL getAnyType() override
+ {
+ return css::uno::Any(cppu::UnoType<sal_Int32>::get());
+ }
+
+ sal_Bool SAL_CALL isAnyType(css::uno::Any const& value) override
+ {
+ return value.getValueType() == cppu::UnoType<css::uno::Type>::get()
+ && *o3tl::forceAccess<css::uno::Type>(value) == cppu::UnoType<sal_Int32>::get();
+ }
+
+ css::uno::Any SAL_CALL getAnySequence() override
+ {
+ return css::uno::Any(css::uno::Sequence{ u"foo"_ustr, u"barr"_ustr, u"bazzz"_ustr });
+ }
+
+ sal_Bool SAL_CALL isAnySequence(css::uno::Any const& value) override
+ {
+ return value.getValueType() == cppu::UnoType<css::uno::Sequence<OUString>>::get()
+ && *o3tl::forceAccess<css::uno::Sequence<OUString>>(value)
+ == css::uno::Sequence<OUString>{ u"foo"_ustr, u"barr"_ustr, u"bazzz"_ustr };
+ }
+
+ css::uno::Any SAL_CALL getAnyEnum() override
+ {
+ return css::uno::Any(org::libreoffice::embindtest::Enum_E_2);
+ }
+
+ sal_Bool SAL_CALL isAnyEnum(css::uno::Any const& value) override
+ {
+ return value.getValueType() == cppu::UnoType<org::libreoffice::embindtest::Enum>::get()
+ && *o3tl::forceAccess<org::libreoffice::embindtest::Enum>(value)
+ == org::libreoffice::embindtest::Enum_E_2;
+ }
+
+ css::uno::Any SAL_CALL getAnyStruct() override
+ {
+ return css::uno::Any(org::libreoffice::embindtest::Struct{ -123456, 100.5, u"hä"_ustr });
+ }
+
+ sal_Bool SAL_CALL isAnyStruct(css::uno::Any const& value) override
+ {
+ return value.getValueType() == cppu::UnoType<org::libreoffice::embindtest::Struct>::get()
+ && *o3tl::forceAccess<org::libreoffice::embindtest::Struct>(value)
+ == org::libreoffice::embindtest::Struct{ -123456, 100.5, u"hä"_ustr };
+ }
+
css::uno::Sequence<sal_Bool> SAL_CALL getSequenceBoolean() override
{
return { true, true, false };
@@ -237,6 +397,26 @@ class Test : public cppu::WeakImplHelper<org::libreoffice::embindtest::XTest>
};
}
+ css::uno::Sequence<css::uno::Any> SAL_CALL getSequenceAny() override
+ {
+ return { css::uno::Any(sal_Int32(-123456)), css::uno::Any(),
+ css::uno::Any(css::uno::Sequence<org::libreoffice::embindtest::Enum>{
+ org::libreoffice::embindtest::Enum_E_2, org::libreoffice::embindtest::Enum_E3,
+ org::libreoffice::embindtest::Enum_E_10 }) };
+ }
+
+ sal_Bool SAL_CALL isSequenceAny(css::uno::Sequence<css::uno::Any> const& value) override
+ {
+ return value
+ == css::uno::Sequence<css::uno::Any>{
+ css::uno::Any(sal_Int32(-123456)), css::uno::Any(),
+ css::uno::Any(css::uno::Sequence<org::libreoffice::embindtest::Enum>{
+ org::libreoffice::embindtest::Enum_E_2,
+ org::libreoffice::embindtest::Enum_E3,
+ org::libreoffice::embindtest::Enum_E_10 })
+ };
+ }
+
css::uno::Sequence<css::uno::Sequence<OUString>> SAL_CALL getSequenceSequenceString() override
{
return { {}, { u"foo"_ustr, u"barr"_ustr }, { u"baz"_ustr } };
diff --git a/unotest/source/embindtest/embindtest.js b/unotest/source/embindtest/embindtest.js
index 6f88a9f543d0..ab50c859e13e 100644
--- a/unotest/source/embindtest/embindtest.js
+++ b/unotest/source/embindtest/embindtest.js
@@ -10,6 +10,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());
console.assert(typeof test === 'object');
{
@@ -105,6 +106,187 @@ Module.addOnPostRun(function() {
console.assert(test.isStruct(v));
}
{
+ let v = test.getAnyVoid();
+ console.log(v);
+ console.assert(v.get() === undefined);
+ console.assert(test.isAnyVoid(v));
+ v.delete();
+ let a = new Module.Any(undefined, css.uno.TypeClass.VOID);
+ console.assert(test.isAnyVoid(a));
+ a.delete();
+ }
+ {
+ let v = test.getAnyBoolean();
+ console.log(v);
+ console.assert(v.get() === true);
+ console.assert(test.isAnyBoolean(v));
+ v.delete();
+ let a = new Module.Any(true, css.uno.TypeClass.BOOLEAN);
+ console.assert(test.isAnyBoolean(a));
+ a.delete();
+ }
+ {
+ let v = test.getAnyByte();
+ console.log(v);
+ console.assert(v.get() === -12);
+ console.assert(test.isAnyByte(v));
+ v.delete();
+ let a = new Module.Any(-12, css.uno.TypeClass.BYTE);
+ console.assert(test.isAnyByte(a));
+ a.delete();
+ }
+ {
+ let v = test.getAnyShort();
+ console.log(v);
+ console.assert(v.get() === -1234);
+ console.assert(test.isAnyShort(v));
+ v.delete();
+ let a = new Module.Any(-1234, css.uno.TypeClass.SHORT);
+ console.assert(test.isAnyShort(a));
+ a.delete();
+ }
+ {
+ let v = test.getAnyUnsignedShort();
+ console.log(v);
+ console.assert(v.get() === 54321);
+ console.assert(test.isAnyUnsignedShort(v));
+ v.delete();
+ let a = new Module.Any(54321, css.uno.TypeClass.UNSIGNED_SHORT);
+ console.assert(test.isAnyUnsignedShort(a));
+ a.delete();
+ }
+ {
+ let v = test.getAnyLong();
+ console.log(v);
+ console.assert(v.get() === -123456);
+ console.assert(test.isAnyLong(v));
+ v.delete();
+ let a = new Module.Any(-123456, css.uno.TypeClass.LONG);
+ console.assert(test.isAnyLong(a));
+ a.delete();
+ }
+ {
+ let v = test.getAnyUnsignedLong();
+ console.log(v);
+ console.assert(v.get() === 3456789012);
+ console.assert(test.isAnyUnsignedLong(v));
+ v.delete();
+ let a = new Module.Any(3456789012, css.uno.TypeClass.UNSIGNED_LONG);
+ console.assert(test.isAnyUnsignedLong(a));
+ a.delete();
+ }
+ {
+ let v = test.getAnyHyper();
+ console.log(v);
+ console.assert(v.get() === -123456789n);
+ console.assert(test.isAnyHyper(v));
+ v.delete();
+ let a = new Module.Any(-123456789n, css.uno.TypeClass.HYPER);
+ console.assert(test.isAnyHyper(a));
+ a.delete();
+ }
+ {
+ let v = test.getAnyUnsignedHyper();
+ console.log(v);
+ console.assert(v.get() === 9876543210n);
+ console.assert(test.isAnyUnsignedHyper(v));
+ v.delete();
+ let a = new Module.Any(9876543210n, css.uno.TypeClass.UNSIGNED_HYPER);
+ console.assert(test.isAnyUnsignedHyper(a));
+ a.delete();
+ }
+ {
+ let v = test.getAnyFloat();
+ console.log(v);
+ console.assert(v.get() === -10.25);
+ console.assert(test.isAnyFloat(v));
+ v.delete();
+ let a = new Module.Any(-10.25, css.uno.TypeClass.FLOAT);
+ console.assert(test.isAnyFloat(a));
+ a.delete();
+ }
+ {
+ let v = test.getAnyDouble();
+ console.log(v);
+ console.assert(v.get() === 100.5);
+ console.assert(test.isAnyDouble(v));
+ v.delete();
+ let a = new Module.Any(100.5, css.uno.TypeClass.DOUBLE);
+ console.assert(test.isAnyDouble(a));
+ a.delete();
+ }
+ {
+ let v = test.getAnyChar();
+ console.log(v);
+ console.assert(v.get() === 'Ö');
+ console.assert(test.isAnyChar(v));
+ v.delete();
+ let a = new Module.Any('Ö', css.uno.TypeClass.CHAR);
+ console.assert(test.isAnyChar(a));
+ a.delete();
+ }
+ {
+ let v = test.getAnyString();
+ console.log(v);
+ console.assert(v.get() === 'hä');
+ console.assert(test.isAnyString(v));
+ v.delete();
+ let a = new Module.Any('hä', css.uno.TypeClass.STRING);
+ console.assert(test.isAnyString(a));
+ a.delete();
+ }
+ {
+ let v = test.getAnyType();
+ console.log(v);
+ console.assert(v.get().toString() === 'long');
+ console.assert(test.isAnyType(v));
+ v.delete();
+ //TODO: let a = new Module.Any(TODO, css.uno.TypeClass.TYPE);
+ //TODO: console.assert(test.isAnyType(a));
+ //TODO: a.delete();
+ }
+ {
+ let v = test.getAnySequence();
+ console.log(v);
+ //TODO: let x = v.get();
+ //TODO: console.assert(x.size() === 3);
+ //TODO: console.assert(x.get(0) === 'foo');
+ //TODO: console.assert(x.get(1) === 'barr');
+ //TODO: console.assert(x.get(2) === 'bazzz');
+ //TODO: x.delete();
+ console.assert(test.isAnySequence(v));
+ v.delete();
+ let s = new Module.uno_Sequence_string(["foo", "barr", "bazzz"]);
+ //TODO: let a = new Module.Any(s, css.uno.TypeClass.SEQUENCE);
+ //TODO: console.assert(test.isAny(a));
+ //TODO: a.delete();
+ s.delete();
+ }
+ {
+ let v = test.getAnyEnum();
+ console.log(v);
+ //TODO: console.assert(v.get() === uno.org.libreoffice.embindtest.Enum.E_2);
+ console.assert(test.isAnyEnum(v));
+ v.delete();
+ //TODO: let a = new Module.Any(
+ //TODO: uno.org.libreoffice.embindtest.Enum.E_2, css.uno.TypeClass.ENUM);
+ //TODO: console.assert(test.isAny(a));
+ //TODO: a.delete();
+ }
+ {
+ let v = test.getAnyStruct();
+ console.log(v);
+ //TODO: console.assert(v.get().m1 === -123456);
+ //TODO: console.assert(v.get().m2 === 100.5);
+ //TODO: console.assert(v.get().m3 === 'hä');
+ console.assert(test.isAnyStruct(v));
+ v.delete();
+ //TODO: let a = new Module.Any(
+ //TODO: {m1: -123456, m2: 100.5, m3: 'hä'}, css.uno.TypeClass.STRUCT);
+ //TODO: console.assert(test.isAny(a));
+ //TODO: a.delete();
+ }
+ {
let v = test.getSequenceBoolean();
console.log(v);
console.assert(v.size() === 3);
@@ -235,6 +417,25 @@ Module.addOnPostRun(function() {
v.delete();
}
{
+ let v = test.getSequenceAny();
+ console.log(v);
+ console.assert(v.size() === 3);
+ let e0 = v.get(0);
+ console.assert(e0.get() === -123456);
+ e0.delete();
+ let e1 = v.get(1);
+ console.assert(e1.get() === undefined);
+ e1.delete();
+ //TODO: let e2 = v.get(2);
+ //TODO: console.assert(e2.size() === 3);
+ //TODO: console.assert(e2.get(0) == uno.org.libreoffice.embindtest.Enum.E_2);
+ //TODO: console.assert(e2.get(1) == uno.org.libreoffice.embindtest.Enum.E3);
+ //TODO: console.assert(e2.get(2) == uno.org.libreoffice.embindtest.Enum.E_10);
+ //TODO: e2.delete();
+ console.assert(test.isSequenceAny(v));
+ v.delete();
+ }
+ {
let v = test.getSequenceSequenceString();
console.log(v);
console.assert(v.size() === 3);