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


C++ KObjectRef::GetPropertyNames方法代码示例

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


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

示例1: CreateProperties

	void AppBinding::CreateProperties(const ValueList& args, KValueRef result)
	{
		AutoPtr<PropertiesBinding> properties = new PropertiesBinding();
		result->SetObject(properties);
		
		if (args.size() > 0 && args.at(0)->IsObject())
		{
			KObjectRef p = args.at(0)->ToObject();
			SharedStringList names = p->GetPropertyNames();
			for (size_t i = 0; i < names->size(); i++)
			{
				KValueRef value = p->Get(names->at(i));
				ValueList setterArgs;
				setterArgs.push_back(Value::NewString(names->at(i)));
				setterArgs.push_back(value);
				PropertiesBinding::Type type;
				
				if (value->IsList()) type = PropertiesBinding::List;
				else if (value->IsInt()) type = PropertiesBinding::Int;
				else if (value->IsDouble()) type = PropertiesBinding::Double;
				else if (value->IsBool()) type = PropertiesBinding::Bool;
				else type = PropertiesBinding::String;
				
				properties->Setter(setterArgs, type);
			}
		}
	}
开发者ID:mital,项目名称:titanium_desktop,代码行数:27,代码来源:app_binding.cpp

示例2: if

AutoPtr<StaticBoundObject> ScopeMethodDelegate::CreateDelegate(KObjectRef global, KObjectRef bo)
{
	AutoPtr<StaticBoundObject> scope = new StaticBoundObject();
	SharedStringList keys = bo->GetPropertyNames();
	StringList::iterator iter = keys->begin();

	while(iter!=keys->end())
	{
		SharedString key_ptr = (*iter++);
		std::string key = *key_ptr;
		KValueRef value = bo->Get(key.c_str());

		if (key == "set")
		{
			KMethodRef d = new ScopeMethodDelegate(SET, global, scope, value->ToMethod());
			KValueRef v = Value::NewMethod(d);
			scope->Set(key.c_str(), v);
		}
		else if (key == "get")
		{
			KMethodRef d = new ScopeMethodDelegate(GET, global, scope, value->ToMethod());
			KValueRef v = Value::NewMethod(d);
			scope->Set(key.c_str(), v);
		}
		else
		{
			scope->Set(key.c_str(), value);
		}

	}
	return scope;
}
开发者ID:OnlyChristopher,项目名称:TideSDK,代码行数:32,代码来源:scope_method_delegate.cpp


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