当前位置: 首页>>代码示例>>C++>>正文


C++ AccessorInfo类代码示例

本文整理汇总了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());
}
开发者ID:Robyer,项目名称:miranda-plugins,代码行数:16,代码来源:FontState_v8_wrapper.cpp

示例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();
}
开发者ID:beaugunderson,项目名称:node-mapnik,代码行数:16,代码来源:mapnik_color.cpp

示例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));
	}
	
}
开发者ID:jarped,项目名称:node-gdal,代码行数:17,代码来源:gdal_field_defn.cpp

示例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()));
    
}
开发者ID:abyr,项目名称:HummusJS,代码行数:18,代码来源:PDFPageDriver.cpp

示例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);
  }
}
开发者ID:Dahriel,项目名称:node-oracledb,代码行数:22,代码来源:njsConnection.cpp

示例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));
	}
}
开发者ID:Robyer,项目名称:miranda-plugins,代码行数:19,代码来源:FontState_v8_wrapper.cpp

示例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();
}
开发者ID:MarkHauenstein,项目名称:node-mapserver,代码行数:19,代码来源:ms_outputformat.cpp

示例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();
}
开发者ID:John-He-928,项目名称:krkrz,代码行数:20,代码来源:tjsobj.cpp

示例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();
}
开发者ID:anoopsinha,项目名称:maui-epub,代码行数:19,代码来源:node_zipfile.cpp

示例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());
    }
}
开发者ID:calvinmetcalf,项目名称:node-mapnik,代码行数:19,代码来源:mapnik_image.cpp

示例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());
    }
}
开发者ID:beaugunderson,项目名称:node-mapnik,代码行数:20,代码来源:mapnik_color.cpp

示例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);
}
开发者ID:chorfa672m,项目名称:appjs,代码行数:21,代码来源:appjs_window.cpp

示例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);
}
开发者ID:abhishekbhalani,项目名称:webapptools,代码行数:21,代码来源:jsBrowser.cpp

示例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;
}
开发者ID:abhishekbhalani,项目名称:webapptools,代码行数:21,代码来源:jsBrowser.cpp

示例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);
        }
    }
}
开发者ID:cfsghost,项目名称:jsdx-toolkit,代码行数:22,代码来源:scrollview.cpp


注:本文中的AccessorInfo类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。