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


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

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


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

示例1: InnerClassAccessorGetterCallback

void MetadataNode::InnerClassAccessorGetterCallback(Local<String> property, const PropertyCallbackInfo<Value>& info)
{
	auto isolate = info.GetIsolate();
	auto thiz = info.This();
	auto node = reinterpret_cast<MetadataNode*>(info.Data().As<External>()->Value());

	auto innerKey = ConvertToV8String("inner:" + node->m_treeNode->name);

	auto innerTypeCtorFunc = thiz->GetHiddenValue(innerKey).As<Function>();
	if (innerTypeCtorFunc.IsEmpty())
	{
		auto funcTemplate = node->GetConstructorFunctionTemplate(isolate, node->m_treeNode);
		auto ctorFunc = funcTemplate->GetFunction();

		auto innerClassData = External::New(isolate, new InnerClassData(new Persistent<Object>(isolate, thiz), node));
		auto innerTypeCtorFuncTemplate = FunctionTemplate::New(isolate, InnerClassConstructorCallback, innerClassData);
		innerTypeCtorFuncTemplate->InstanceTemplate()->SetInternalFieldCount(static_cast<int>(ObjectManager::MetadataNodeKeys::END));
		innerTypeCtorFunc = innerTypeCtorFuncTemplate->GetFunction();
		auto prototypeName = ConvertToV8String("prototype");
		auto innerTypeCtorFuncPrototype = innerTypeCtorFunc->Get(prototypeName).As<Object>();
		innerTypeCtorFuncPrototype->SetPrototype(ctorFunc->Get(prototypeName));

		thiz->SetHiddenValue(innerKey, innerTypeCtorFunc);
	}

	info.GetReturnValue().Set(innerTypeCtorFunc);
}
开发者ID:bright-sparks,项目名称:android-runtime,代码行数:27,代码来源:MetadataNode.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: localFrame

void JNIV8ClassInfo::v8JavaAccessorGetterCallback(Local<Name> property, const PropertyCallbackInfo<Value> &info) {
    JNIEnv *env = JNIWrapper::getEnvironment();
    JNILocalFrame localFrame(env, 1);

    Isolate *isolate = info.GetIsolate();
    HandleScope scope(isolate);

    v8::Local<v8::External> ext;

    ext = info.Data().As<v8::External>();
    JNIV8ObjectJavaAccessorHolder* cb = static_cast<JNIV8ObjectJavaAccessorHolder*>(ext->Value());
    if (cb->javaGetterId) {
        jobject jobj = nullptr;

        if (!cb->isStatic) {
            ext = info.This()->GetInternalField(0).As<v8::External>();
            JNIV8Object *v8Object = reinterpret_cast<JNIV8Object *>(ext->Value());

            jobj = v8Object->getJObject();
        }

        v8::Local<v8::Value> value;

        value = JNIV8Marshalling::callJavaMethod(env, cb->propertyType, cb->javaClass, cb->javaGetterId, jobj, nullptr);

        // java method could have thrown an exception; if so forward it to v8
        if(env->ExceptionCheck()) {
            BGJSV8Engine::GetInstance(isolate)->forwardJNIExceptionToV8();
            return;
        }

        info.GetReturnValue().Set(value);
    }
}
开发者ID:godmodelabs,项目名称:ejecta-v8,代码行数:34,代码来源:JNIV8ClassInfo.cpp

示例4: FieldAccessorGetterCallback

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

	auto value = NativeScriptRuntime::GetJavaField(thiz, fieldCallbackData);
	info.GetReturnValue().Set(value);
}
开发者ID:bright-sparks,项目名称:android-runtime,代码行数:8,代码来源:MetadataNode.cpp

示例5:

static void
gum_v8_stalker_on_get_queue_capacity (Local<String> property,
                                      const PropertyCallbackInfo<Value> & info)
{
  GumV8Stalker * self = static_cast<GumV8Stalker *> (
      info.Data ().As<External> ()->Value ());
  (void) property;
  info.GetReturnValue ().Set (self->queue_capacity);
}
开发者ID:0xItx,项目名称:frida-gum,代码行数:9,代码来源:gumv8stalker.cpp

示例6: handle_scope

