2 // Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Free Software
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.
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.
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
19 #ifndef GNASH_EXTENSION_H
20 #define GNASH_EXTENSION_H
25 #include <boost/tokenizer.hpp>
26 #include "sharedlib.h"
33 class DSOEXPORT Extension
35 typedef boost::char_separator
<char> Sep
;
36 typedef boost::tokenizer
< Sep
> Tok
;
42 Extension(const std::string
& dir
);
46 /// Scan a directory for Gnash modules
49 /// Scan the given directory for modules
51 /// @param dir The directory to scan.
52 bool scanDir(const std::string
& dir
);
54 /// Scan the plugins directory and attach any found modules to
57 /// @param where The as_object to which the modules should be
58 /// attached (usually the global object)
59 bool scanAndLoad(as_object
&where
);
61 /// Scan the given directory and attach any found modules to
64 /// @param where The as_object to which the modules should be
65 /// attached (usually the global object)
66 /// @param dir A directory to scan.
67 bool scanAndLoad(const std::string
& dir
, as_object
&where
);
69 // open a module, initialize the module within Gnash. Known function name.
70 bool initModuleWithFunc(const std::string
& module
, const std::string
& func
, as_object
&obj
);
71 bool initNewObject(as_object
&obj
);
75 /// Initialize the named module within Gnash
77 /// @param symbol The name of the module to find and
79 /// @param obj The object to attach the module to.
80 bool initModule(const std::string
& module
, as_object
&obj
);
83 std::vector
<std::string
> _modules
;
85 /// A map of loaded modules
86 std::map
<std::string
, SharedLib
*> _plugins
;
88 /// The default directory to search for modules.
89 std::string _pluginsdir
;
92 } // end of gnash namespace
99 // indent-tabs-mode: t