FireBreath  1.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Pages
JSFunction.h
1 /**********************************************************\
2  Original Author: Richard Bateman
3 
4  Created: Dec 20, 2010
5  License: Dual license model; choose one of two:
6  New BSD License
7  http://www.opensource.org/licenses/bsd-license.php
8  - or -
9  GNU Lesser General Public License, version 2.1
10  http://www.gnu.org/licenses/lgpl-2.1.html
11 
12  Copyright 2010 Richard Bateman, FaceBook inc, Firebreath development team
13  \**********************************************************/
14 
15 #pragma once
16 #ifndef JSFunction_h__
17 #define JSFunction_h__
18 
19 #include "JSAPIAuto.h"
20 
21 namespace FB {
22  FB_FORWARD_PTR(JSFunction);
23  class JSFunction : public FB::JSAPIAuto {
24  public:
25  JSFunction(const FB::JSAPIWeakPtr& obj, const std::wstring& func, const FB::SecurityZone);
26  JSFunction(const FB::JSAPIWeakPtr& obj, const std::string& func, const FB::SecurityZone);
27 
28  virtual bool HasMethodObject(const std::string& name) const { return false; }
29  virtual bool HasProperty(const std::string& propName) const;
30  virtual bool HasMethod(const std::string& methodName) const;
31  virtual variant Invoke(const std::string& methodName, const std::vector<variant>& args);
32  virtual variant exec(const std::vector<variant>& args);
33  virtual variant call(const std::vector<variant>& args);
34  virtual variant apply(const std::vector<variant>& args);
35 
36  private:
37  void init();
38 
39  protected:
40  const FB::JSAPIWeakPtr m_apiWeak;
41  const std::string m_methodName;
42  };
43 };
44 
45 #endif // JSFunction_h__
46 
virtual bool HasMethod(const std::wstring &methodName) const
Definition: JSAPI.h:287
virtual variant Invoke(const std::wstring &methodName, const std::vector< variant > &args)
Definition: JSAPI.h:489
boost::weak_ptr< FB::JSAPI > JSAPIWeakPtr
Defines an alias for a JSAPI weak_ptr (you should never use a JSAPI* directly)
Definition: APITypes.h:88
int SecurityZone
Used to set a SecurityZone for a method or property – used by JSAPIAuto.
Definition: APITypes.h:275
virtual bool HasMethodObject(const std::wstring &methodObjName) const
Definition: JSAPI.h:306
virtual bool HasProperty(int idx) const
Query if the property at "idx" exists.
Definition: JSAPIAuto.cpp:178
JSAPI class with automatic argument type enforcement.
Definition: JSAPIAuto.h:94