| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 6b30987 commit 70aefe5
4 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,3 @@ | |||
| 1 | + module.exports = function(cType) { | ||
| 2 | + return /\s*\*\s*/.test(cType); | ||
| 3 | + }; | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -33,6 +33,7 @@ var filters = { | |||
| 33 | 33 | or: require("./filters/or"), | |
| 34 | 34 | and: require("./filters/and"), | |
| 35 | 35 | isV8Value: require("./filters/is_v8_value"), | |
| 36 | + isPointer: require("./filters/is_pointer"), | ||
| 36 | 37 | unPointer: require("./filters/un_pointer"), | |
| 37 | 38 | defaultValue: require("./filters/default_value") | |
| 38 | 39 | }; | |
@@ -57,7 +58,6 @@ Object.keys(partials).forEach(function(partial) { | |||
| 57 | 58 | var enabled = idefs.filter(function(idef) { | |
| 58 | 59 | // Additionally provide a friendly name to the actual filename. | |
| 59 | 60 | idef.name = path.basename(idef.filename, ".h"); | |
| 60 | - idef.cTypeIsUndefined = typeof idef.cType == 'undefined'; | ||
| 61 | 61 | ||
| 62 | 62 | // We need some custom data on each of the functions | |
| 63 | 63 | idef.functions.forEach(function(fn) { | |
@@ -102,7 +102,6 @@ var enabled = idefs.filter(function(idef) { | |||
| 102 | 102 | arg.cArg = cArg; | |
| 103 | 103 | arg.v8ValueClassName = cppToV8(arg.cppClassName); | |
| 104 | 104 | arg.isCppClassStringOrArray = ~["String", "Array"].indexOf(arg.cppClassName); | |
| 105 | - arg.isPointer = /\s*\*\s*/.test(arg.cType); | ||
| 106 | 105 | arg.isDoublePointer = /\s*\*\*\s*/.test(arg.cType); | |
| 107 | 106 | arg.isV8Value = ~v8Values.indexOf(arg.cppClassName); | |
| 108 | 107 | ||
@@ -114,7 +113,7 @@ var enabled = idefs.filter(function(idef) { | |||
| 114 | 113 | fn.returns = []; | |
| 115 | 114 | ||
| 116 | 115 | // generate returns data | |
| 117 | - fn.argsInfo.forEach(function(arg) { | ||
| 116 | + fn.args.forEach(function(arg) { | ||
| 118 | 117 | if (!arg.isReturn) return; | |
| 119 | 118 | ||
| 120 | 119 | var _return = {}; | |
@@ -135,21 +134,6 @@ var enabled = idefs.filter(function(idef) { | |||
| 135 | 134 | if (!fn.returns.length | |
| 136 | 135 | && !fn.return.isErrorCode | |
| 137 | 136 | && fn.return.cType != "void") { | |
| 138 | - var _return = {}; | ||
| 139 | - | ||
| 140 | - _return = fn.return; | ||
| 141 | - | ||
| 142 | - _return.v8ValueClassName = cppToV8(_return.cppClassName); | ||
| 143 | - _return.isCppClassStringOrArray = ~["String", "Array"].indexOf(_return.cppClassName); | ||
| 144 | - _return.isPointer = /\s*\*\s*/.test(_return.cType); | ||
| 145 | - _return.isDoublePointer = /\s*\*\*\s*/.test(_return.cType); | ||
| 146 | - _return.isV8Value = ~v8Values.indexOf(_return.cppClassName); | ||
| 147 | - _return.parsedName = 'result'; | ||
| 148 | - _return.jsOrCppClassName = _return.jsClassName || _return.cppClassName; | ||
| 149 | - _return.isCppClassIntType = ~["Uint32", "Int32"].indexOf(_return.cppClassName); | ||
| 150 | - _return.parsedClassName = (_return.cppClassName || '').toLowerCase() + "_t"; | ||
| 151 | - _return.jsNameOrName = _return.jsName | _return.name; | ||
| 152 | - | ||
| 153 | 137 | fn.returns.push(fn.return); | |
| 154 | 138 | } | |
| 155 | 139 | ||
@@ -171,7 +155,6 @@ var enabled = idefs.filter(function(idef) { | |||
| 171 | 155 | fieldInfo.parsedName = field.name || "result"; | |
| 172 | 156 | fieldInfo.isCppClassIntType = ~["Uin32", "Int32"].indexOf(field.cppClassName); | |
| 173 | 157 | fieldInfo.parsedClassName = (field.cppClassName || '').toLowerCase() + "_t"; | |
| 174 | - fieldInfo.isV8Value = ~v8Values.indexOf(field.cppClassName); | ||
| 175 | 158 | ||
| 176 | 159 | fn.fieldInfos.push(fieldInfo); | |
| 177 | 160 | }); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -10,7 +10,7 @@ to = NanNew<String>({{= parsedName =}}); | |||
| 10 | 10 | {%if freeFunctionName %} | |
| 11 | 11 | {{ freeFunctionName }}({{= parsedName =}}); | |
| 12 | 12 | {%endif%} | |
| 13 | - {%elsif isV8Value %} | ||
| 13 | + {%elsif cppClassName|isV8Value %} | ||
| 14 | 14 | {%if isCppClassIntType %} | |
| 15 | 15 | to = NanNew<{{ cppClassName }}>(({{ parsedClassName }}){{= parsedName =}}); | |
| 16 | 16 | {%else%} | |
@@ -30,7 +30,7 @@ to = tmpArray; | |||
| 30 | 30 | {%else%} | |
| 31 | 31 | {%if copy %} | |
| 32 | 32 | if ({{= parsedName =}} != NULL) { | |
| 33 | - {{= parsedName =}} = ({{ cType|replace '**' '*' }} {%if not isPointer %}*{%endif%}){{ copy }}({{= parsedName =}}); | ||
| 33 | + {{= parsedName =}} = ({{ cType|replace '**' '*' }} {%if not cType|isPointer %}*{%endif%}){{ copy }}({{= parsedName =}}); | ||
| 34 | 34 | } | |
| 35 | 35 | {%endif%} | |
| 36 | 36 | if ({{= parsedName =}} != NULL) { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -5,8 +5,8 @@ NAN_METHOD({{ cppClassName }}::{{ field.cppFunctionName }}) { | |||
| 5 | 5 | NanScope(); | |
| 6 | 6 | Handle<Value> to; | |
| 7 | 7 | ||
| 8 | - {{ field.cType }} {%if field.isV8Value %}*{%endif%}{{ field.name }} = | ||
| 9 | - {%if not field.isV8Value %}&{%endif%}ObjectWrap::Unwrap<{{ cppClassName }}>(args.This())->GetValue()->{{ field.name }}; | ||
| 8 | + {{ field.cType }} {%if field.cppClassName|isV8Value %}*{%endif%}{{ field.name }} = | ||
| 9 | + {%if not field.cppClassName|isV8Value %}&{%endif%}ObjectWrap::Unwrap<{{ cppClassName }}>(args.This())->GetValue()->{{ field.name }}; | ||
| 10 | 10 | ||
| 11 | 11 | {%partial convertToV8 field %} | |
| 12 | 12 | NanReturnValue(to); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments