addon-tools-raub
Advanced tools
Comparing version 0.1.2 to 0.1.3
@@ -5,3 +5,3 @@ { | ||
"description": "A set of extra tools for Node.js addons", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"main": "index.js", | ||
@@ -8,0 +8,0 @@ "keywords": [ |
124
README.md
@@ -164,3 +164,3 @@ # Addon Tools | ||
``` | ||
module.exports = require('./binary/addon'); | ||
module.exports = require('./binary/MY_ADDON'); | ||
``` | ||
@@ -308,3 +308,3 @@ | ||
introduces several useful macros and utilities. Also it includes Nan automatically, | ||
so that you can replace. | ||
so that you can replace: | ||
@@ -328,3 +328,4 @@ ``` | ||
``` | ||
require('addon-tools-raub').include | ||
require('addon-tools-raub').include() // implicit console.log() | ||
require('addon-tools-raub').includePath // just a string | ||
``` | ||
@@ -340,3 +341,3 @@ | ||
[Nan doc](https://github.com/nodejs/nan/blob/master/doc/methods.md#api_nan_method). | ||
So it is most likely to be used in native callbacks. | ||
So it is most likely to be used in parts of code called from C++ land. | ||
@@ -354,4 +355,4 @@ ``` | ||
* RET_VALUE(VAL) - set method return value | ||
* RET_UNDEFINED - set method return value as undefined | ||
* `RET_VALUE(VAL)` - set method return value | ||
* `RET_UNDEFINED` - set method return value as undefined | ||
@@ -361,7 +362,15 @@ | ||
* JS_STR(...) - create a string value | ||
* JS_INT(val) - create an integer value | ||
* JS_NUM(val) - create a numeric value | ||
* JS_EXT(val) - create an external (pointer) value | ||
* JS_BOOL(val) - create a boolean value | ||
* `JS_STR(...)` - create a string value | ||
* `JS_UTF8(...)` - same as JS_STR | ||
* `JS_INT(val)` - create an integer value | ||
* `JS_INT32(val)` - same as `JS_INT` | ||
* `JS_UINT32(val)` - same as `JS_INT` | ||
* `JS_NUM(val)` - create a numeric value | ||
* `JS_OFFS(val)` - same as `JS_NUM`, but has a cast designed to avoid `size_t -> double` warning | ||
* `JS_FLOAT(val)` - same as `JS_NUM` | ||
* `JS_DOUBLE(val)` - same as `JS_NUM` | ||
* `JS_EXT(val)` - create an external (pointer) value | ||
* `JS_BOOL(val)` - create a boolean value | ||
* `JS_FUN(val)` - get a function from persistent. | ||
* `JS_OBJ(val)` - get an object from persistent. | ||
@@ -377,8 +386,9 @@ | ||
* REQ_ARGS(N) - check if at least `N` arguments passed | ||
* IS_ARG_EMPTY(I) - check if argument `I` is `undefined` or `null` | ||
* CHECK_REQ_ARG(I, C, T) - check if argument `I` is approved by `C` check. | ||
* CHECK_LET_ARG(I, C, T) - check if argument `I` is approved by `C` check or empty. | ||
* CTOR_CHECK(T) - check if method is called as a constructor | ||
* SETTER_CHECK(C, T) - check if setter `value` is approved by `C` check. | ||
* `REQ_ARGS(N)` - check if at least `N` arguments passed | ||
* `IS_ARG_EMPTY(I)` - check if argument `I` is `undefined` or `null` | ||
* `CHECK_REQ_ARG(I, C, T)` - check if argument `I` is approved by `C` check. | ||
* `CHECK_LET_ARG(I, C, T) - check if argument `I` is approved by `C` check or empty. | ||
* `CTOR_CHECK(T)` - check if method is called as a constructor | ||
* `SETTER_CHECK(C, T)` - check if setter `value` is approved by `C` check. | ||
* `DES_CHECK` - within dynamic method check if the instance wasn't destroyed by `_destroy()`. | ||
@@ -393,24 +403,28 @@ | ||
* REQ_UTF8_ARG(I, VAR) | ||
* LET_UTF8_ARG(I, VAR) | ||
* REQ_INT32_ARG(I, VAR) | ||
* LET_INT32_ARG(I, VAR) | ||
* REQ_BOOL_ARG(I, VAR) | ||
* LET_BOOL_ARG(I, VAR) | ||
* REQ_UINT32_ARG(I, VAR) | ||
* LET_UINT32_ARG(I, VAR) | ||
* REQ_OFFS_ARG(I, VAR) | ||
* LET_OFFS_ARG(I, VAR) | ||
* REQ_DOUBLE_ARG(I, VAR) | ||
* LET_DOUBLE_ARG(I, VAR) | ||
* REQ_FLOAT_ARG(I, VAR) | ||
* LET_FLOAT_ARG(I, VAR) | ||
* REQ_EXT_ARG(I, VAR) | ||
* LET_EXT_ARG(I, VAR) | ||
* REQ_FUN_ARG(I, VAR) | ||
* REQ_OBJ_ARG(I, VAR) | ||
* REQ_ARRV_ARG(I, VAR) | ||
* `REQ_UTF8_ARG(I, VAR)` - require `I`'th argument to be a `string`. Stored at `Nan::Utf8String VAR`. | ||
* `LET_UTF8_ARG(I, VAR)` - let optional `I`'th argument to be a `string`, the default is `""`. Stored at `Nan::Utf8String VAR`. | ||
* `REQ_STR_ARG(I, VAR)` - require `I`'th argument to be a `string`. Stored at `Nan::Utf8String VAR`. | ||
* `LET_STR_ARG(I, VAR)` - let optional `I`'th argument to be a `string`, the default is `""`. Stored at `Nan::Utf8String VAR`. | ||
* `REQ_INT32_ARG(I, VAR)` - require `I`'th argument to be a `number`. Stored at `int VAR`. | ||
* `LET_INT32_ARG(I, VAR)` - let optional `I`'th argument to be a `number`, the default is `0`. Stored at `int VAR`. | ||
* `REQ_INT32_ARG(I, VAR)` - require `I`'th argument to be a `number`. Stored at `int VAR`. | ||
* `LET_INT32_ARG(I, VAR)` - let optional `I`'th argument to be a `number`, the default is `0`. Stored at `int VAR`. | ||
* `REQ_UINT32_ARG(I, VAR)` - require `I`'th argument to be a `number`. Stored at `unsigned VAR`. | ||
* `LET_UINT32_ARG(I, VAR)` - let optional `I`'th argument to be a `number`, the default is `0`. Stored at `unsigned VAR`. | ||
* `REQ_BOOL_ARG(I, VAR)` - require `I`'th argument to be a `boolean`. Stored at `bool VAR`. | ||
* `LET_BOOL_ARG(I, VAR)` - let optional `I`'th argument to be a `boolean`, the default is `false`. Stored at `Nan::Utf8String VAR`. | ||
* `REQ_OFFS_ARG(I, VAR)` - require `I`'th argument to be a `number`. Stored at `size_t VAR`. | ||
* `LET_OFFS_ARG(I, VAR)` - let optional `I`'th argument to be a `number`, the default is `0`. Stored at `Nan::Utf8String VAR`. | ||
* `REQ_DOUBLE_ARG(I, VAR)` - require `I`'th argument to be a `number`. Stored at `double VAR`. | ||
* `LET_DOUBLE_ARG(I, VAR)` - let optional `I`'th argument to be a `number`, the default is `0.0`. Stored at `Nan::Utf8String VAR`. | ||
* `REQ_FLOAT_ARG(I, VAR)` - require `I`'th argument to be a `number`. Stored at `float VAR`. | ||
* `LET_FLOAT_ARG(I, VAR)` - let optional `I`'th argument to be a `number`, the default is `0.0f`. Stored at `Nan::Utf8String VAR`. | ||
* `REQ_EXT_ARG(I, VAR)` - require `I`'th argument to be an `external`. Stored at `Local<External> VAR`. | ||
* `LET_EXT_ARG(I, VAR)` - let optional `I`'th argument to be an `external`, the default is `nullptr`. Stored at `Nan::Utf8String VAR`. | ||
* `REQ_FUN_ARG(I, VAR)` - require `I`'th argument to be a `function`. Stored at `Local<Function> VAR`. | ||
* `REQ_OBJ_ARG(I, VAR)` - require `I`'th argument to be an `object`. Stored at `Local<Object> VAR`. | ||
* `REQ_ARRV_ARG(I, VAR)` - require `I`'th argument to be a `TypedArray`. Stored at `Local<ArrayBufferView> VAR`. | ||
``` | ||
NAN_METHOD(testScene) { | ||
NAN_METHOD(test) { | ||
@@ -424,3 +438,5 @@ REQ_UINT32_ARG(0, width); | ||
NOTE: The conversion from `Nan::Utf8String` to `std::string` (via `char *`) is possible with unary `*` operator. | ||
#### Set properties | ||
@@ -431,4 +447,4 @@ | ||
* SET_PROP(OBJ, KEY, VAL) | ||
* SET_I(ARR, I, VAL) | ||
* `SET_PROP(OBJ, KEY, VAL)` | ||
* `SET_I(ARR, I, VAL)` | ||
@@ -441,4 +457,4 @@ | ||
* ACCESSOR_RW(OBJ, NAME) - add read and write accessors of NAME for OBJ. | ||
* ACCESSOR_R(OBJ, NAME) - read-only property. | ||
* `ACCESSOR_RW(OBJ, NAME)` - add read and write accessors of NAME for OBJ. | ||
* `ACCESSOR_R(OBJ, NAME)` - read-only property. | ||
@@ -459,14 +475,18 @@ ``` | ||
Useful addition to NAN_SETTER macro. | ||
Useful addition to NAN_SETTER macro. Works similar to method arguments. But there | ||
is always only one required argument stored in `v`. | ||
* SETTER_UTF8_ARG | ||
* SETTER_INT32_ARG | ||
* SETTER_BOOL_ARG | ||
* SETTER_UINT32_ARG | ||
* SETTER_OFFS_ARG | ||
* SETTER_DOUBLE_ARG | ||
* SETTER_FLOAT_ARG | ||
* SETTER_EXT_ARG | ||
* SETTER_FUN_ARG | ||
* SETTER_OBJ_ARG | ||
* `SETTER_UTF8_ARG` - require the value to be a `string`. Stored at `Nan::Utf8String v`. | ||
* `SETTER_STR_ARG` - require the value to be a `string`. Stored at `Nan::Utf8String v`. | ||
* `SETTER_INT32_ARG` - require the value to be a `number`. Stored at `int v`. | ||
* `SETTER_INT_ARG` - require the value to be a `number`. Stored at `int v`. | ||
* `SETTER_UINT32_ARG` - require the value to be a `number`. Stored at `unsigned v`. | ||
* `SETTER_BOOL_ARG` - require the value to be a `boolean`. Stored at `bool v`. | ||
* `SETTER_OFFS_ARG` - require the value to be a `number`. Stored at `size_t v`. | ||
* `SETTER_DOUBLE_ARG` - require the value to be a `number`. Stored at `double v`. | ||
* `SETTER_FLOAT_ARG` - require the value to be a `number`. Stored at `float v`. | ||
* `SETTER_EXT_ARG` - require the value to be an `external`. Stored at `Local<External> v`. | ||
* `SETTER_FUN_ARG` - require the value to be a `function`. Stored at `Local<Function> v`. | ||
* `SETTER_OBJ_ARG` - require the value to be an `object`. Stored at `Local<Object> v`. | ||
* `SETTER_ARRV_ARG` - require the value to be a `TypedArray`. Stored at `Local<ArrayBufferView> v`. | ||
@@ -473,0 +493,0 @@ ``` |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
59100
662