Gnash  0.8.11dev
ClassHierarchy.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012
3 // Free Software Foundation, Inc.
4 //
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 3 of the License, or
8 // (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 //
19 
20 #ifndef GNASH_CLASS_HIERARCHY_H
21 #define GNASH_CLASS_HIERARCHY_H
22 
23 #ifdef HAVE_CONFIG_H
24 #include "gnashconfig.h"
25 #endif
26 
27 #include <string>
28 #include <vector>
29 
30 #include "ObjectURI.h"
31 
32 namespace gnash {
33  class Extension;
34  class as_object;
35 }
36 
37 namespace gnash {
38 
41 {
42 public:
44  {
46  std::string file_name;
47 
56  std::string init_name;
57 
58  const ObjectURI uri;
59 
61  int version;
62  };
63 
64  struct NativeClass
65  {
66 
68  typedef void (*InitFunc)(as_object& obj, const ObjectURI& uri);
69 
70  NativeClass(InitFunc init, const ObjectURI& u, int ver)
71  :
72  initializer(init),
73  uri(u),
74  version(ver)
75  {}
76 
81 
83  const ObjectURI uri;
84 
86  int version;
87  };
88 
93  :
94  mGlobal(global),
95  mExtension(e)
96  {}
97 
100  ~ClassHierarchy();
101 
102  typedef std::vector<NativeClass> NativeClasses;
103 
110  bool declareClass(const NativeClass& c);
111 
113  void declareAll(const NativeClasses& classes);
114 
116  void markReachableResources() const {}
117 
118 private:
119  as_object* mGlobal;
120  Extension* mExtension;
121 };
122 
123 }
124 #endif
125 
~ClassHierarchy()
Delete our private namespaces.
Definition: ClassHierarchy.cpp:107
Definition: GnashKey.h:167
void declareAll(const NativeClasses &classes)
Declare a list of native classes.
Definition: ClassHierarchy.cpp:123
void markReachableResources() const
Mark objects for garbage collector.
Definition: ClassHierarchy.h:116
bool declareClass(const NativeClass &c)
Definition: ClassHierarchy.cpp:112
Definition: GnashKey.h:149
The base class for all ActionScript objects.
Definition: as_object.h:161
Definition: ClassHierarchy.h:43
Register all of the ActionScript classes, with their dependencies.
Definition: ClassHierarchy.h:40
A URI for describing as_objects.
Definition: ObjectURI.h:44
int version
The version at which this should be added.
Definition: ClassHierarchy.h:61
InitFunc initializer
Definition: ClassHierarchy.h:80
void
Definition: npapi/plugin.cpp:1286
const ObjectURI uri
Definition: ClassHierarchy.h:58
NativeClass(InitFunc init, const ObjectURI &u, int ver)
Definition: ClassHierarchy.h:70
std::string file_name
The filename for the library relative to the plugins directory.
Definition: ClassHierarchy.h:46
void(* InitFunc)(as_object &obj, const ObjectURI &uri)
The type of function to use for initialization.
Definition: ClassHierarchy.h:68
ClassHierarchy(as_object *global, Extension *e)
Definition: ClassHierarchy.h:92
Definition: GnashKey.h:151
int version
The version at which this should be visible.
Definition: ClassHierarchy.h:86
std::string init_name
Definition: ClassHierarchy.h:56
Definition: ClassHierarchy.h:64
std::vector< NativeClass > NativeClasses
Definition: ClassHierarchy.h:102
const ObjectURI uri
The name of the class.
Definition: ClassHierarchy.h:83
Definition: extension.h:37