00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef __INTERFACE_H__
00022 #define __INTERFACE_H__
00023
00024 #include <map>
00025 #include <util/propertyList.h>
00026 #include <boost/tuple/tuple.hpp>
00027
00028 namespace Spm
00029 {
00030 namespace Plugin
00031 {
00032 typedef enum
00033 {
00034 GPL = 0,
00035 LGPL = 1,
00036 BSD = 2,
00037 NOT_FREE = 3
00038 } license_e;
00039 typedef enum
00040 {
00041 INTERFACE_TYPE,
00042 DOWNLOAD_TYPE,
00043 STEP_TYPE,
00044 INSTALLER_TYPE,
00045 INFO_TYPE,
00046 } pluginType_e;
00047
00048 const int OPTION_NO_VALUE = 0;
00049 const int OPTION_VALUE_NOT_MANDATORY = 1;
00050 const int OPTION_VALUE_MANDATORY = 2;
00051
00056 typedef struct
00057 {
00058 miniXml::ustring pluginName_;
00059 miniXml::ustring pluginDescription_;
00060 miniXml::ustring pluginAuthor_;
00061 miniXml::ustring pluginVersion_;
00062 license_e pluginLicense_;
00063 pluginType_e pluginType_;
00064 std::map<miniXml::ustring,
00065 boost::tuple<miniXml::ustring,
00066 int,
00067 Util::PropertyList::propertyType_e> > options_;
00068 } pluginDescription_t;
00069
00074 class Interface
00075 {
00076 public :
00077 friend class Plugin;
00078 typedef enum {INITIALIZATION,
00079 RUNNING,
00080 ENDED,
00081 FAILED} state_e;
00082 protected :
00083 pluginDescription_t description_;
00084
00085 Util::PropertyList options_;
00086 state_e currentState_;
00087
00088 Interface ()
00089 {
00090 }
00091
00092 Interface (const Util::PropertyList & pList) : options_(pList),
00093 currentState_(INITIALIZATION)
00094 {
00095 }
00096
00097 virtual void initInfo () = 0;
00098
00099 public :
00100 virtual ~Interface (){};
00101
00105 inline const pluginDescription_t & getDescription ()
00106 {
00107 return description_;
00108 }
00109
00113 state_e getState ()
00114 {
00115 return currentState_;
00116 }
00117
00121 state_e getState () const
00122 {
00123 return currentState_;
00124 }
00125 };
00126 }
00127 }
00128
00129 #endif