Now the test is passing, but weird messages like the following are still
happenning:
CRI<26264>: lib/eina/eina_array.c:181 eina_array_accessor_clone() *** Eina Magic Check Failed at 0x1633a30 !!!
Input handle is wrong type
Expected: 9876123b - Eina Array
Supplied: 00007f1d - (unknown)
*** NAUGHTY PROGRAMMER!!!
*** SPANK SPANK SPANK!!!
*** Now go fix your code. Tut tut tut!
I tracked these messages down to `eina_accessor_clone` function, called
inside the efl::eina::accessor copy constructor.
Maybe it's related to used version of the eina. Needs to rebase and
investigate further.
There's a minor improvement to do, though.
The efl::eina::stringshare "stealing" ctor has a wrong parameter type
and this prevents it from being used in the binding itself. It should
be fixed and the "TODO" comments on the code added by this commit will
help on the change.
It's a function that check if an error is set and convert to a
JavaScript exception. The exception object is well specified and
useful, giving sane information about the object and following a
model similar to the one used by the Eina_Value binding.
There is value_cast, which can be used to convert back and forth between
efl::eina::value and v8::Local<v8::Value>. value_cast will throw
std::bad_cast if conversion fails.
There is also `register_*_value` functions to setup the global object
that act like a bridge between the C++ code and the JavaScript code.
There are several tests also.
The JavaScript code will use a non-idiomatic API which needs to manually
clean the resources. Ideally, we'd allow construction in the familiar
`new eina_value(42)` way, but the `this` JavaScript reference is exposed
to C++ code through V8 as `v8::Local<v8::Value>`, which cannot be used
to register finalizers. Finalizers support is only supported in
`v8::Persistent`.
Future work include:
- Fix failing tests.
- Need to investigate why the code below fails:
```
efl::eina::get<std::string>(efl::eina::value(std::string("Matroška")));
efl::eina::get<efl::eina::stringshare>(efl::eina::value(std::string("Matroška")));
```
- The bridge between JavaScript and C++ code (`register_*_value`
functions) isn't handling all errors as it should. Implement and add
tests.
- Move most of the code out of the headers. Currently I'm stumbling upon
a linking problem.