Wat
[potpourri.git] / include / core / Plugin.h
blob7ddc9172ac78d172081e7e813c87327e43c33283
1 // Copyright 2008 Brian Caine
3 // This file is part of Potpourri.
5 // Potpourri 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 // Potpourri is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTIBILITY of 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 Potpourri. If not, see <http://www.gnu.org/licenses/>.
19 // NOTES:
21 // A plugin system
23 #ifndef __PLUGIN_H
24 #define __PLUGIN_H
26 #include <string>
27 #include <vector>
28 #include <dlfcn.h>
30 #include "Variant.h"
32 namespace fragrant
34 const std::string PLUGIN_FUNC_NAME = "loadPluginPayload";
35 const std::string PLUGIN_INFO_NAME = "queryPlugin";
37 enum PluginType
39 PT_Audio,
40 PT_Graphics,
41 PT_Input,
42 PT_Media,
43 PT_Script,
44 PT_UI
47 struct PluginData
49 std::string name;
50 PluginType type;
51 std::string version;
52 std::vector<std::string> authors;
53 std::vector<std::string> requirements;
56 typedef PluginData (*plugin_query)();
57 typedef Variant* (*plugin_payload)();
59 class Plugin
61 public:
62 Plugin(std::string sofile);
63 ~Plugin();
65 PluginData getData();
66 std::string getDataString();
67 fragrant::Variant* getPayload();
69 private:
70 PluginData data;
72 void* lib;
73 plugin_payload payload;
74 fragrant::Variant* payload_v;
78 extern "C"
80 fragrant::PluginData queryPlugin();
81 fragrant::Variant* loadPluginPayload();
84 #endif