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


C++ PropertyCallbackInfo::Holder方法代码示例

本文整理汇总了C++中PropertyCallbackInfo::Holder方法的典型用法代码示例。如果您正苦于以下问题:C++ PropertyCallbackInfo::Holder方法的具体用法?C++ PropertyCallbackInfo::Holder怎么用?C++ PropertyCallbackInfo::Holder使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PropertyCallbackInfo的用法示例。


在下文中一共展示了PropertyCallbackInfo::Holder方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: getProp

void Shape::getProp(Local<String> property,
                    const PropertyCallbackInfo<Value>& info)
{
    HandleScope scope;
    Shape* s = ObjectWrap::Unwrap<Shape>(info.Holder());
    std::string name = TOSTR(property);
    Handle<Value> value = Undefined();

    if (name == "numvalues")
      value = Integer::New(s->get()->numvalues);
    else if (name == "numlines")
      value = Integer::New(s->get()->numlines);
    else if (name == "index")
      value = Number::New(s->get()->index);
    else if (name == "type")
      value = Integer::New(s->get()->type);
    else if (name == "tileindex")
      value = Integer::New(s->get()->tileindex);
    else if (name == "classindex")
      value = Integer::New(s->get()->classindex);
    else if (name == "text")
      value = String::New(s->get()->text);

    info.GetReturnValue().Set(value);
}
开发者ID:BentleySystems,项目名称:mapserver,代码行数:25,代码来源:shape.cpp

示例2: FieldAccessorGetterCallback

void MetadataNode::FieldAccessorGetterCallback(Local<String> property, const PropertyCallbackInfo<Value>& info)
{
	try
	{
		auto thiz = info.This();
		auto fieldCallbackData = reinterpret_cast<FieldCallbackData*>(info.Data().As<External>()->Value());

		if (!fieldCallbackData->isStatic && thiz->StrictEquals(info.Holder()))
		{
			info.GetReturnValue().SetUndefined();
			return;
		}

		auto value = NativeScriptRuntime::GetJavaField(thiz, fieldCallbackData);
		info.GetReturnValue().Set(value);
	}
	catch (NativeScriptException& e)
	{
		e.ReThrowToV8();
	}
	catch (std::exception e) {
		stringstream ss;
		ss << "Error: c++ exception: " << e.what() << endl;
		NativeScriptException nsEx(ss.str());
		nsEx.ReThrowToV8();
	}
	catch (...) {
		NativeScriptException nsEx(std::string("Error: c++ exception!"));
		nsEx.ReThrowToV8();
	}
}
开发者ID:atifzaidi,项目名称:android-runtime,代码行数:31,代码来源:MetadataNode.cpp

示例3: attributeSetValue

void Shape::attributeSetValue(Local<String> name,
                              Local<Value> value,
                              const PropertyCallbackInfo<Value> &info)
{
  Local<Object> self = info.Holder();
  Local<External> wrap = Local<External>::Cast(self->GetInternalField(0));
  void *ptr = wrap->Value();
  map<string, int> *indexes = static_cast<map<string, int> *>(ptr);
  wrap = Local<External>::Cast(self->GetInternalField(1));
  ptr = wrap->Value();
  char **values = static_cast<char **>(ptr);

  String::Utf8Value utf8_name(name), utf8_value(value);
  string key = string(*utf8_name);

  map<string, int>::iterator iter = indexes->find(key);

  if (iter == indexes->end()) {
    ThrowException(String::New("Invalid value name."));
  }
  else
  {
    const int &index = (*iter).second;
    msFree(values[index]);
    values[index] = msStrdup(*utf8_value);
  }
}
开发者ID:BentleySystems,项目名称:mapserver,代码行数:27,代码来源:shape.cpp

示例4: GetHost

void JsHttpRequestProcessor::GetHost(Local<String> name,
                                     const PropertyCallbackInfo<Value>& info) {
  HttpRequest* request = UnwrapRequest(info.Holder());
  const string& path = request->Host();
  info.GetReturnValue().Set(
      String::NewFromUtf8(info.GetIsolate(), path.c_str(),
                          NewStringType::kNormal,
                          static_cast<int>(path.length())).ToLocalChecked());
}
开发者ID:ACEZLY,项目名称:server,代码行数:9,代码来源:V8_Process.cpp

示例5: SetPointY

void SetPointY(Local<String> property, 
			   Local<Value> value,
			   const PropertyCallbackInfo<Value>& info)
{
	Local<Object> self = info.Holder();
	Local<External> wrap = Local<External>::Cast(self->GetInternalField(0));
	void* ptr = wrap->Value();
	static_cast<Point*>(ptr)->y_ = value->Int32Value();
}
开发者ID:chinnurtb,项目名称:GoogleV8Tutorials,代码行数:9,代码来源:main.cpp

示例6: GetPointY

void GetPointY(Local<String> property,
						const PropertyCallbackInfo<Value>& info)
{
	Local<Object> self = info.Holder();
	Local<External> wrap = Local<External>::Cast(self->GetInternalField(0));
	void* ptr = wrap->Value();
	int value = static_cast<Point*>(ptr)->y_;
	info.GetReturnValue().Set(Number::New(value));
}
开发者ID:chinnurtb,项目名称:GoogleV8Tutorials,代码行数:9,代码来源:main.cpp

