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