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 #include <iosfwd>
30 
31 #include "ObjectURI.h"
32 
33 namespace gnash {
34  class Extension;
35  class as_object;
36 }
37 
38 namespace gnash {
39 
42 {
43 public:
45  {
47  std::string file_name;
48 
57  std::string init_name;
58 
59  const ObjectURI uri;
60 
62  int version;
63  };
64 
65  struct NativeClass
66  {
67 
69  typedef void (*InitFunc)(as_object& obj, const ObjectURI& uri);
70 
71  NativeClass(InitFunc init, const ObjectURI& u, int ver)
72  :
73  initializer(init),
74  uri(u),
75  version(ver)
76  {}
77 
82 
84  const ObjectURI uri;
85 
87  int version;
88  };
89 
94  :
95  mGlobal(global),
96  mExtension(e)
97  {}
98 
101  ~ClassHierarchy();
102 
103  typedef std::vector<NativeClass> NativeClasses;
104 
111  bool declareClass(const NativeClass& c);
112 
114  void declareAll(const NativeClasses& classes);
115 
117  void markReachableResources() const {}
118 
119 private:
120  as_object* mGlobal;
121  Extension* mExtension;
122 };
123 
124 }
125 #endif
126