本文整理汇总了C++中fb::JSAPIPtr::getMemberNames方法的典型用法代码示例。如果您正苦于以下问题:C++ JSAPIPtr::getMemberNames方法的具体用法?C++ JSAPIPtr::getMemberNames怎么用?C++ JSAPIPtr::getMemberNames使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类fb::JSAPIPtr
的用法示例。
在下文中一共展示了JSAPIPtr::getMemberNames方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getMemberNames
void IDispatchAPI::getMemberNames(std::vector<std::string> &nameVector) const
{
if (!host->isMainThread()) {
typedef void (FB::JSAPI::*getMemberNamesType)(std::vector<std::string> *nameVector) const;
host->CallOnMainThread(boost::bind((getMemberNamesType)&FB::JSAPI::getMemberNames, this, &nameVector));
return;
}
if (is_JSAPI) {
FB::JSAPIPtr tmp = inner.lock();
if (tmp)
tmp->getMemberNames(nameVector);
return;
}
CComQIPtr<IDispatchEx> dispatchEx(m_obj);
if (!dispatchEx) {
throw FB::script_error("Cannot enumerate members; IDispatchEx not supported");
}
DISPID dispid = DISPID_STARTENUM;
while (dispatchEx->GetNextDispID(fdexEnumAll, dispid, &dispid) != S_FALSE) {
if (dispid < 0) {
continue;
}
CComBSTR memberName;
if (SUCCEEDED(dispatchEx->GetMemberName(dispid, &memberName))) {
std::wstring name(memberName);
nameVector.push_back(FB::wstring_to_utf8(name));
}
}
}
示例2: getMemberNames
void IDispatchAPI::getMemberNames(std::vector<std::string> &nameVector) const
{
if (!host->isMainThread()) {
typedef void (FB::JSAPI::*getMemberNamesType)(std::vector<std::string> *nameVector) const;
host->CallOnMainThread(boost::bind((getMemberNamesType)&FB::JSAPI::getMemberNames, this, &nameVector));
return;
}
if (is_JSAPI) {
FB::JSAPIPtr tmp = inner.lock();
if (tmp)
tmp->getMemberNames(nameVector);
return;
}
HRESULT hr;
DISPID dispid;
CComQIPtr<IDispatchEx> dispex(m_obj);
if (!dispex) {
throw FB::script_error("Cannot enumerate members; IDispatchEx not supported");
}
hr = dispex->GetNextDispID(fdexEnumAll, DISPID_STARTENUM, &dispid);
while (SUCCEEDED(hr) && dispid > -1) {
CComBSTR curName;
hr = dispex->GetMemberName(dispid, &curName);
std::wstring wStr(curName);
nameVector.push_back(FB::wstring_to_utf8(wStr));
hr = dispex->GetNextDispID(fdexEnumAll, dispid, &dispid);
}
}
示例3: getMemberNames
void NPObjectAPI::getMemberNames(std::vector<std::string> &nameVector) const
{
if (m_browser.expired())
return;
NpapiBrowserHostPtr browser(getHost());
if (!browser->isMainThread()) {
typedef void (FB::JSAPI::*getMemberNamesType)(std::vector<std::string> *nameVector) const;
browser->CallOnMainThread(boost::bind((getMemberNamesType)&FB::JSAPI::getMemberNames, this, &nameVector));
return;
}
if (is_JSAPI) {
FB::JSAPIPtr tmp = inner.lock();
if (tmp)
tmp->getMemberNames(nameVector);
return;
}
NPIdentifier *idArray(NULL);
uint32_t count;
browser->Enumerate(obj, &idArray, &count);
for (uint32_t i = 0; i < count; i++) {
nameVector.push_back(browser->StringFromIdentifier(idArray[i]));
}
browser->MemFree(idArray);
}