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


C++ KValueRef::SetList方法代码示例

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


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

示例1: _CreateKList

 void APIBinding::_CreateKList(const ValueList& args, KValueRef result)
 {
     args.VerifyException("createKList", "?l");
     if (args.size() <= 0)
     {
         result->SetList(new StaticBoundList());
     }
     else
     {
         KListRef wrapped = args.GetList(0);
         result->SetList(new KListWrapper(wrapped));
     }
 }
开发者ID:fossamikom,项目名称:TideSDK,代码行数:13,代码来源:api_binding.cpp

示例2: _GetData

    void Clipboard::_GetData(const ValueList& args, KValueRef result)
    {
        args.VerifyException("getData", "s");

        std::string mimeType(args.GetString(0));
        DataType type = MimeTypeToDataType(mimeType);
        if (type == URI_LIST)
        {
            std::vector<std::string>& list = this->GetURIList();
            if (mimeType == "url")
            {
                std::string url;
                if (list.size() > 0)
                    url = list.at(0);

                result->SetString(url.c_str());
            }
            else
            {
                result->SetList(StaticBoundList::FromStringVector(list));
            }
        }
        else if (type == IMAGE)
        {
            result->SetObject(this->GetImage(mimeType));
        }
        else 
        {
            result->SetString(this->GetText());
        }
    }
开发者ID:Adimpression,项目名称:TideSDK,代码行数:31,代码来源:clipboard.cpp

示例3: _GetAvailableModules

	void ApplicationBinding::_GetAvailableModules(const ValueList& args, KValueRef result)
	{
		std::vector<SharedComponent> components;
		this->application->GetAvailableComponents(components);
		KListRef componentList = APIBinding::ComponentVectorToKList(components, MODULE);
		result->SetList(componentList);
	}
开发者ID:OnlyChristopher,项目名称:TideSDK,代码行数:7,代码来源:application_binding.cpp

示例4: _GetBundledRuntimes

	void ApplicationBinding::_GetBundledRuntimes(const ValueList& args, KValueRef result)
	{
		std::vector<SharedComponent> components;
		this->application->GetAvailableComponents(components, true);
		KListRef componentList = APIBinding::ComponentVectorToKList(components, RUNTIME);
		result->SetList(componentList);
	}
开发者ID:OnlyChristopher,项目名称:TideSDK,代码行数:7,代码来源:application_binding.cpp

示例5: _Split

	void Bytes::_Split(const ValueList& args, KValueRef result)
	{
		// This method now follows the spec located at:
		// https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String/split
		// Except support for regular expressions
		args.VerifyException("Bytes.split", "?s,i");

		KListRef list = new StaticBoundList();
		result->SetList(list);

		std::string target = "";
		if (this->size > 0)
		{
			target = this->buffer;
		}
		else
		{
			list->Append(Value::NewString(target));
			return;
		}

		if (args.size() <= 0)
		{
			list->Append(Value::NewString(target));
			return;
		}

		std::string separator = args.GetString(0);

		int limit = args.GetInt(1, INT_MAX);

		// We could use Poco's tokenizer here, but it doesn't split strings
		// like "abc,def,," -> ['abc', 'def', '', ''] correctly. It produces
		// ['abc', 'def', ''] which is a different behavior than the JS split.
		// So we roll our own for now -- it's not very efficient right now, but
		// it should be correct.
		size_t next = target.find(separator);
		while (target.size() > 0 && next != std::string::npos)
		{
			std::string token;
			if (separator.size() == 0)
			{
				token = target.substr(0, 1);
			}
			else
			{
				token = target.substr(0, next);
			}
			target = target.substr(next + 1);
			next = target.find(separator);

			if ((int) list->Size() >= limit)
				return;

			list->Append(Value::NewString(token));
		}

		if ((int) list->Size() < limit && separator.size() != 0)
			list->Append(Value::NewString(target));
	}
开发者ID:OnlyChristopher,项目名称:TideSDK,代码行数:60,代码来源:bytes.cpp

示例6: _GetManifest

	void ApplicationBinding::_GetManifest(const ValueList& args, KValueRef result)
	{
		vector<pair<string, string> > manifest =
			BootUtils::ReadManifestFile(this->application->manifestPath);

		KListRef manifestList = APIBinding::ManifestToKList(manifest);
		result->SetList(manifestList);
	}
开发者ID:OnlyChristopher,项目名称:TideSDK,代码行数:8,代码来源:application_binding.cpp

示例7: _GetInstalledComponentsImpl

 void APIBinding::_GetInstalledComponentsImpl(
     KComponentType type, const ValueList& args, KValueRef result)
 {
     bool force = args.GetBool(0, false);
     vector<SharedComponent>& components = BootUtils::GetInstalledComponents(force);
     KListRef componentList = ComponentVectorToKList(components, type);
     result->SetList(componentList);
 }
开发者ID:fossamikom,项目名称:TideSDK,代码行数:8,代码来源:api_binding.cpp

