本文整理汇总了C++中JsValueList::begin方法的典型用法代码示例。如果您正苦于以下问题:C++ JsValueList::begin方法的具体用法?C++ JsValueList::begin怎么用?C++ JsValueList::begin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JsValueList
的用法示例。
在下文中一共展示了JsValueList::begin方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: runtime_error
AdblockPlus::JsValuePtr AdblockPlus::JsValue::Call(const JsValueList& params, JsValuePtr thisPtr) const
{
if (!IsFunction())
throw new std::runtime_error("Attempting to call a non-function");
const JsContext context(jsEngine);
if (!thisPtr)
{
v8::Local<v8::Context> localContext = v8::Local<v8::Context>::New(jsEngine->GetIsolate(), *jsEngine->context);
thisPtr = JsValuePtr(new JsValue(jsEngine, localContext->Global()));
}
if (!thisPtr->IsObject())
throw new std::runtime_error("`this` pointer has to be an object");
v8::Local<v8::Object> thisObj = v8::Local<v8::Object>::Cast(thisPtr->UnwrapValue());
std::vector<v8::Handle<v8::Value>> argv;
for (JsValueList::const_iterator it = params.begin(); it != params.end(); ++it)
argv.push_back((*it)->UnwrapValue());
const v8::TryCatch tryCatch;
v8::Local<v8::Function> func = v8::Local<v8::Function>::Cast(UnwrapValue());
v8::Local<v8::Value> result = func->Call(thisObj, argv.size(),
argv.size() ? &argv.front() : 0);
if (tryCatch.HasCaught())
throw JsError(tryCatch.Exception(), tryCatch.Message());
return JsValuePtr(new JsValue(jsEngine, result));
}
示例2: Subscription
std::vector<SubscriptionPtr> FilterEngine::FetchAvailableSubscriptions() const
{
JsValuePtr func = jsEngine->Evaluate("API.getRecommendedSubscriptions");
JsValueList values = func->Call()->AsList();
std::vector<SubscriptionPtr> result;
for (JsValueList::iterator it = values.begin(); it != values.end(); it++)
result.push_back(SubscriptionPtr(new Subscription(std::move(**it))));
return result;
}
示例3: Filter
std::vector<FilterPtr> FilterEngine::GetListedFilters() const
{
JsValuePtr func = jsEngine->Evaluate("API.getListedFilters");
JsValueList values = func->Call()->AsList();
std::vector<FilterPtr> result;
for (JsValueList::iterator it = values.begin(); it != values.end(); it++)
result.push_back(FilterPtr(new Filter(std::move(**it))));
return result;
}
示例4:
std::vector<std::string> FilterEngine::GetElementHidingSelectors(const std::string& domain) const
{
JsValuePtr func = jsEngine->Evaluate("API.getElementHidingSelectors");
JsValueList params;
params.push_back(jsEngine->NewValue(domain));
JsValueList result = func->Call(params)->AsList();
std::vector<std::string> selectors;
for (JsValueList::iterator it = result.begin(); it != result.end(); ++it)
selectors.push_back((*it)->AsString());
return selectors;
}
示例5: GetProperty
std::vector<std::string> Notification::GetLinks() const
{
std::vector<std::string> retValue;
JsValuePtr jsLinks = GetProperty("links");
if (!jsLinks->IsArray())
{
return retValue;
}
JsValueList urlLinksList = jsLinks->AsList();
for (JsValueList::const_iterator linkIterator = urlLinksList.begin();
linkIterator != urlLinksList.end(); ++linkIterator)
{
retValue.push_back((*linkIterator)->AsString());
}
return retValue;
}