You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if (args[{{ jsArg }}]->Is{{ cppClassName|cppToV8 }}()) {
5
-
{% endif %}
4
+
{%if isOptional | or isBoolean %}
6
5
7
-
{% if cppClassName == 'String' %}
6
+
if (args[{{ jsArg }}]->Is{{ cppClassName|cppToV8 }}()) {
7
+
{%endif%}
8
+
{%if cppClassName == 'String'%}
8
9
9
-
String::Utf8Value {{ name }}(args[{{ jsArg }}]->ToString());
10
-
from_{{ name }} = ({{ cType }}) strdup(*{{ name }});
10
+
String::Utf8Value {{ name }}(args[{{ jsArg }}]->ToString());
11
+
from_{{ name }} = ({{ cType }}) strdup(*{{ name }});
12
+
{%elsif cppClassName == 'Wrapper'%}
11
13
12
-
{% elsif cppClassName == 'Wrapper' %}
14
+
String::Utf8Value {{ name }}(args[{{ jsArg }}]->ToString());
15
+
from_{{ name }} = ({{ cType }}) strdup(*{{ name }});
16
+
{%elsif cppClassName == 'Array'%}
13
17
14
-
String::Utf8Value {{ name }}(args[{{ jsArg }}]->ToString());
15
-
from_{{ name }} = ({{ cType }}) strdup(*{{ name }});
18
+
Array *tmp_{{ name }} = Array::Cast(*args[{{ jsArg }}]);
19
+
from_{{ name }} = ({{ cType }})malloc(tmp_{{ name }}->Length() * sizeof({{ cType|replace '**''*' }}));
20
+
for (unsignedint i = 0; i < tmp_{{ name }}->Length(); i++) {
21
+
{%--
22
+
// FIXME: should recursively call convertFromv8.
23
+
--%}
24
+
from_{{ name }}[i] = ObjectWrap::Unwrap<{{ arrayElementCppClassName }}>(tmp_{{ name }}->Get(NanNew<Number>(static_cast<double>(i)))->ToObject())->GetValue();
25
+
}
26
+
{%elsif cppClassName == 'Function'%}
27
+
{%elsif cppClassName == 'Buffer'%}
16
28
17
-
{% elsif cppClassName == 'Array' %}
29
+
from_{{ name }} = Buffer::Data(args[{{ jsArg }}]->ToObject());
30
+
{%elsif cppClassName|isV8Value %}
18
31
19
-
Array *tmp_{{ name }} = Array::Cast(*args[{{ jsArg }}]);
20
-
from_{{ name }} = ({{ cType }})malloc(tmp_{{ name }}->Length() * sizeof({{ cType|replace '**''*' }}));
21
-
for (unsignedint i = 0; i < tmp_{{ name }}->Length(); i++) {
{%-- FIXME: should recursively call convertFromv8. --%}
24
-
from_{{ name }}[i] = ObjectWrap::Unwrap<{{ arrayElementCppClassName }}>(tmp_{{ name }}->Get(NanNew<Number>(static_cast<double>(i)))->ToObject())->GetValue();
25
-
}
26
-
{% elsif cppClassName == 'Function' %}
27
-
28
-
{% elsif cppClassName == 'Buffer' %}
29
-
30
-
from_{{ name }} = Buffer::Data(args[{{ jsArg }}]->ToObject());
0 commit comments