Lunchbox  1.8.0
pluginRegistry.h
1 
2 /* Copyright (c) 2010, Cedric Stalder <cedric.stalder@gmail.com>
3  * 2010-2013, Stefan Eilemann <eile@eyescale.ch>
4  *
5  * This file is part of Lunchbox <https://github.com/Eyescale/Lunchbox>
6  *
7  * This library is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU Lesser General Public License version 2.1 as published
9  * by the Free Software Foundation.
10  *
11  * This library is distributed in the hope that it will be useful, but WITHOUT
12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13  * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
14  * details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this library; if not, write to the Free Software Foundation, Inc.,
18  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19  */
20 
21 #ifndef LUNCHBOX_PLUGINREGISTRY_H
22 #define LUNCHBOX_PLUGINREGISTRY_H
23 
24 #include <lunchbox/api.h>
25 #include <lunchbox/nonCopyable.h> // base class
26 #include <lunchbox/types.h>
27 #include <lunchbox/visitorResult.h> // enum
28 #include <string>
29 
30 namespace lunchbox
31 {
32 namespace detail { class PluginRegistry; }
33 
43 {
44 public:
46  LUNCHBOX_API PluginRegistry();
47 
49  LUNCHBOX_API ~PluginRegistry();
50 
56  LUNCHBOX_API void addDirectory( const std::string& path );
57 
59  LUNCHBOX_API void removeDirectory( const std::string& path );
60 
66  LUNCHBOX_API const Strings& getDirectories() const;
67 
73  LUNCHBOX_API bool addLunchboxPlugins();
74 
76  LUNCHBOX_API void init();
77 
79  LUNCHBOX_API void exit();
80 
89  LUNCHBOX_API VisitorResult accept( PluginVisitor& visitor );
90 
92  LUNCHBOX_API VisitorResult accept( ConstPluginVisitor& visitor ) const;
93 
95  LUNCHBOX_API const Plugins& getPlugins() const;
96 
98  LUNCHBOX_API Plugin* findPlugin( const uint32_t name );
99 
101  LUNCHBOX_API const Plugin* findPlugin( const uint32_t name ) const;
102 
104  LUNCHBOX_API bool addPlugin( const std::string& filename );
105 
106 private:
107  detail::PluginRegistry* const impl_;
108 };
109 }
110 #endif // LUNCHBOX_PLUGINREGISTRY_H