FireBreath  1.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Pages
JSFakeArray.h
1 /**********************************************************\
2 Original Author: Georg Fritzsche
3 
4 Created: December 13, 2009
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 2009 Georg Fritzsche, Firebreath development team
13 \**********************************************************/
14 
15 #pragma once
16 #ifndef H_JSFAKEARRAY
17 #define H_JSFAKEARRAY
18 
19 #include "../JSObject.h"
20 #include "../JSAPIAuto.h"
21 
22 namespace FB
23 {
24  class JSFakeArray : public JSAPIAuto
25  {
26  public:
27  JSFakeArray();
28  explicit JSFakeArray(const FB::JSObjectPtr& obj);
29  explicit JSFakeArray(const FB::VariantList& values);
30 
31  FB::variant GetProperty(int index);
32  using FB::JSAPIAuto::GetProperty; // unhide GetProperty(std::string)
33  size_t GetLength() const;
34 
35  FB::variant& operator[](size_t index);
36  const FB::variant& operator[](size_t index) const;
37 
38  FB::VariantList& Values();
39  const FB::VariantList& Values() const;
40 
41  private:
42  void RegisterMethods();
43  void ExtractList(const FB::JSObjectPtr&);
44 
45  FB::VariantList m_values;
46  };
47 }
48 
49 #endif
50 
boost::shared_ptr< FB::JSObject > JSObjectPtr
Defines an alias representing a JSObject shared_ptr (you should never use a JSObject* directly) ...
Definition: APITypes.h:109
Accepts any datatype, used in all interactions with javascript. Provides tools for getting back out t...
Definition: variant.h:198
std::vector< variant > VariantList
Defines an alias representing list of variants.
Definition: APITypes.h:64
virtual variant GetProperty(const std::string &propertyName)
Gets a property value.
Definition: JSAPIAuto.cpp:191