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


C++ JsValueList类代码示例

本文整理汇总了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))));
}
开发者ID:LTears,项目名称:libadblockplus-vs2013,代码行数:7,代码来源:FilterEngine.cpp

示例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))));
}
开发者ID:LTears,项目名称:libadblockplus-vs2013,代码行数:7,代码来源:FilterEngine.cpp

示例3: RemoveFromList

void Filter::RemoveFromList()
{
  JsValuePtr func = jsEngine->Evaluate("API.removeFilterFromList");
  JsValueList params;
  params.push_back(shared_from_this());
  func->Call(params);
}
开发者ID:LTears,项目名称:libadblockplus-vs2013,代码行数:7,代码来源:FilterEngine.cpp

示例4: UpdateFilters

void Subscription::UpdateFilters()
{
  JsValuePtr func = jsEngine->Evaluate("API.updateSubscription");
  JsValueList params;
  params.push_back(shared_from_this());
  func->Call(params);
}
开发者ID:LTears,项目名称:libadblockplus-vs2013,代码行数:7,代码来源:FilterEngine.cpp

示例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();
}
开发者ID:LTears,项目名称:libadblockplus-vs2013,代码行数:7,代码来源:FilterEngine.cpp

示例6: IsListed

bool Subscription::IsListed()
{
  JsValuePtr func = jsEngine->Evaluate("API.isListedSubscription");
  JsValueList params;
  params.push_back(shared_from_this());
  return func->Call(params)->AsBool();
}
开发者ID:LTears,项目名称:libadblockplus-vs2013,代码行数:7,代码来源:FilterEngine.cpp

示例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));
}
开发者ID:LTears,项目名称:libadblockplus-vs2013,代码行数:29,代码来源:JsValue.cpp

示例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);
}
开发者ID:LTears,项目名称:libadblockplus-vs2013,代码行数:7,代码来源:FilterEngine.cpp

示例9: AddToList

void Subscription::AddToList()
{
  JsValuePtr func = jsEngine->Evaluate("API.addSubscriptionToList");
  JsValueList params;
  params.push_back(shared_from_this());
  func->Call(params);
}
开发者ID:LTears,项目名称:libadblockplus-vs2013,代码行数:7,代码来源:FilterEngine.cpp

示例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);
}
开发者ID:LTears,项目名称:libadblockplus-vs2013,代码行数:8,代码来源:FilterEngine.cpp

示例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();
}
开发者ID:LTears,项目名称:libadblockplus-vs2013,代码行数:8,代码来源:FilterEngine.cpp

示例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;
}
开发者ID:khatribharat,项目名称:libadblockplus,代码行数:8,代码来源:JsEngine.cpp

示例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();
}
开发者ID:LTears,项目名称:libadblockplus-vs2013,代码行数:8,代码来源:FilterEngine.cpp

示例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;
}
开发者ID:LTears,项目名称:libadblockplus-vs2013,代码行数:9,代码来源:FilterEngine.cpp

示例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;
}
开发者ID:LTears,项目名称:libadblockplus-vs2013,代码行数:9,代码来源:FilterEngine.cpp


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