本文整理汇总了C++中fb::JSAPIPtr::GetProperty方法的典型用法代码示例。如果您正苦于以下问题:C++ JSAPIPtr::GetProperty方法的具体用法?C++ JSAPIPtr::GetProperty怎么用?C++ JSAPIPtr::GetProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类fb::JSAPIPtr
的用法示例。
在下文中一共展示了JSAPIPtr::GetProperty方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AddTrack
void RemoteMediaStream::AddTrack(FB::JSAPIPtr pTrack)
{
if("video" == pTrack->GetProperty("kind").convert_cast<std::string>())
{
m_videoTracks.push_back(FB::variant(pTrack));
}
else if("audio" == pTrack->GetProperty("kind").convert_cast<std::string>())
{
m_audioTracks.push_back(FB::variant(pTrack));
}
}
示例2: GetProperty
// Methods to manage properties on the API
FB::variant IDispatchAPI::GetProperty(const std::string& propertyName)
{
if (!host->isMainThread()) {
return host->CallOnMainThread(boost::bind((FB::GetPropertyType)&IDispatchAPI::GetProperty, this, propertyName));
}
if (is_JSAPI) {
FB::JSAPIPtr tmp = inner.lock();
if (tmp)
return tmp->GetProperty(propertyName);
else
return false;
}
DISPPARAMS params;
params.cArgs = 0;
params.cNamedArgs = 0;
VARIANT res;
EXCEPINFO eInfo;
HRESULT hr = E_NOTIMPL;
CComQIPtr<IDispatchEx> dispex(m_obj);
if (dispex) {
hr = dispex->InvokeEx(getIDForName(FB::utf8_to_wstring(propertyName)), 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 m_browser->getVariant(&res);
} else {
throw FB::script_error("Could not get property");
}
}
示例3: GetProperty
// Methods to manage properties on the API
FB::variant NPObjectAPI::GetProperty(const std::string& propertyName)
{
if (m_browser.expired())
return FB::FBVoid();
NpapiBrowserHostPtr browser(getHost());
if (!browser->isMainThread()) {
return browser->CallOnMainThread(boost::bind((FB::GetPropertyType)&JSAPI::GetProperty, this, propertyName));
}
if (is_JSAPI) {
FB::JSAPIPtr tmp = inner.lock();
if (tmp)
return tmp->GetProperty(propertyName);
else
return false;
}
NPVariant retVal;
if (!browser->GetProperty(obj, browser->GetStringIdentifier(propertyName.c_str()), &retVal)) {
browser->ReleaseVariantValue(&retVal);
throw script_error(propertyName.c_str());
} else {
FB::variant ret = browser->getVariant(&retVal);
browser->ReleaseVariantValue(&retVal);
return ret;
}
}
示例4: GetProperty
// Methods to manage properties on the API
FB::variant IDispatchAPI::GetProperty(const std::string& propertyName)
{
if (m_browser.expired() || m_obj.expired())
return FB::FBVoid();
ActiveXBrowserHostPtr browser(getHost());
if (!browser->isMainThread()) {
return browser->CallOnMainThread(boost::bind((FB::GetPropertyType)&IDispatchAPI::GetProperty, this, propertyName));
}
if (is_JSAPI) {
FB::JSAPIPtr tmp = inner.lock();
if (!tmp) {
return false;
}
return tmp->GetProperty(propertyName);
}
DISPID dispId = getIDForName(FB::utf8_to_wstring(propertyName));
if (dispId == DISPID_UNKNOWN && propertyName != "toString") {
throw FB::script_error("Could not get property");
}
// TODO: how can toString == DISPID_UNKNOWN work?
DISPPARAMS params;
params.cArgs = 0;
params.cNamedArgs = 0;
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);
}
if (FAILED(hr)) {
throw FB::script_error("Could not get property");
}
return browser->getVariant(&result);
} catch (...) {
throw FB::script_error("Could not get property");
}
}
示例5: RemoveStream
FB::variant GCPAPI::RemoveStream(const FB::JSAPIPtr& stream)
{
GoCast::RtcCenter* pCtr = GoCast::RtcCenter::Instance();
if(false == pCtr->Inited())
{
std::string msg = m_htmlId.convert_cast<std::string>();
msg += ": Failed to init RtcCenter singleton";
FBLOG_ERROR_CUSTOM("GCPAPI::RemoveStream", msg);
return false;
}
return pCtr->RemoveStream(m_htmlId.convert_cast<std::string>(),
stream->GetProperty("label").convert_cast<std::string>());
}