示例7: jsMyClassSetNumber

void jsMyClassSetNumber(
	Local<String> property,
	Local<Value> value,
	const PropertyCallbackInfo<void>& info)
{
	Local<Object> self = info.Holder();
	ObjectWrap* pMyClass = ObjectWrap::Unwrap<ObjectWrap>(self);
	static_cast<MyClass*>(pMyClass)->setNumber(value->Int32Value());
}
开发者ID:ACEZLY,项目名称:server,代码行数:9,代码来源:MyClass_Wrap.cpp

示例8: jsMyClassGetNumber

void jsMyClassGetNumber(
	Local<String> property,
	const PropertyCallbackInfo<Value>& info)
{
	Local<Object> self = info.Holder();
	ObjectWrap* pMyClass = ObjectWrap::Unwrap<ObjectWrap>(self);
	int value = static_cast<MyClass*>(pMyClass)->getNumber();
	info.GetReturnValue().Set(value);
}
开发者ID:ACEZLY,项目名称:server,代码行数:9,代码来源:MyClass_Wrap.cpp

示例9: jsMyClassGetName

void jsMyClassGetName(
	Local<String> property,
	const PropertyCallbackInfo<Value>& info)
{
	Local<Object> self = info.Holder();
	ObjectWrap* pMyClass = ObjectWrap::Unwrap<ObjectWrap>(self);
	const char* name = static_cast<MyClass*>(pMyClass)->getName();
	Local<String> v8Str = String::NewFromUtf8(info.GetIsolate(), name);
	info.GetReturnValue().Set(v8Str);
}
开发者ID:ACEZLY,项目名称:server,代码行数:10,代码来源:MyClass_Wrap.cpp

示例10: jsMyClassSetName

void jsMyClassSetName(
	Local<String> property,
	Local<Value> value,
	const PropertyCallbackInfo<void>& info)
{
	Local<Object> self = info.Holder();
	ObjectWrap* pMyClass = ObjectWrap::Unwrap<ObjectWrap>(self);
	String::Utf8Value str(value);
	static_cast<MyClass*>(pMyClass)->setName(ToCString(str));
}
开发者ID:ACEZLY,项目名称:server,代码行数:10,代码来源:MyClass_Wrap.cpp

示例11: SetX

void Point::SetX( Local< String > prop, Local< Value > value, const PropertyCallbackInfo< void > &info ) {
	// Enter new scope
	HandleScope scope;

	// Get wrapped object
	Local< Object > self = info.Holder();
	Local< External > wrap = Local< External >::Cast( self->GetInternalField( 0 ) );

	// Set internal value
	static_cast< Point* >( wrap->Value() )->SetX( value->NumberValue() );
}
开发者ID:TheCodeInside,项目名称:v8-example,代码行数:11,代码来源:point.cpp

示例12: GetX

void Point::GetX( Local< String > prop, const PropertyCallbackInfo< Value > &info ) {
	// Enter new scope
	HandleScope scope;

	// Get wrapped object
	Local< Object > self = info.Holder();
	Local< External > wrap = Local< External >::Cast( self->GetInternalField( 0 ) );

	// Set return value
	Point* point = static_cast< Point* >( wrap->Value() );
	info.GetReturnValue().Set( Number::New( point->GetX() ) );
}
开发者ID:TheCodeInside,项目名称:v8-example,代码行数:12,代码来源:point.cpp

示例13: GetPath

void JsHttpRequestProcessor::GetPath(Local<String> name,
                                     const PropertyCallbackInfo<Value>& info) {
  // Extract the C++ request object from the JavaScript wrapper.
  HttpRequest* request = UnwrapRequest(info.Holder());

  // Fetch the path.
  const string& path = request->Path();

  // Wrap the result in a JavaScript string and return it.
  info.GetReturnValue().Set(
      String::NewFromUtf8(info.GetIsolate(), path.c_str(),
                          NewStringType::kNormal,
                          static_cast<int>(path.length())).ToLocalChecked());
}
开发者ID:ACEZLY,项目名称:server,代码行数:14,代码来源:V8_Process.cpp

示例14: setProp

void Shape::setProp(Local<String> property,
                    Local<Value> value,
                    const PropertyCallbackInfo<void>& info)
{
    HandleScope scope;
    Shape* s = ObjectWrap::Unwrap<Shape>(info.Holder());
    std::string name = TOSTR(property);

    if (name == "text") {
      if (s->get()->text)
        msFree(s->get()->text);
      s->get()->text = getStringValue(value);
    }
}
开发者ID:BentleySystems,项目名称:mapserver,代码行数:14,代码来源:shape.cpp

示例15: MapSet

void JsHttpRequestProcessor::MapSet(Local<Name> name, Local<Value> value_obj,
                                    const PropertyCallbackInfo<Value>& info) {
  if (name->IsSymbol()) return;

  // Fetch the map wrapped by this object.
  map<string, string>* obj = UnwrapMap(info.Holder());

  // Convert the key and value to std::strings.
  string key = ObjectToString(Local<String>::Cast(name));
  string value = ObjectToString(value_obj);

  // Update the map.
  (*obj)[key] = value;

  // Return the value; any non-empty handle will work.
  info.GetReturnValue().Set(value_obj);
}
开发者ID:ACEZLY,项目名称:server,代码行数:17,代码来源:V8_Process.cpp


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