GED 2006 (C++)
File detail
Source code
/*
* File: gedplugin.h - Interface for plugins
* Project: GED - bitmap editor (ICP)
* Author: Kamil Dudka, xdudka00
* Team: xdudka00, xfilak01, xhefka00, xhradi08
* Created: 2006-04-04
*/
#ifndef GEDPLUGIN_H
#define GEDPLUGIN_H
#include <string>
#include <vector>
#include "framebuffer.h"
namespace GedPlugin {
/**
* Plugin core function
* \param fb Reference to FrameBuffer to work with.
* \param argList Vector of plugin arguments (same as main() arguments list)
* \return Return error-code, 0 if success.
*/
typedef int (*PluginCorePtr) (FrameBuffer &fb, std::vector<std::string> argList);
/**
* Plugin type enumeration
*/
enum PluginType {
TYPE_VOID = 0,
TYPE_FILEFORMAT, ///< plugin category "file format"
TYPE_FILTER ///< plugin category "filter"
};
/**
* Plugin Descrition. This is given as argument to Plugin::set() method.
*/
struct PluginDescription {
PluginType type; ///< plugin category
std::string name; ///< plugin name
PluginCorePtr pCore; ///< pointer to plugin core function
PluginDescription(): type(TYPE_VOID), pCore(0) { }
};
/**
* Plugin abstraction. This is needed for plugin code independency.
*/
class Plugin {
public:
/**
* Create plugin object.
* \param argc This is an argc argument of plugin's main() function.
* \param argv This is an argv argument of plugin's main() function.
*/
Plugin (int argc, char *argv[]);
~Plugin ();
/**
* Set plugin properties.
* \param desc Plugin description. Read PluginDescription documentation.
*/
void set (const PluginDescription &desc);
/**
* Execute plugin. (if ged wants to do this)
* \return Return plugin's exit-code, 0 means success.
* This value should be returned from plugin's main() function.
*/
int exec ();
private:
std::vector<std::string> _args;
PluginDescription _desc;
};
}
#endif // GEDPLUGIN_H