...by using UnoInOutParam in all cases. Some types whose Embind mappings don't
employ any smart pointers (like any and sequence) would have worked directly
with pointers, but others (like string and type) would have caused Embind errors
at runtime. So consistently use UnoInOutParam in all cases (and generate
bindings for all the used cases in embindmaker).
Change-Id: If26551bf4e99d10748aec1597d6e99f994dfd86e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166854
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
...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>
...though
> let seq = new Module.uno_Sequence_string(["foo", "bar", "baz"]);
> // ...
> delete seq;
is still ugly.
And Embind only allows for overload resolution by number of parameters, not by
their type, so using the original sequence constructor had to be changed to
> let seq = new Module.uno_Sequence_string(3, Module.uno_Sequence.FromSize);
> seq.set(0, "foo");
> seq.set(1, "bar");
> seq.set(2, "baz");
> // ...
> delete seq;
Change-Id: If26ff4a485ba16b65cf24b6fe729d379c733c473
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163097
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
Ideally, JS code would have a way to create instances of arbitrary UNO sequence
types (to e.g. put them into Anys), but that goes against the static nature of
Embind. So at least register JS support for all those UNO sequence types that
are actually used in the UNO API. (This would cause duplicate failures, though,
if we generated multiple separate .cxx files from embindmaker invocations, with
registration code for the same UNO sequence types.)
(Even more ideally, UNO sequence types could map to JS arrays, and/oror be
garbage-collected on the JS side rather than needing explicit delete(). The
resize/size/get/set interface in unoembindhelpers::registerSequence is modelled
after Embind's emscripten::register_vector.)
Change-Id: Icd38b2e03db442dd613b9222b9bd092f947f7bec
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162849
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
...to make use of the automatic finalization clean-up of smart pointers
available with recent versions of Embind (so that explicitly calling delete() on
them should largely be optional now). See the changes to static/README.wasm.md
for how code should look like now. (The Module.uno_Reference.FromAny dummy
argument for the interface constructor converting from an Any is only necessary
to distinguish it from the other constructor, as otherwise Embind complains
because: "Overload resolution is currently only performed using the parameter
count, not actual type info!")
Change-Id: Ia8a8c12e38af1093948bf8a20ecd31aa6591e912
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162697
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>