00001 /* 00002 * File: pluginsuppport.h - Maintain plugins 00003 * Project: GED - bitmap editor (ICP) 00004 * Author: Kamil Dudka, xdudka00 00005 * Team: xdudka00, xfilak01, xhefka00, xhradi08 00006 * Created: 2006-04-06 00007 */ 00008 00009 #ifndef PLUGINSUPPORT_H 00010 #define PLUGINSUPPORT_H 00011 00012 #include <string> 00013 #include <map> 00014 00015 #include "framebuffer.h" 00016 00020 class PluginList { 00021 public: 00022 ~PluginList (); 00023 00028 static PluginList *ptr(); 00029 00034 static void destroy(); 00035 00041 void pluginDirLookup (const char *szDirectory); 00042 00051 void callByName (FrameBuffer &fb, std::string pluginName, std::string args); 00052 00056 struct ErrPluginDir { }; 00057 00061 struct ErrPluginNotFound { }; 00062 00066 struct ErrPluginEC { 00067 int iErrCode; 00068 00073 ErrPluginEC (int i) { iErrCode = i; } 00074 }; 00075 00076 friend class DocMenu; 00077 00078 protected: 00082 PluginList () { } 00083 00084 private: 00085 static PluginList *_instance; 00086 std::map<std::string, std::string> _pluginNameMap; 00087 00093 void addPluginFile (std::string &fileName); 00094 00101 void invokePlugin (FrameBuffer &fb, std::string &fileName, std::string &args); 00102 }; 00103 00104 00108 class SharedObject { 00109 public: 00113 FrameBuffer *pFB() { return &_fb; } 00114 00118 int shmBitmap() { return _shmBitmap; } 00119 00125 static int create (FrameBuffer &fb); 00126 00131 static void destroy (int shmID); 00132 00138 static SharedObject *attach (int shmID); 00139 00144 static void detach (SharedObject *addr); 00145 00150 void bitmapAlloc (BoxSize &size); 00151 00155 void bitmapFree (); 00156 00161 Pixel *bitmapAttach (); 00162 00167 void detach (Pixel *addr); 00168 00169 private: 00170 FrameBuffer _fb; 00171 int _shmBitmap; 00172 00176 SharedObject(); 00177 }; 00178 00182 class SharedFrameBuffer: public FrameBuffer { 00183 public: 00188 SharedFrameBuffer (int shmID); 00189 00194 void commit (int shmID); 00195 }; 00196 00197 #endif // PLUGINSUPPORT_H
1.5.2