/**
 * TJSオブジェクト用のプロパティセッター
 * @param args 引数
 * @return 結果
 */
void
TJSInstance::tjsSetter(Local<String> property, Local<Value> value, const PropertyCallbackInfo<void>& info)
{
	Isolate *isolate = info.GetIsolate();
	HandleScope handle_scope(isolate);
	tTJSVariant instance;
	tTJSVariant method;
	if (getVariant(isolate, instance, info.This()) && getVariant(isolate, method, info.Data()->ToObject())) {
		PropSetter set(instance, method, value, info);
		set.exec();
	}
}
开发者ID:xmoeproject,项目名称:X-moe,代码行数:17,代码来源:tjsinstance.cpp

示例7: InnerClassAccessorGetterCallback

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

		auto innerKey = ConvertToV8String("inner:" + node->m_treeNode->name);

		auto innerTypeCtorFunc = thiz->GetHiddenValue(innerKey).As<Function>();
		if (innerTypeCtorFunc.IsEmpty())
		{
			auto funcTemplate = node->GetConstructorFunctionTemplate(isolate, node->m_treeNode);
			auto ctorFunc = funcTemplate->GetFunction();

			auto innerClassData = External::New(isolate, new InnerClassData(new Persistent<Object>(isolate, thiz), node));
			auto innerTypeCtorFuncTemplate = FunctionTemplate::New(isolate, InnerClassConstructorCallback, innerClassData);
			innerTypeCtorFuncTemplate->InstanceTemplate()->SetInternalFieldCount(static_cast<int>(ObjectManager::MetadataNodeKeys::END));
			innerTypeCtorFunc = innerTypeCtorFuncTemplate->GetFunction();
			auto prototypeName = ConvertToV8String("prototype");
			auto innerTypeCtorFuncPrototype = innerTypeCtorFunc->Get(prototypeName).As<Object>();
			innerTypeCtorFuncPrototype->SetPrototype(ctorFunc->Get(prototypeName));

			thiz->SetHiddenValue(innerKey, innerTypeCtorFunc);
		}

		info.GetReturnValue().Set(innerTypeCtorFunc);
	}
	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,代码行数:44,代码来源:MetadataNode.cpp

示例8: FieldAccessorSetterCallback

void MetadataNode::FieldAccessorSetterCallback(Local<String> property, Local<Value> value, const PropertyCallbackInfo<void>& 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;
		}

		if (fieldCallbackData->isFinal)
		{
			stringstream ss;
			ss << "You are trying to set \"" << fieldCallbackData->name << "\" which is a final field! Final fields can only be read.";
			string exceptionMessage = ss.str();

			throw NativeScriptException(exceptionMessage);
		}
		else
		{
			NativeScriptRuntime::SetJavaField(thiz, value, 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,代码行数:42,代码来源:MetadataNode.cpp

示例9: FieldAccessorSetterCallback

void MetadataNode::FieldAccessorSetterCallback(Local<String> property,Local<Value> value, const PropertyCallbackInfo<void>& info)
{
	DEBUG_WRITE("FieldAccessorSetterCallback");

	auto thiz = info.This();
	auto fieldCallbackData = reinterpret_cast<FieldCallbackData*>(info.Data().As<External>()->Value());

	if (fieldCallbackData->isFinal)
	{
		stringstream ss;
		ss << "You are trying to set \"" << fieldCallbackData->name << "\" which is a final field! Final fields can only be read.";
		string exceptionMessage = ss.str();

		ExceptionUtil::GetInstance()->ThrowExceptionToJs(exceptionMessage);
	}
	else
	{
		NativeScriptRuntime::SetJavaField(thiz, value, fieldCallbackData);
		info.GetReturnValue().Set(value);
	}
}
开发者ID:bright-sparks,项目名称:android-runtime,代码行数:21,代码来源:MetadataNode.cpp

示例10: jsGetter

void Dollar::jsGetter(Local<String> property, const PropertyCallbackInfo<v8::Value>& info)
{
	auto data = info.Data();
	info.GetReturnValue().Set(data);
}
开发者ID:alexezh,项目名称:trv,代码行数:5,代码来源:dollar.cpp


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