FireBreath  1.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Pages
bool IDispatchAPI::HasMethod ( const std::string &  methodName) const

Query if the JSAPI object has the 'methodName' method.

methodNameName of the method.
true if method exists, false if not.

Implements FB::JSAPI.

Definition at line 171 of file IDispatchAPI.cpp.

References FB::utf8_to_wstring().

172 {
173  if (m_browser.expired() || m_obj.expired())
174  return false;
176  ActiveXBrowserHostPtr browser(getHost());
177  if (!browser->isMainThread()) {
178  typedef bool (IDispatchAPI::*curtype)(const std::string&) const;
179  return browser->CallOnMainThread(boost::bind((curtype)&IDispatchAPI::HasMethod, this, methodName));
180  }
182  if (is_JSAPI) {
183  FB::JSAPIPtr tmp = inner.lock();
184  if (!tmp) {
185  return false;
186  }
187  return tmp->HasMethod(methodName);
188  }
190  // This will actually just return true if the specified member exists; IDispatch doesn't really
191  // differentiate further than that
192  return getIDForName(FB::utf8_to_wstring(methodName)) != -1 && !HasProperty(methodName);
193 }
Provide a JSObject implementation to wrap a IDispatch ActiveX object.
Definition: IDispatchAPI.h:33
bool HasProperty(const std::string &propertyName) const
Query if 'propertyName' is a valid property.
boost::shared_ptr< FB::JSAPI > JSAPIPtr
Defines an alias for a JSAPI shared_ptr (you should never use a JSAPI* directly)
Definition: APITypes.h:94
bool HasMethod(const std::string &methodName) const
Query if the JSAPI object has the 'methodName' method.
std::wstring utf8_to_wstring(const std::string &src)
Accepts a UTF8-encoded std::string and returns a std::wstring.
Definition: utf8_tools.cpp:50

Here is the call graph for this function: