Gnash 0.8.10dev
ClassHierarchy.h
Go to the documentation of this file.
00001 // 
00002 //   Copyright (C) 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
00003 //
00004 // This program is free software; you can redistribute it and/or modify
00005 // it under the terms of the GNU General Public License as published by
00006 // the Free Software Foundation; either version 3 of the License, or
00007 // (at your option) any later version.
00008 //
00009 // This program is distributed in the hope that it will be useful,
00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 // GNU General Public License for more details.
00013 //
00014 // You should have received a copy of the GNU General Public License
00015 // along with this program; if not, write to the Free Software
00016 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00017 //
00018 
00019 #ifndef GNASH_CLASS_HIERARCHY_H
00020 #define GNASH_CLASS_HIERARCHY_H
00021 
00022 #ifdef HAVE_CONFIG_H
00023 #include "gnashconfig.h"
00024 #endif
00025 
00026 #include <string>
00027 #include <vector>
00028 #include <iosfwd>
00029 
00030 #include "ObjectURI.h"
00031 
00032 namespace gnash {
00033     class Extension;
00034     class as_object;
00035 }
00036 
00037 namespace gnash {
00038 
00040 class ClassHierarchy
00041 {
00042 public:
00043         struct ExtensionClass
00044         {
00046                 std::string file_name;
00047 
00056                 std::string init_name;
00057 
00058         const ObjectURI uri;
00059 
00061                 int version;
00062         };
00063 
00064         struct NativeClass
00065         {
00066                 
00068                 typedef void (*InitFunc)(as_object& obj, const ObjectURI& uri);
00069 
00070         NativeClass(InitFunc init, const ObjectURI& u, int ver)
00071             :
00072             initializer(init),
00073             uri(u),
00074             version(ver)
00075         {}
00076 
00080                 InitFunc initializer;
00081 
00083                 const ObjectURI uri;
00084 
00086                 int version;
00087         };
00088         
00092         ClassHierarchy(as_object* global, Extension* e)
00093         :
00094                 mGlobal(global),
00095         mExtension(e)
00096         {}
00097 
00100         ~ClassHierarchy();
00101 
00102     typedef std::vector<NativeClass> NativeClasses;
00103 
00110         bool declareClass(const NativeClass& c);
00111 
00113         void declareAll(const NativeClasses& classes);
00114 
00116         void markReachableResources() const {}
00117 
00118 private:
00119         as_object* mGlobal;
00120         Extension* mExtension;
00121 };
00122 
00123 } 
00124 #endif 
00125