diff options
author | Anand Thakker <anandthakker@users.noreply.github.com> | 2017-11-08 12:34:02 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-08 12:34:02 -0500 |
commit | f648cfeef6544755fdb10c3cf8847e878d70e0ff (patch) | |
tree | 49800ebd34969b787681691f1219c6396ed58579 /platform/node/src/node_expression.hpp | |
parent | 9aac976104f4c6453cf9e79e03a002565720f213 (diff) | |
download | qtlocation-mapboxgl-f648cfeef6544755fdb10c3cf8847e878d70e0ff.tar.gz |
Implement Expressions (#9439)
Ports https://github.com/mapbox/mapbox-gl-js/pull/4777 (and its several follow-ups)
Diffstat (limited to 'platform/node/src/node_expression.hpp')
-rw-r--r-- | platform/node/src/node_expression.hpp | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/platform/node/src/node_expression.hpp b/platform/node/src/node_expression.hpp new file mode 100644 index 0000000000..7af5b7ab51 --- /dev/null +++ b/platform/node/src/node_expression.hpp @@ -0,0 +1,40 @@ +#pragma once + +#include <mbgl/style/conversion.hpp> +#include <mbgl/style/expression/expression.hpp> +#include <exception> +#include <memory> + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#pragma GCC diagnostic ignored "-Wshadow" +#include <nan.h> +#pragma GCC diagnostic pop + +using namespace mbgl::style::expression; + +namespace node_mbgl { + +v8::Local<v8::Value> toJS(const Value&); + +class NodeExpression : public Nan::ObjectWrap { +public: + static void Init(v8::Local<v8::Object>); + +private: + NodeExpression(std::unique_ptr<Expression> expression_) : + expression(std::move(expression_)) + {}; + + static void New(const Nan::FunctionCallbackInfo<v8::Value>&); + static void Parse(const Nan::FunctionCallbackInfo<v8::Value>&); + static void Evaluate(const Nan::FunctionCallbackInfo<v8::Value>&); + static void GetType(const Nan::FunctionCallbackInfo<v8::Value>&); + static void IsFeatureConstant(const Nan::FunctionCallbackInfo<v8::Value>&); + static void IsZoomConstant(const Nan::FunctionCallbackInfo<v8::Value>&); + static Nan::Persistent<v8::Function> constructor; + + std::unique_ptr<Expression> expression; +}; + +} // namespace node_mbgl |