00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include <boost/lexical_cast.hpp>
00021 #include <boost/algorithm/string/predicate.hpp>
00022 #include "..\include\weiStorage.h"
00023
00024
00025 static char *iweStorage_xpm[] = {
00026
00027 "32 32 17 1",
00028 " c #020100",
00029 ". c #331c04",
00030 "X c #542f07",
00031 "o c #774810",
00032 "O c #ad670b",
00033 "+ c #ba7721",
00034 "@ c #f4a72f",
00035 "# c #c39952",
00036 "$ c #eeb355",
00037 "% c #fdd05f",
00038 "& c #fdd06f",
00039 "* c #dbba87",
00040 "= c #fce18f",
00041 "- c #feefae",
00042 "; c #fef8cf",
00043 ": c #fffffb",
00044 "> c None",
00045
00046 ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>",
00047 ">>>>>>>>>>>>>OOOOO.>>>>>>>>>>>>>",
00048 ">>>>>>>>>>OOO@$**#OOo.>>>>>>>>>>",
00049 ">>>>>>>OOO+#&-;-;;-&@OOo.>>>>>>>",
00050 ">>>>>OOO#$-;;-;*--;;-=$#OOo.>>>>",
00051 ">OOO+@$=-;-----#-----;;-=$+OO. >",
00052 ">O+#$===*&$$$##+##@##$$**=&$#+o ",
00053 ">O=;-==&=*=&===@&&&&==&*&&=-;&o ",
00054 ">O$&=-;-=*=====$&====&&&-;-=%@o ",
00055 ">O&&$$$=--==&&&$&&&&&---=$@@@@o ",
00056 ">O&=&&$$$$====%$&&=---%@@@$@%@X ",
00057 ">O&=&&&$$@@@$==&=-=%%@@@$%%%%@X ",
00058 ">O*==&&$$$@@@@@=-@@%@@%@%%%%%@X ",
00059 ">O*===&&$$$$@@@&&@@%%@%%%%%%%$X ",
00060 ">O*-=*=*&$$$@@@=%@%%@%%%%%%%%$o ",
00061 ">O-;-==*&&&$@@@&%@@%%%%%%%%&&$X ",
00062 ">O*;--==*&&$$$@&&%%%%%%%&&&&=%X ",
00063 ">o-;---*=&&&$$$*&%%%%&&&&&&&=%X ",
00064 ">O;:;--===&&&$$*&%%%&&&&&&=&=%X ",
00065 ">o*:;;---===&&$==%%%&&=&&====%X ",
00066 ">O;:;;;--=***&$==%&=&=&&&===-$. ",
00067 ">o-::;;;---==&&-=&&&&=======-&X ",
00068 ">O*::;;;;--==**--&=&=====----&X ",
00069 ">o;:;;:;;;--==*-=&====-==----&X ",
00070 ">o*:::;:;;---=*--&===--------*X ",
00071 ">Xo#*;;:::;---=--===-------&#o. ",
00072 "> .Xo#*;::;;-=;-==---;-%#oXX ",
00073 ">>> .Xo#-:;;-;-----&#oX. ",
00074 ">>>>>> .X##-;:--*#+X.. >>>>",
00075 ">>>>>>>> .o#*&#o.. >>>>>>",
00076 ">>>>>>>>>>> .... >>>>>>>>>",
00077 ">>>>>>>>>>>>>> >>>>>>>>>>>>"
00078 };
00079
00080 int iweStorage::lastId = 0;
00081
00082 iweStorage::iweStorage(void* handle ) :
00083 iwePlugin(handle)
00084 {
00085 }
00086
00087 iweStorage::~iweStorage(void)
00088 {
00089 }
00090
00091 void* iweStorage::GetInterface( const string& ifName )
00092 {
00093 if (iequals(ifName, "iwePlugin"))
00094 {
00095 return (void*)((iwePlugin*)this);
00096 }
00097 if (iequals(ifName, "iweStorage"))
00098 {
00099 return (void*)((iweStorage*)this);
00100 }
00101 return NULL;
00102 }
00103
00104 char** iweStorage::GetIcon()
00105 {
00106 return (char**)iweStorage_xpm;
00107 }
00108
00109 const string iweStorage::InterfaceName()
00110 {
00111 return "iweStorage";
00112 }
00113
00114 WeStringList iweStorage::InterfaceList()
00115 {
00116 WeStringList retval = iwePlugin::InterfaceList();
00117 retval.push_back("iweStorage");
00118 return retval;
00119 }
00120
00121 std::string iweStorage::GenerateID( string objType )
00122 {
00123 return lexical_cast<string>(++lastId);
00124 }
00125
00126 int iweStorage::Query( const string& objType, Operation op, const string& xmlData )
00127 {
00129 throw runtime_error("Not implemented");
00130 return -1;
00131 }
00132
00133 int iweStorage::Report( const string& repType, const string& xmlData, string& result )
00134 {
00136 throw runtime_error("Not implemented");
00137 return -1;
00138 }
00139
00140 int iweStorage::Delete( const string& objType, const string& xmlData )
00141 {
00142 return Query(objType, iweStorage::remove, xmlData);
00143 }
00144
00145 int iweStorage::TaskSave( const string& xmlData, Operation op )
00146 {
00148 return Query("task", op, xmlData);
00149 }
00150
00151 int iweStorage::DictionarySave( const string& xmlData, Operation op )
00152 {
00154 return Query("dict", op, xmlData);
00155 }
00156
00157 int iweStorage::AuthorizationSave( const string& xmlData, Operation op )
00158 {
00160 return Query("auth", op, xmlData);
00161 }
00162
00163 int iweStorage::SystemOptionsSave( const string& xmlData, Operation op )
00164 {
00166 return Query("sysopt", op, xmlData);
00167 }
00168
00169 int iweStorage::TaskReport( const string& xmlData, string& result )
00170 {
00171 int retval = Report("task", xmlData, result);
00173 return retval;
00174 }
00175
00176 int iweStorage::DictionaryReport( const string& xmlData, string& result )
00177 {
00178 int retval = Report("dict", xmlData, result);
00180 return retval;
00181 }
00182
00183 int iweStorage::AuthorizationReport( const string& xmlData, string& result )
00184 {
00185 int retval = Report("auth", xmlData, result);
00187 return retval;
00188 }
00189
00190 int iweStorage::SystemOptionsReport( const string& xmlData, string& result )
00191 {
00192 int retval = Report("sysopt", xmlData, result);
00194 return retval;
00195 }