Gnash  0.8.10
extension.h
Go to the documentation of this file.
00001 // 
00002 //   Copyright (C) 2005, 2006, 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 #ifndef GNASH_EXTENSION_H
00020 #define GNASH_EXTENSION_H
00021 
00022 #include <map>
00023 #include <vector>
00024 #include <string>
00025 #include <boost/tokenizer.hpp>
00026 #include "dsodefs.h"
00027 
00028 namespace gnash {
00029     class SharedLib;
00030     class as_object;
00031 }
00032 
00033 
00034 namespace gnash 
00035 {  
00036   
00037 class DSOEXPORT Extension
00038 {
00039     typedef boost::char_separator<char> Sep;
00040     typedef boost::tokenizer< Sep > Tok;
00041       
00042 public:
00043 
00044     Extension();
00045 
00046     Extension(const std::string& dir);
00047 
00048     ~Extension() {}
00049 
00051     bool scanDir();
00052 
00054     //
00056     bool scanDir(const std::string& dir);
00057 
00060     //
00063     bool scanAndLoad(as_object &where);
00064 
00067     //
00071     bool scanAndLoad(const std::string& dir, as_object &where);
00072 
00073     // open a module, initialize the module within Gnash. Known function name.
00074     bool initModuleWithFunc(const std::string& module, const std::string& func, as_object &obj);
00075     bool initNewObject(as_object &obj);
00076     void dumpModules();
00077 protected:
00078 
00080     //
00084     bool initModule(const std::string& module, as_object &obj);
00085 
00087     std::vector<std::string> _modules;
00088     
00090     std::map<std::string, SharedLib *> _plugins;
00091     
00093     std::string _pluginsdir;
00094 };
00095 
00096 } // end of gnash namespace
00097 
00098 // GNASH_EXTENSION_H
00099 #endif
00100 
00101 // Local Variables:
00102 // mode: C++
00103 // indent-tabs-mode: t
00104 // End: