本文整理汇总了C++中fb::VariantList::size方法的典型用法代码示例。如果您正苦于以下问题:C++ VariantList::size方法的具体用法?C++ VariantList::size怎么用?C++ VariantList::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类fb::VariantList
的用法示例。
在下文中一共展示了VariantList::size方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: countArrayLength
long FBTestPluginAPI::countArrayLength(const FB::JSObjectPtr &jso)
{
if (!jso->HasProperty("getArray"))
throw FB::invalid_arguments();
FB::VariantList array = jso->GetProperty("getArray").cast<FB::VariantList>();
long len = array.size();// array->GetProperty("length").convert_cast<long>();
return len;
}
示例2: Construct
FB::variant NPObjectAPI::Construct( const FB::VariantList& args )
{
if (m_browser.expired())
return false;
NpapiBrowserHostPtr browser(getHost());
if (!browser->isMainThread()) {
return browser->CallOnMainThread(boost::bind((FB::ConstructType)&NPObjectAPI::Construct, this, args));
}
if (is_JSAPI) {
FB::JSAPIPtr tmp = inner.lock();
if (tmp)
return tmp->Construct(args);
else
return false;
}
NPVariant retVal;
// Convert the arguments to NPVariants
boost::scoped_array<NPVariant> npargs(new NPVariant[args.size()]);
for (unsigned int i = 0; i < args.size(); i++) {
browser->getNPVariant(&npargs[i], args[i]);
}
bool res = false;
// construct
res = browser->Construct(obj, npargs.get(), args.size(), &retVal);
// Free the NPVariants that we earlier allocated
for (unsigned int i = 0; i < args.size(); i++) {
browser->ReleaseVariantValue(&npargs[i]);
}
if (!res) { // If the method call failed, throw an exception
throw script_error("constructor");
} else {
FB::variant ret = browser->getVariant(&retVal);
browser->ReleaseVariantValue(&retVal); // Always release the return value!
return ret;
}
}
示例3: callMultipleFunctions
void IDispatchAPI::callMultipleFunctions( const std::string& name, const FB::VariantList& args,
const std::vector<FB::JSObjectPtr>& direct, const std::vector<FB::JSObjectPtr>& ifaces )
{
if (!isValid())
throw FB::script_error("Error calling handlers");
ActiveXBrowserHostPtr browser(getHost());
if (!browser->isMainThread()) {
return browser->ScheduleOnMainThread(shared_from_this(), boost::bind(&IDispatchAPI::callMultipleFunctions, this, name, args, direct, ifaces));
}
size_t argCount(args.size());
boost::scoped_array<CComVariant> comArgs(new CComVariant[argCount + 1]);
boost::scoped_array<VARIANTARG> rawComArgs(new VARIANTARG[argCount + 1]);
DISPPARAMS params;
DISPID tid = DISPID_THIS;
params.cArgs = args.size() + 1;
params.cNamedArgs = 1;
params.rgvarg = rawComArgs.get();
params.rgdispidNamedArgs = &tid; // Needed for IE9
for (size_t i = 0; i < argCount; i++) {
browser->getComVariant(&comArgs[argCount - i], args[i]);
// We copy w/out adding a ref so that comArgs will still clean up the values when it goes away
rawComArgs[argCount - i] = comArgs[argCount - i];
}
comArgs[0] = getIDispatch(); // Needed for IE 9
rawComArgs[0] = comArgs[0];
CComVariant result;
CComExcepInfo exceptionInfo;
std::vector<FB::JSObjectPtr>::const_iterator it(direct.begin());
std::vector<FB::JSObjectPtr>::const_iterator endit(direct.end());
for (it; it != endit; ++it) {
IDispatchAPIPtr ptr(boost::static_pointer_cast<IDispatchAPI>(*it));
DISPID dispId = ptr->getIDForName(std::wstring(L""));
if (dispId == DISPID_UNKNOWN) {
continue;
}
CComQIPtr<IDispatchEx> dispatchEx(ptr->getIDispatch());
HRESULT hr;
if (!dispatchEx) {
hr = getIDispatch()->Invoke(dispId, IID_NULL, LOCALE_USER_DEFAULT,
DISPATCH_METHOD, ¶ms, &result, &exceptionInfo, NULL);
} else {
hr = dispatchEx->InvokeEx(dispId, LOCALE_USER_DEFAULT,
DISPATCH_METHOD, ¶ms, &result, &exceptionInfo, NULL);
}
}
it = ifaces.begin();
endit = ifaces.end();
for (it; it != endit; ++it) {
IDispatchAPIPtr ptr(boost::static_pointer_cast<IDispatchAPI>(*it));
DISPID dispId = getIDForName(FB::utf8_to_wstring(name));
if (dispId == DISPID_UNKNOWN) {
continue;
}
CComQIPtr<IDispatchEx> dispatchEx(ptr->getIDispatch());
HRESULT hr;
if (!dispatchEx) {
hr = getIDispatch()->Invoke(dispId, IID_NULL, LOCALE_USER_DEFAULT,
DISPATCH_METHOD, ¶ms, &result, &exceptionInfo, NULL);
} else {
hr = dispatchEx->InvokeEx(dispId, LOCALE_USER_DEFAULT,
DISPATCH_METHOD, ¶ms, &result, &exceptionInfo, NULL);
}
}
}