本文整理汇总了C++中fb::JSAPIPtr::getMemberCount方法的典型用法代码示例。如果您正苦于以下问题:C++ JSAPIPtr::getMemberCount方法的具体用法?C++ JSAPIPtr::getMemberCount怎么用?C++ JSAPIPtr::getMemberCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类fb::JSAPIPtr
的用法示例。
在下文中一共展示了JSAPIPtr::getMemberCount方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getMemberCount
size_t IDispatchAPI::getMemberCount() const
{
if (!host->isMainThread()) {
return host->CallOnMainThread(boost::bind(&IDispatchAPI::getMemberCount, this));
}
if (is_JSAPI) {
FB::JSAPIPtr tmp = inner.lock();
if (!tmp) {
// TODO: check if this should be -1
return 0;
}
return tmp->getMemberCount();
}
CComQIPtr<IDispatchEx> dispatchEx(m_obj);
if (!dispatchEx) {
return -1;
}
size_t count = 0;
DISPID dispid = DISPID_STARTENUM;
while (dispatchEx->GetNextDispID(fdexEnumAll, dispid, &dispid) != S_FALSE) {
if (dispid >= 0) {
++count;
}
}
return count;
}
示例2: getMemberCount
size_t IDispatchAPI::getMemberCount() const
{
if (!host->isMainThread()) {
return host->CallOnMainThread(boost::bind(&IDispatchAPI::getMemberCount, this));
}
if (is_JSAPI) {
FB::JSAPIPtr tmp = inner.lock();
if (tmp)
return tmp->getMemberCount();
else
return 0;
}
HRESULT hr;
DISPID dispid;
size_t count(0);
CComQIPtr<IDispatchEx> dispex(m_obj);
if (!dispex) {
return -1;
}
hr = dispex->GetNextDispID(fdexEnumAll, DISPID_STARTENUM, &dispid);
while (SUCCEEDED(hr)) {
count++;
hr = dispex->GetNextDispID(fdexEnumAll, dispid, &dispid);
}
return count;
}
示例3: getMemberCount
size_t NPObjectAPI::getMemberCount() const
{
if (m_browser.expired())
return 0;
NpapiBrowserHostPtr browser(getHost());
if (!browser->isMainThread()) {
return browser->CallOnMainThread(boost::bind(&NPObjectAPI::getMemberCount, this));
}
if (is_JSAPI) {
FB::JSAPIPtr tmp = inner.lock();
if (tmp)
return tmp->getMemberCount();
else
return 0;
}
NPIdentifier *idArray(NULL);
uint32_t count;
browser->Enumerate(obj, &idArray, &count);
browser->MemFree(idArray);
return (size_t)count;
}
示例4: getMemberCount
size_t IDispatchAPI::getMemberCount() const
{
if (m_browser.expired() || m_obj.expired())
return 0;
ActiveXBrowserHostPtr browser(getHost());
if (!browser->isMainThread()) {
return browser->CallOnMainThread(boost::bind(&IDispatchAPI::getMemberCount, this));
}
if (is_JSAPI) {
FB::JSAPIPtr tmp = inner.lock();
if (!tmp) {
// TODO: check if this should be -1
return 0;
}
return tmp->getMemberCount();
}
size_t count = 0;
try {
CComQIPtr<IDispatchEx> dispatchEx(getIDispatch());
if (!dispatchEx) {
return -1;
}
DISPID dispid = DISPID_STARTENUM;
while (dispatchEx->GetNextDispID(fdexEnumAll, dispid, &dispid) != S_FALSE) {
if (dispid >= 0) {
++count;
}
}
} catch (...) {}
return count;
}