本文整理汇总了C++中AccessorInfo类的典型用法代码示例。如果您正苦于以下问题:C++ AccessorInfo类的具体用法?C++ AccessorInfo怎么用?C++ AccessorInfo使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了AccessorInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Set_FontState_size
static void Set_FontState_size(Local<String> property, Local<Value> value, const AccessorInfo& info)
{
HandleScope scope;
Local<Object> self = info.Holder();
Local<External> wrap = Local<External>::Cast(self->GetInternalField(0));
if (wrap.IsEmpty())
return;
FontState *tmp = (FontState *) wrap->Value();
if (tmp == NULL)
return;
if (!value.IsEmpty() && value->IsNumber())
tmp->setSize(value->Int32Value());
}
示例2: if
Handle<Value> Color::get_prop(Local<String> property,
const AccessorInfo& info)
{
HandleScope scope;
Color* c = ObjectWrap::Unwrap<Color>(info.This());
std::string a = TOSTR(property);
if (a == "a")
return scope.Close(Integer::New(c->get()->alpha()));
else if (a == "r")
return scope.Close(Integer::New(c->get()->red()));
else if (a == "g")
return scope.Close(Integer::New(c->get()->green()));
else if (a == "b")
return scope.Close(Integer::New(c->get()->blue()));
return Undefined();
}
示例3: typeSetter
void FieldDefn::typeSetter(Local<String> property, Local<Value> value, const AccessorInfo &info)
{
HandleScope scope;
FieldDefn *def = ObjectWrap::Unwrap<FieldDefn>(info.This());
if(!value->IsString()){
NODE_THROW("type must be a string");
return;
}
std::string name = TOSTR(value);
int type = getFieldTypeByName(name);
if(type < 0){
NODE_THROW("Unrecognized field type");
} else {
def->this_->SetType(OGRFieldType(type));
}
}
示例4: SetMediaBox
void PDFPageDriver::SetMediaBox(Local<String> property,Local<Value> value,const AccessorInfo &info)
{
HandleScope scope;
PDFPageDriver* pageDriver = ObjectWrap::Unwrap<PDFPageDriver>(info.Holder());
if(!value->IsArray())
ThrowException(Exception::TypeError(String::New("Media box is set to a value which is not a 4 numbers array")));
if(value->ToObject()->Get(v8::String::New("length"))->ToObject()->Uint32Value() != 4)
ThrowException(Exception::TypeError(String::New("Media box is set to a value which is not a 4 numbers array")));
pageDriver->mPDFPage->SetMediaBox(PDFRectangle(value->ToObject()->Get(0)->ToNumber()->Value(),
value->ToObject()->Get(1)->ToNumber()->Value(),
value->ToObject()->Get(2)->ToNumber()->Value(),
value->ToObject()->Get(3)->ToNumber()->Value()));
}
示例5: SetAction
/*
DESCRIPTION
Set Accessor of action property
*/
void Connection::SetAction(Local<String> property,Local<Value> value,
const AccessorInfo& info)
{
HandleScope scope;
Connection *njsConn = ObjectWrap::Unwrap<Connection>(info.Holder());
if(!njsConn->isValid_)
{
string msg = NJSMessages::getErrorMsg(errInvalidConnection);
NJS_SET_EXCEPTION(msg.c_str(), (int) msg.length());
return;
}
else
{
std::string action;
NJS_SET_PROP_STR( action, value, "action");
njsConn->dpiconn_->action(action);
}
}
示例6: Set_FontState_face
static void Set_FontState_face(Local<String> property, Local<Value> value, const AccessorInfo& info)
{
HandleScope scope;
Local<Object> self = info.Holder();
Local<External> wrap = Local<External>::Cast(self->GetInternalField(0));
if (wrap.IsEmpty())
return;
FontState *tmp = (FontState *) wrap->Value();
if (tmp == NULL)
return;
if (!value.IsEmpty() && value->IsString())
{
String::Utf8Value utf8_value(value);
tmp->setFace(Utf8ToTchar(*utf8_value));
}
}
示例7: Undefined
Handle<Value> MSOutputFormat::PropertyGetter (Local<String> property, const AccessorInfo& info) {
MSOutputFormat *of = ObjectWrap::Unwrap<MSOutputFormat>(info.This());
v8::String::AsciiValue n(property);
if (strcmp(*n, "name") == 0) {
RETURN_STRING(of->this_->name);
} else if (strcmp(*n, "mimetype") == 0) {
RETURN_STRING(of->this_->mimetype);
} else if (strcmp(*n, "driver") == 0) {
RETURN_STRING(of->this_->driver);
} else if (strcmp(*n, "renderer") == 0) {
RETURN_NUMBER(of->this_->renderer);
} else if (strcmp(*n, "imagemode") == 0) {
RETURN_NUMBER(of->this_->imagemode);
} else if (strcmp(*n, "transparent") == 0) {
RETURN_NUMBER(of->this_->transparent);
}
return Undefined();
}
示例8: propName
// プロパティの取得
Handle<Value>
TJSObject::getter(Local<String> property, const AccessorInfo& info)
{
String::Value propName(property);
if (wcscmp(*propName, TJSINSTANCENAME) == 0) {
return Handle<Value>();
}
tTJSVariant self;
if (getVariant(self, info.This())) {
tjs_error error;
tTJSVariant result;
if (TJS_SUCCEEDED(error = self.AsObjectClosureNoAddRef().PropGet(0, *propName, NULL, &result, NULL))) {
return toJSValue(result);
} else {
return ERROR_KRKR(error);
}
}
return ERROR_BADINSTANCE();
}
示例9: Undefined
Handle<Value> ZipFile::get_prop(Local<String> property,
const AccessorInfo& info) {
HandleScope scope;
ZipFile* zf = ObjectWrap::Unwrap<ZipFile>(info.This());
std::string a = TOSTR(property);
if (a == "count") {
return scope.Close(Integer::New(zf->names_.size()));
}
if (a == "names") {
unsigned num = zf->names_.size();
Local<Array> a = Array::New(num);
for (unsigned i = 0; i < num; ++i) {
a->Set(i, String::New(zf->names_[i].c_str()));
}
return scope.Close(a);
}
return Undefined();
}
示例10: set_prop
void Image::set_prop(Local<String> property,
Local<Value> value,
const AccessorInfo& info)
{
HandleScope scope;
Image* im = node::ObjectWrap::Unwrap<Image>(info.Holder());
std::string a = TOSTR(property);
if (a == "background") {
if (!value->IsObject())
ThrowException(Exception::TypeError(
String::New("mapnik.Color expected")));
Local<Object> obj = value->ToObject();
if (obj->IsNull() || obj->IsUndefined() || !Color::constructor->HasInstance(obj))
ThrowException(Exception::TypeError(String::New("mapnik.Color expected")));
Color *c = node::ObjectWrap::Unwrap<Color>(obj);
im->get()->set_background(*c->get());
}
}
示例11: set_prop
void Color::set_prop(Local<String> property,
Local<Value> value,
const AccessorInfo& info)
{
HandleScope scope;
Color* c = ObjectWrap::Unwrap<Color>(info.This());
std::string a = TOSTR(property);
if (!value->IsNumber())
ThrowException(Exception::TypeError(
String::New("color channel value must be an integer")));
if (a == "a") {
c->get()->set_alpha(value->IntegerValue());
} else if (a == "r") {
c->get()->set_red(value->IntegerValue());
} else if (a == "g") {
c->get()->set_green(value->IntegerValue());
} else if (a == "b") {
c->get()->set_blue(value->IntegerValue());
}
}
示例12: switch
Handle<Value> Window::GetState(Local<String> property, const AccessorInfo &info) {
HandleScope scope;
NativeWindow *window = ObjectWrap::Unwrap<NativeWindow>(info.Holder());
Handle<Value> state = String::New("normal");
switch (window->GetState()) {
case NW_STATE_NORMAL:
state = String::New("normal");
break;
case NW_STATE_MINIMIZED:
state = String::New("minimized");
break;
case NW_STATE_MAXIMIZED:
state = String::New("maximized");
break;
case NW_STATE_FULLSCREEN:
state = String::New("fullscreen");
}
return scope.Close(state);
}
示例13: NavigatorGet
static Handle<Value> NavigatorGet(Local<String> name, const AccessorInfo &info)
{
HandleScope scope;
Local<Object> self = info.This();
Local<External> wrap = Local<External>::Cast(self->GetInternalField(0));
v8_wrapper::tree_node* ptr = static_cast<v8_wrapper::tree_node*>(wrap->Value());
jsNavigator* el = dynamic_cast<jsNavigator*>(ptr);
// Convert the JavaScript string to a std::string.
std::string key = value_to_string(name);
// Look up the value if it exists using the standard STL idiom.
std::map< std::string, Persistent<Value> >::iterator iter = el->props.find(key);
// If the key is not present return an empty handle as signal.
if (iter == el->props.end()) return Handle<Value>();
// Otherwise fetch the value and wrap it in a JavaScript string.
Local<Value> val = Local<Value>::New(iter->second);
return scope.Close(val);
}
示例14: BrowserSet
static Handle<Value> BrowserSet(Local<String> name, Local<Value> value, const AccessorInfo& info)
{
Handle<Value> val;
std::string key = value_to_string(name);
LOG4CXX_TRACE(webEngine::iLogger::GetLogger(), _T("jsBrowserSet: property(")<< key <<_T(")"));
Local<External> wrap = Local<External>::Cast(info.Data());
void* ptr = wrap->Value();
if (ptr != NULL) {
jsBrowser* el = static_cast<jsBrowser*>(ptr);
if (key == "v8_results") {
string sval = value_to_string(value);
el->append_results(sval);
} else if (el->window->is_property(key)) {
val = el->window->GetProperty(name, info);
} else {
el->props[key] = Persistent<Value>::New(value);
}
}
return val;
}
示例15: PolicyVerticalSetter
void ScrollView::PolicyVerticalSetter(Local<String> name, Local<Value> value, const AccessorInfo& info)
{
HandleScope scope;
MxScrollPolicy policy;
if (value->IsBoolean()) {
ClutterActor *instance = ObjectWrap::Unwrap<ScrollView>(info.This())->_actor;
policy = mx_scroll_view_get_scroll_policy(MX_SCROLL_VIEW(instance));
if (value->ToBoolean()->Value()) {
if (policy == MX_SCROLL_POLICY_HORIZONTAL)
mx_scroll_view_set_scroll_policy(MX_SCROLL_VIEW(instance), MX_SCROLL_POLICY_BOTH);
else if (policy == MX_SCROLL_POLICY_NONE)
mx_scroll_view_set_scroll_policy(MX_SCROLL_VIEW(instance), MX_SCROLL_POLICY_VERTICAL);
} else {
if (policy == MX_SCROLL_POLICY_VERTICAL)
mx_scroll_view_set_scroll_policy(MX_SCROLL_VIEW(instance), MX_SCROLL_POLICY_NONE);
else if (policy == MX_SCROLL_POLICY_BOTH)
mx_scroll_view_set_scroll_policy(MX_SCROLL_VIEW(instance), MX_SCROLL_POLICY_HORIZONTAL);
}
}
}