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


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

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


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

示例1: ArrayIndexedPropertySetterCallback

void MetadataNode::ArrayIndexedPropertySetterCallback(uint32_t index, Local<Value> value, const PropertyCallbackInfo<Value>& info)
{
	try
	{
		auto node = GetNodeFromHandle(info.This());

		NativeScriptRuntime::SetArrayElement(info.This(), index, node->m_name, value);

		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,代码行数:25,代码来源:MetadataNode.cpp

示例2: ArrayIndexedPropertyGetterCallback

void MetadataNode::ArrayIndexedPropertyGetterCallback(uint32_t index, const PropertyCallbackInfo<Value>& info)
{
	auto node = GetNodeFromHandle(info.This());

	auto element = s_getArrayElement(info.This(), index, node->m_name);

	info.GetReturnValue().Set(element);
}
开发者ID:frodoking,项目名称:NativeScriptAndroidRuntime,代码行数:8,代码来源:MetadataNode.cpp

示例3: ArrayIndexedPropertySetterCallback

void MetadataNode::ArrayIndexedPropertySetterCallback(uint32_t index, Local<Value> value, const PropertyCallbackInfo<Value>& info)
{
	auto node = GetNodeFromHandle(info.This());

	NativeScriptRuntime::SetArrayElement(info.This(), index, node->m_name, value);

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

示例4: SetTopmost

void UiWindow::SetTopmost(Local<String> property, Local<Value> value, const PropertyCallbackInfo<void>& info) {
    Isolate* isolate = Isolate::GetCurrent();
    HandleScope scope(isolate);
    UiWindow* _this = Unwrap<UiWindow>(info.This());
    bool topmost = value->BooleanValue();
    _this->SetTopmost(topmost);
}
开发者ID:NextGenIntelligence,项目名称:io-ui,代码行数:7,代码来源:ui-window.cpp

示例5: GetTopmost

void UiWindow::GetTopmost(Local<String> property, const PropertyCallbackInfo<Value>& info) {
    Isolate* isolate = Isolate::GetCurrent();
    HandleScope scope(isolate);
    UiWindow* _this = Unwrap<UiWindow>(info.This());
    bool topmost = _this->GetTopmost();
    info.GetReturnValue().Set(Boolean::New(isolate, topmost));
}
开发者ID:NextGenIntelligence,项目名称:io-ui,代码行数:7,代码来源:ui-window.cpp

示例6: GetState

void UiWindow::GetState(Local<String> property, const PropertyCallbackInfo<Value>& info) {
    Isolate* isolate = Isolate::GetCurrent();
    HandleScope scope(isolate);
    UiWindow* _this = Unwrap<UiWindow>(info.This());
    WINDOW_STATE state = _this->GetState();
    info.GetReturnValue().Set(Int32::New(isolate, state));
}
开发者ID:NextGenIntelligence,项目名称:io-ui,代码行数:7,代码来源:ui-window.cpp

示例7: GetTop

void UiWindow::GetTop(Local<String> property, const PropertyCallbackInfo<Value>& info) {
    Isolate* isolate = Isolate::GetCurrent();
    HandleScope scope(isolate);
    UiWindow* _this = Unwrap<UiWindow>(info.This());
    WindowRect rect = _this->GetWindowRect();
    info.GetReturnValue().Set(Int32::New(isolate, rect.Top));
}
开发者ID:NextGenIntelligence,项目名称:io-ui,代码行数:7,代码来源:ui-window.cpp

示例8: GetOpacity

void UiWindow::GetOpacity(Local<String> property, const PropertyCallbackInfo<Value>& info) {
    Isolate* isolate = Isolate::GetCurrent();
    HandleScope scope(isolate);
    UiWindow* _this = Unwrap<UiWindow>(info.This());
    double opacity = _this->GetOpacity();
    info.GetReturnValue().Set(Number::New(isolate, opacity));
}
开发者ID:NextGenIntelligence,项目名称:io-ui,代码行数:7,代码来源:ui-window.cpp

示例9: 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

示例10: PackageGetterCallback

void MetadataNode::PackageGetterCallback(Local<String> property, const PropertyCallbackInfo<Value>& info)
{
	string propName = ConvertToString(property);

	if (propName.empty())
		return;

	auto isolate = Isolate::GetCurrent();
	HandleScope handleScope(isolate);

	auto thiz = info.This();

	auto cachedItem = thiz->GetHiddenValue(property);

	if (cachedItem.IsEmpty())
	{
		auto node = GetPackageMetadata(isolate, thiz);

		uint8_t nodeType = s_metadataReader.GetNodeType(node->m_treeNode);

		DEBUG_WRITE("MetadataNode::GetterCallback: prop '%s' for node '%s' called, nodeType=%d, hash=%d", propName.c_str(), node->m_treeNode->name.c_str(), nodeType, thiz.IsEmpty() ? -42 : thiz->GetIdentityHash());

		auto child = GetChildMetadataForPackage(node, propName);
		auto foundChild = child.treeNode != nullptr;

		if (foundChild)
		{
			auto childNode = MetadataNode::GetOrCreateInternal(child.treeNode);
			cachedItem = childNode->CreateWrapper(isolate);
			thiz->SetHiddenValue(property, cachedItem);
		}
	}

	info.GetReturnValue().Set(cachedItem);
}
开发者ID:bright-sparks,项目名称:android-runtime,代码行数:35,代码来源:MetadataNode.cpp

示例11: SuperAccessorGetterCallback

void MetadataNode::SuperAccessorGetterCallback(Local<String> property, const PropertyCallbackInfo<Value>& info)
{
	auto thiz = info.This();
	auto isolate = info.GetIsolate();
	auto k = ConvertToV8String("supervalue");
	auto superValue = thiz->GetHiddenValue(k).As<Object>();
	if (superValue.IsEmpty())
	{
		superValue = s_objectManager->GetEmptyObject(isolate);
		bool d = superValue->Delete(ConvertToV8String("toString"));
		d = superValue->Delete(ConvertToV8String("valueOf"));
		superValue->SetInternalField(static_cast<int>(ObjectManager::MetadataNodeKeys::CallSuper), True(isolate));

		superValue->SetPrototype(thiz->GetPrototype().As<Object>()->GetPrototype().As<Object>()->GetPrototype());
		thiz->SetHiddenValue(k, superValue);
		s_objectManager->CloneLink(thiz, superValue);

		DEBUG_WRITE("superValue.GetPrototype=%d", superValue->GetPrototype().As<Object>()->GetIdentityHash());

		auto node = GetInstanceMetadata(isolate, thiz);
		SetInstanceMetadata(isolate, superValue, node);

		thiz->SetHiddenValue(k, superValue);
	}

	info.GetReturnValue().Set(superValue);
}
开发者ID:bright-sparks,项目名称:android-runtime,代码行数:27,代码来源:MetadataNode.cpp

示例12: ClassAccessorGetterCallback

void MetadataNode::ClassAccessorGetterCallback(Local<String> property, const PropertyCallbackInfo<Value>& info)
{
	try
	{
		auto thiz = info.This();
		auto isolate = info.GetIsolate();
		auto data = GetTypeMetadata(isolate, thiz.As<Function>());

		auto value = NativeScriptRuntime::FindClass(data->name);
		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,代码行数:26,代码来源:MetadataNode.cpp

示例13: 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

示例14: 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

示例15: SetTop

void UiWindow::SetTop(Local<String> property, Local<Value> value, const PropertyCallbackInfo<void>& info) {
    Isolate* isolate = Isolate::GetCurrent();
    HandleScope scope(isolate);
    UiWindow* _this = Unwrap<UiWindow>(info.This());
    WindowRect rect = _this->GetWindowRect();
    rect.Top = value->Int32Value();
    _this->SetWindowRect(rect);
}
开发者ID:NextGenIntelligence,项目名称:io-ui,代码行数:8,代码来源:ui-window.cpp


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