示例8: _GetOpenWindows

	void UIBinding::_GetOpenWindows(const ValueList& args, KValueRef result)
	{
		KListRef list = new StaticBoundList();
		std::vector<AutoUserWindow>::iterator w = openWindows.begin();
		while (w != openWindows.end()) {
			list->Append(Value::NewObject(*w++));
		}
		result->SetList(list);
	}
开发者ID:ksmythe,项目名称:titanium_desktop,代码行数:9,代码来源:ui_binding.cpp

示例9: GetAliases

void HostBinding::GetAliases(const ValueList& args, KValueRef result)
{
    KListRef list = new StaticBoundList();
    std::vector<std::string> aliases = this->host.aliases();
    std::vector<std::string>::iterator iter = aliases.begin();
    while (iter!=aliases.end())
    {
        std::string alias = (*iter++);
        list->Append(Value::NewString(alias));
    }
    result->SetList(list);
}
开发者ID:JohnOscarThomson,项目名称:TideSDK,代码行数:12,代码来源:host_binding.cpp

示例10: GetArguments

	void AppBinding::GetArguments(const ValueList& args, KValueRef result)
	{
		static KListRef argList(0);
		if (argList.isNull())
		{
			// Skip the first argument which is the filename to the executable
			argList = new StaticBoundList();
			for (int i = 1; i < host->GetCommandLineArgCount(); i++)
				argList->Append(Value::NewString(host->GetCommandLineArg(i)));
		}

		result->SetList(argList);
	}
开发者ID:mital,项目名称:titanium_desktop,代码行数:13,代码来源:app_binding.cpp

示例11: GetAddresses

void HostBinding::GetAddresses(const ValueList& args, KValueRef result)
{
    KListRef list = new StaticBoundList();
    std::vector<IPAddress> addresses = this->host.addresses();
    std::vector<IPAddress>::iterator iter = addresses.begin();
    while (iter!=addresses.end())
    {
        IPAddress address = (*iter++);
        KObjectRef obj = new IPAddressBinding(address);
        KValueRef addr = Value::NewObject(obj);
        list->Append(addr);
    }
    result->SetList(list);
}
开发者ID:JohnOscarThomson,项目名称:TideSDK,代码行数:14,代码来源:host_binding.cpp

示例12: GetArguments

	void AppBinding::GetArguments(const ValueList& args, KValueRef result)
	{
		static KListRef argList(0);
		if (argList.isNull())
		{
			// Skip the first argument which is the filename of the executable.
			std::vector<std::string>& args = host->GetApplication()->GetArguments();
			argList = new StaticBoundList();
			for (size_t i = 1; i < args.size(); i++)
				argList->Append(Value::NewString(args.at(i)));
		}

		result->SetList(argList);
	}
开发者ID:Adimpression,项目名称:TideSDK,代码行数:14,代码来源:app_binding.cpp

示例13: ListProperties

void Properties::ListProperties(const ValueList& args, KValueRef result)
{
    std::vector<std::string> keys;
    config->keys(keys);

    KListRef property_list = new StaticBoundList();
    for (size_t i = 0; i < keys.size(); i++)
    {
        std::string property_name = keys.at(i);
        KValueRef name_value = Value::NewString(property_name.c_str());
        property_list->Append(name_value);
    }
    result->SetList(property_list);
}
开发者ID:Defachko,项目名称:titanium_desktop,代码行数:14,代码来源:Properties.cpp

示例14: _GetComponents

	void ApplicationBinding::_GetComponents(const ValueList& args, KValueRef result)
	{
		// Do not use a reference here, because we don't want to modify the
		// application's modules list.
		std::vector<SharedComponent> components = this->application->modules;

		if (!this->application->runtime.isNull())
		{
			components.push_back(this->application->runtime);
		}

		for (size_t i = 0; i < this->application->sdks.size(); i++)
		{
			components.push_back(this->application->sdks[i]);
		}
		KListRef componentList = APIBinding::ComponentVectorToKList(components);
		result->SetList(componentList);
	}
开发者ID:OnlyChristopher,项目名称:TideSDK,代码行数:18,代码来源:application_binding.cpp

示例15: GetList

	void PropertiesBinding::GetList(const ValueList& args, KValueRef result)
	{
		KValueRef stringValue = Value::Null;
		GetString(args, stringValue);

		if (!stringValue->IsNull())
		{
			KListRef list = new StaticBoundList();
			std::string string = stringValue->ToString();
			Poco::StringTokenizer t(string, ",", Poco::StringTokenizer::TOK_TRIM);
			for (size_t i = 0; i < t.count(); i++)
			{
				KValueRef token = Value::NewString(t[i].c_str());
				list->Append(token);
			}

			KListRef list2 = list;
			result->SetList(list2);
		}
	}
开发者ID:JamesHayton,项目名称:titanium_desktop,代码行数:20,代码来源:properties_binding.cpp


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