mirror of
https://github.com/peterbraden/node-opencv.git
synced 2025-12-08 19:45:55 +00:00
- fixed immutability of Point class with Nan
This commit is contained in:
parent
cac848fa87
commit
a5a4b59ff3
11
src/Point.cc
11
src/Point.cc
@ -24,8 +24,8 @@ Point::Init(Handle<Object> target) {
|
|||||||
ctor->SetClassName(NanNew("Point"));
|
ctor->SetClassName(NanNew("Point"));
|
||||||
|
|
||||||
Local<ObjectTemplate> proto = ctor->PrototypeTemplate();
|
Local<ObjectTemplate> proto = ctor->PrototypeTemplate();
|
||||||
proto->SetAccessor(NanNew("x"), GetX);//, RaiseImmutable);
|
proto->SetAccessor(NanNew("x"), GetX, RaiseImmutable);//, RaiseImmutable);
|
||||||
proto->SetAccessor(NanNew("y"), GetY);//, RaiseImmutable);
|
proto->SetAccessor(NanNew("y"), GetY, RaiseImmutable);//, RaiseImmutable);
|
||||||
|
|
||||||
|
|
||||||
NODE_SET_PROTOTYPE_METHOD(ctor, "dot", Dot);
|
NODE_SET_PROTOTYPE_METHOD(ctor, "dot", Dot);
|
||||||
@ -59,11 +59,10 @@ NAN_GETTER(Point::GetY){//(Local<String> prop, const AccessorInfo &info) {
|
|||||||
NanReturnValue(NanNew<Number>(pt->point.y));
|
NanReturnValue(NanNew<Number>(pt->point.y));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*FIXME: add this back, possibly in a setter
|
|
||||||
void
|
NAN_SETTER(Point::RaiseImmutable){
|
||||||
Point::RaiseImmutable(Local<String> property, Local<Value> value, const AccessorInfo& info) {
|
|
||||||
NanThrowTypeError("Point is immutable");
|
NanThrowTypeError("Point is immutable");
|
||||||
} */
|
}
|
||||||
|
|
||||||
NAN_METHOD(Point::Dot){
|
NAN_METHOD(Point::Dot){
|
||||||
NanScope();
|
NanScope();
|
||||||
|
|||||||
@ -7,18 +7,13 @@ class Point: public node::ObjectWrap {
|
|||||||
CvPoint2D32f point;
|
CvPoint2D32f point;
|
||||||
static Persistent<FunctionTemplate> constructor;
|
static Persistent<FunctionTemplate> constructor;
|
||||||
static void Init(Handle<Object> target);
|
static void Init(Handle<Object> target);
|
||||||
//static Handle<Value> New(const Arguments &args);
|
|
||||||
static NAN_METHOD(New);
|
static NAN_METHOD(New);
|
||||||
Point(double x, double y);
|
Point(double x, double y);
|
||||||
|
|
||||||
//static Handle<Value> GetX(Local<String> prop, const AccessorInfo &info);
|
|
||||||
static NAN_GETTER(GetX);
|
static NAN_GETTER(GetX);
|
||||||
//static Handle<Value> GetY(Local<String> prop, const AccessorInfo &info);
|
|
||||||
static NAN_GETTER(GetY);
|
static NAN_GETTER(GetY);
|
||||||
|
static NAN_SETTER(RaiseImmutable);
|
||||||
|
|
||||||
//static void RaiseImmutable(Local<String> property, Local<Value> value, const AccessorInfo& info);
|
|
||||||
static NAN_METHOD(RaiseImmutable);
|
|
||||||
//static Handle<Value> Dot(const v8::Arguments&);
|
|
||||||
static NAN_METHOD(Dot);
|
static NAN_METHOD(Dot);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user