本文整理汇总了C++中fb::JSAPIPtr::HasProperty方法的典型用法代码示例。如果您正苦于以下问题:C++ JSAPIPtr::HasProperty方法的具体用法?C++ JSAPIPtr::HasProperty怎么用?C++ JSAPIPtr::HasProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类fb::JSAPIPtr
的用法示例。
在下文中一共展示了JSAPIPtr::HasProperty方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HasProperty
bool NPObjectAPI::HasProperty(int idx) const
{
if (m_browser.expired())
return false;
NpapiBrowserHostPtr browser(getHost());
if (is_JSAPI) {
FB::JSAPIPtr tmp = inner.lock();
if (tmp)
return tmp->HasProperty(idx);
else
return false;
}
return browser->HasProperty(obj, browser->GetIntIdentifier(idx));
}
示例2: HasProperty
bool IDispatchAPI::HasProperty(const std::string& propertyName) const
{
if (m_browser.expired() || m_obj.expired())
return false;
ActiveXBrowserHostPtr browser(getHost());
if (!browser->isMainThread()) {
typedef bool (IDispatchAPI::*HasPropertyType)(const std::string&) const;
return browser->CallOnMainThread(boost::bind((HasPropertyType)&IDispatchAPI::HasProperty, this, propertyName));
}
if (is_JSAPI) {
FB::JSAPIPtr tmp = inner.lock();
if (!tmp) {
return false;
}
return tmp->HasProperty(propertyName);
}
DISPID dispId = getIDForName(FB::utf8_to_wstring(propertyName));
if (dispId == DISPID_UNKNOWN && propertyName != "toString") {
return false;
}
DISPPARAMS params;
params.cArgs = 0;
params.cNamedArgs = 0;
// the only way to find out if the property actually exists or not is to try to get it
HRESULT hr;
CComVariant result;
CComExcepInfo exceptionInfo;
try {
CComQIPtr<IDispatchEx> dispatchEx(getIDispatch());
if (dispatchEx) {
hr = dispatchEx->InvokeEx(dispId, LOCALE_USER_DEFAULT,
DISPATCH_PROPERTYGET, ¶ms, &result, &exceptionInfo, NULL);
} else {
hr = getIDispatch()->Invoke(dispId, IID_NULL, LOCALE_USER_DEFAULT,
DISPATCH_PROPERTYGET, ¶ms, &result, &exceptionInfo, NULL);
}
return SUCCEEDED(hr);
} catch (...) { return false; }
}
示例3: HasProperty
bool IDispatchAPI::HasProperty(const std::string& propertyName) const
{
if (!host->isMainThread()) {
typedef bool (IDispatchAPI::*HasPropertyType)(const std::string&) const;
return host->CallOnMainThread(boost::bind((HasPropertyType)&IDispatchAPI::HasProperty, this, propertyName));
}
if (is_JSAPI) {
FB::JSAPIPtr tmp = inner.lock();
if (tmp)
return tmp->HasProperty(propertyName);
else
return false;
}
DISPID id = getIDForName(FB::utf8_to_wstring(propertyName));
if (id == -1 && propertyName != "toString")
return false;
DISPPARAMS params;
params.cArgs = 0;
params.cNamedArgs = 0;
// The only way to find out if the property actually exists or not is to try to get it;
VARIANT res;
EXCEPINFO eInfo;
HRESULT hr = E_NOTIMPL;
CComQIPtr<IDispatchEx> dispex(m_obj);
if (dispex) {
hr = dispex->InvokeEx(id, LOCALE_USER_DEFAULT, DISPATCH_PROPERTYGET, ¶ms,
&res, &eInfo, NULL);
} else {
hr = m_obj->Invoke(getIDForName(FB::utf8_to_wstring(propertyName)), IID_NULL, LOCALE_USER_DEFAULT,
DISPATCH_PROPERTYGET, ¶ms, &res, NULL, NULL);
}
if (SUCCEEDED(hr)) {
return true;
} else {
return false;
}
}