本文整理汇总了C++中JsValueList类的典型用法代码示例。如果您正苦于以下问题:C++ JsValueList类的具体用法?C++ JsValueList怎么用?C++ JsValueList使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了JsValueList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetFilter
FilterPtr FilterEngine::GetFilter(const std::string& text)
{
JsValuePtr func = jsEngine->Evaluate("API.getFilterFromText");
JsValueList params;
params.push_back(jsEngine->NewValue(text));
return FilterPtr(new Filter(std::move(*func->Call(params))));
}
示例2: GetSubscription
SubscriptionPtr FilterEngine::GetSubscription(const std::string& url)
{
JsValuePtr func = jsEngine->Evaluate("API.getSubscriptionFromUrl");
JsValueList params;
params.push_back(jsEngine->NewValue(url));
return SubscriptionPtr(new Subscription(std::move(*func->Call(params))));
}
示例3: RemoveFromList
void Filter::RemoveFromList()
{
JsValuePtr func = jsEngine->Evaluate("API.removeFilterFromList");
JsValueList params;
params.push_back(shared_from_this());
func->Call(params);
}
示例4: UpdateFilters
void Subscription::UpdateFilters()
{
JsValuePtr func = jsEngine->Evaluate("API.updateSubscription");
JsValueList params;
params.push_back(shared_from_this());
func->Call(params);
}
示例5: GetHostFromURL
std::string FilterEngine::GetHostFromURL(const std::string& url)
{
JsValuePtr func = jsEngine->Evaluate("API.getHostFromUrl");
JsValueList params;
params.push_back(jsEngine->NewValue(url));
return func->Call(params)->AsString();
}
示例6: IsListed
bool Subscription::IsListed()
{
JsValuePtr func = jsEngine->Evaluate("API.isListedSubscription");
JsValueList params;
params.push_back(shared_from_this());
return func->Call(params)->AsBool();
}
示例7: context
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));
}
示例8: GetPref
JsValuePtr FilterEngine::GetPref(const std::string& pref) const
{
JsValuePtr func = jsEngine->Evaluate("API.getPref");
JsValueList params;
params.push_back(jsEngine->NewValue(pref));
return func->Call(params);
}
示例9: AddToList
void Subscription::AddToList()
{
JsValuePtr func = jsEngine->Evaluate("API.addSubscriptionToList");
JsValueList params;
params.push_back(shared_from_this());
func->Call(params);
}
示例10: SetPref
void FilterEngine::SetPref(const std::string& pref, JsValuePtr value)
{
JsValuePtr func = jsEngine->Evaluate("API.setPref");
JsValueList params;
params.push_back(jsEngine->NewValue(pref));
params.push_back(value);
func->Call(params);
}
示例11: IsUpdating
bool Subscription::IsUpdating()
{
JsValuePtr func = jsEngine->Evaluate("API.isSubscriptionUpdating");
JsValueList params;
params.push_back(shared_from_this());
JsValuePtr result = func->Call(params);
return result->AsBool();
}
示例12: context
AdblockPlus::JsValueList AdblockPlus::JsEngine::ConvertArguments(const v8::Arguments& arguments)
{
const JsContext context(shared_from_this());
JsValueList list;
for (int i = 0; i < arguments.Length(); i++)
list.push_back(JsValuePtr(new JsValue(shared_from_this(), arguments[i])));
return list;
}
示例13: CompareVersions
int FilterEngine::CompareVersions(const std::string& v1, const std::string& v2)
{
JsValueList params;
params.push_back(jsEngine->NewValue(v1));
params.push_back(jsEngine->NewValue(v2));
JsValuePtr func = jsEngine->Evaluate("API.compareVersions");
return func->Call(params)->AsInt();
}
示例14: 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;
}
示例15: 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;
}