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, ObjectURI u, int ver)
71  :
72  initializer(init),
73  uri(std::move(u)),
74  version(ver)
75  {}
76 
81 
83  const ObjectURI uri;
84 
86  int version;
87  };
88 
93  :
94  mGlobal(global)
95  {}
96 
100 
101  typedef std::vector<NativeClass> NativeClasses;
102 
109  bool declareClass(const NativeClass& c);
110 
112  void declareAll(const NativeClasses& classes);
113 
115  void markReachableResources() const {}
116 
117 private:
118  as_object* mGlobal;
119 };
120 
121 }
122 #endif
123 
gnash::ClassHierarchy::markReachableResources
void markReachableResources() const
Mark objects for garbage collector.
Definition: ClassHierarchy.h:115
gnash::as_object
The base class for all ActionScript objects.
Definition: as_object.h:162
as_object.h
ObjectURI.h
gnash::toObject
as_object * toObject(const as_value &v, VM &vm)
Convert an as_value to an object.
Definition: VM.cpp:457
gnash::getName
string_table::key getName(const ObjectURI &o)
Get the name element of an ObjectURI.
Definition: ObjectURI.h:116
gnash::ClassHierarchy::NativeClass::initializer
InitFunc initializer
Definition: ClassHierarchy.h:80
gnash::log_debug
void log_debug(StringType msg, Args... args)
Definition: log.h:301
gnash::PropFlags::onlySWF9Up
@ onlySWF9Up
Only visible by VM initialized for version 9 or higher.
Definition: PropFlags.h:57
_
#define _(String)
Definition: log.h:44
gnash
Anonymous namespace for callbacks, local functions, event handlers etc.
Definition: dbus_ext.cpp:41
gnash::key::g
@ g
Definition: GnashKey.h:153
gnash::PropFlags::dontEnum
@ dontEnum
Protect from enumeration.
Definition: PropFlags.h:36
as_value.h
gnash::ClassHierarchy::NativeClass::version
int version
The version at which this should be visible.
Definition: ClassHierarchy.h:86
Global_as.h
gnash::getGlobal
Global_as & getGlobal(const as_environment &env)
Definition: as_environment.cpp:651
gnash::getVM
VM & getVM(const as_environment &env)
Definition: as_environment.h:222
gnash::ClassHierarchy::declareAll
void declareAll(const NativeClasses &classes)
Declare a list of native classes.
Definition: ClassHierarchy.cpp:123
as_function.h
gnash::log_error
void log_error(StringType msg, Args... args)
Definition: log.h:283
gnash::ClassHierarchy::NativeClass::uri
const ObjectURI uri
The name of the class.
Definition: ClassHierarchy.h:83
gnash::as_object::init_destructive_property
bool init_destructive_property(const ObjectURI &uri, as_function &getter, int flags=PropFlags::dontEnum)
Initialize a destructive getter property.
Definition: as_object.cpp:720
gnash::renderer::opengl::for_each
void for_each(C &container, R(T::*pmf)(const A &), const A &arg)
Definition: Renderer_ogl.cpp:690
gnash::ClassHierarchy::NativeClass::InitFunc
void(* InitFunc)(as_object &obj, const ObjectURI &uri)
The type of function to use for initialization.
Definition: ClassHierarchy.h:68
gnash::ClassHierarchy::declareClass
bool declareClass(const NativeClass &c)
Definition: ClassHierarchy.cpp:112
extension.h
gnash::key::_1
@ _1
Definition: GnashKey.h:95
gnash::PropFlags::onlySWF8Up
@ onlySWF8Up
Only visible by VM initialized for version 8 or higher.
Definition: PropFlags.h:54
gnash::ClassHierarchy::ExtensionClass::version
int version
The version at which this should be added.
Definition: ClassHierarchy.h:61
gnash::ClassHierarchy::ClassHierarchy
ClassHierarchy(as_object *global)
Definition: ClassHierarchy.h:92
gnash::ClassHierarchy::ExtensionClass::uri
const ObjectURI uri
Definition: ClassHierarchy.h:58
gnash::PropFlags::onlySWF7Up
@ onlySWF7Up
Only visible by VM initialized for version 7 or higher.
Definition: PropFlags.h:51
gnash::ClassHierarchy::NativeClass
Definition: ClassHierarchy.h:65
ClassHierarchy.h
gnash::PropFlags::onlySWF6Up
@ onlySWF6Up
Only visible by VM initialized for version 6 or higher.
Definition: PropFlags.h:45
gnash::ClassHierarchy::NativeClass::NativeClass
NativeClass(InitFunc init, ObjectURI u, int ver)
Definition: ClassHierarchy.h:70
gnash::key::f
@ f
Definition: GnashKey.h:152
gnashconfig.h
namedStrings.h
PropFlags.h
gnash::key::c
@ c
Definition: GnashKey.h:149
gnash::getStringTable
string_table & getStringTable(const as_environment &env)
Definition: as_environment.cpp:639
gnash::ClassHierarchy::ExtensionClass
Definition: ClassHierarchy.h:44
gnash::ClassHierarchy
Register all of the ActionScript classes, with their dependencies.
Definition: ClassHierarchy.h:41
gnash::ClassHierarchy::NativeClasses
std::vector< NativeClass > NativeClasses
Definition: ClassHierarchy.h:101
gnash::key::u
@ u
Definition: GnashKey.h:167
gnash::ObjectURI
A URI for describing as_objects.
Definition: ObjectURI.h:45
gnash::ClassHierarchy::ExtensionClass::file_name
std::string file_name
The filename for the library relative to the plugins directory.
Definition: ClassHierarchy.h:46
gnash::ClassHierarchy::~ClassHierarchy
~ClassHierarchy()
Delete our private namespaces.
Definition: ClassHierarchy.cpp:107
gnash::as_function
ActionScript Function, either builtin or SWF-defined.
Definition: as_function.h:63
gnash::ClassHierarchy::ExtensionClass::init_name
std::string init_name
Definition: ClassHierarchy.h:56