本文整理汇总了C++中SharedValue::SetList方法的典型用法代码示例。如果您正苦于以下问题:C++ SharedValue::SetList方法的具体用法?C++ SharedValue::SetList怎么用?C++ SharedValue::SetList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SharedValue
的用法示例。
在下文中一共展示了SharedValue::SetList方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _GetOpenWindows
void UIBinding::_GetOpenWindows(const ValueList& args, SharedValue result)
{
SharedKList list = new StaticBoundList();
std::vector<AutoUserWindow>::iterator w = openWindows.begin();
while (w != openWindows.end()) {
list->Append(Value::NewObject(*w++));
}
result->SetList(list);
}
示例2: GetAliases
void HostBinding::GetAliases(const ValueList& args, SharedValue result)
{
SharedBoundList 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);
}
示例3: GetArguments
void AppBinding::GetArguments(const ValueList& args, SharedValue result)
{
static SharedKList 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);
}
示例4: GetAddresses
void HostBinding::GetAddresses(const ValueList& args, SharedValue result)
{
SharedBoundList list = new StaticBoundList();
std::vector<IPAddress> addresses = this->host.addresses();
std::vector<IPAddress>::iterator iter = addresses.begin();
while (iter!=addresses.end())
{
IPAddress address = (*iter++);
SharedBoundObject obj = new IPAddressBinding(address);
SharedValue addr = Value::NewObject(obj);
list->Append(addr);
}
result->SetList(list);
}
示例5: GetUsers
void IRCClientBinding::GetUsers(const ValueList& args, SharedValue result)
{
const char *channel = args.at(0)->ToString();
SharedKList list = new StaticBoundList();
channel_user* cu = irc.get_users();
while(cu)
{
if (!strcmp(cu->channel,(char*)channel) && cu->nick && strlen(cu->nick)>0)
{
SharedKObject entry = new StaticBoundObject();
entry->Set("name",Value::NewString(cu->nick));
entry->Set("operator",Value::NewBool(cu->flags & IRC_USER_OP));
entry->Set("voice",Value::NewBool(cu->flags & IRC_USER_VOICE));
list->Append(Value::NewObject(entry));
}
cu = cu->next;
}
result->SetList(list);
}
示例6: Split
void Blob::Split(const ValueList& args, SharedValue 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("Blob.split", "?s,i");
SharedKList list = new StaticBoundList();
result->SetList(list);
std::string target = "";
if (this->length > 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 = INT_MAX;
if (args.size() > 1)
{
limit = args.GetInt(1);
}
// 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));
}
示例7: _GetManifest
void ComponentBinding::_GetManifest(const ValueList& args, SharedValue result)
{
vector<pair<string, string> > manifest = this->component->ReadManifest();
SharedKList manifestList = APIBinding::ManifestToKList(manifest);
result->SetList(manifestList);
}