Changeset 1166:323375b3253d
- Timestamp:
- 02/22/09 18:12:08 (3 years ago)
- Branch:
- libdodo
- Files:
-
- 61 edited
-
trunk/include/libdodo/cgi.h (modified) (3 diffs)
-
trunk/include/libdodo/cgiBasicExchange.h (modified) (1 diff)
-
trunk/include/libdodo/cgiDialogue.h (modified) (2 diffs)
-
trunk/include/libdodo/cgiExchange.h (modified) (1 diff)
-
trunk/include/libdodo/cgiFastExchange.h (modified) (1 diff)
-
trunk/include/libdodo/cgiFastServer.h (modified) (1 diff)
-
trunk/include/libdodo/dataBaseConnector.h (modified) (2 diffs)
-
trunk/include/libdodo/dataFormatXmlNode.h (modified) (1 diff)
-
trunk/include/libdodo/dataFormatXmlProcessor.h (modified) (2 diffs)
-
trunk/include/libdodo/exceptionBasic.h (modified) (12 diffs)
-
trunk/include/libdodo/ioChannel.h (modified) (4 diffs)
-
trunk/include/libdodo/ioEvent.h (modified) (1 diff)
-
trunk/include/libdodo/ioFileFifo.h (modified) (2 diffs)
-
trunk/include/libdodo/ioFileRegular.h (modified) (1 diff)
-
trunk/include/libdodo/ioFileTemp.h (modified) (1 diff)
-
trunk/include/libdodo/ioMemory.h (modified) (2 diffs)
-
trunk/include/libdodo/ioNetworkExchange.h (modified) (2 diffs)
-
trunk/include/libdodo/ioNetworkSslExchange.h (modified) (2 diffs)
-
trunk/include/libdodo/ioPipe.h (modified) (1 diff)
-
trunk/include/libdodo/ioStdio.h (modified) (1 diff)
-
trunk/include/libdodo/pcSyncProcessDataCollection.h (modified) (1 diff)
-
trunk/include/libdodo/pcSyncThreadDataCollection.h (modified) (1 diff)
-
trunk/include/libdodo/toolsLogger.h (modified) (1 diff)
-
trunk/include/libdodo/toolsTime.h (modified) (2 diffs)
-
trunk/include/libdodo/types.h (modified) (1 diff)
-
trunk/src/cgiBasicExchange.cc (modified) (2 diffs)
-
trunk/src/cgiDialogue.cc (modified) (1 diff)
-
trunk/src/cgiExchange.cc (modified) (1 diff)
-
trunk/src/cgiFastExchange.cc (modified) (2 diffs)
-
trunk/src/dataBasePostgresql.cc (modified) (2 diffs)
-
trunk/src/dataBaseSqlConstructor.cc (modified) (1 diff)
-
trunk/src/dataBaseSqlite.cc (modified) (4 diffs)
-
trunk/src/dataFormatJsonProcessor.cc (modified) (7 diffs)
-
trunk/src/dataTplProcessor.cc (modified) (2 diffs)
-
trunk/src/ioChannel.cc (modified) (1 diff)
-
trunk/src/ioFileFifo.cc (modified) (7 diffs)
-
trunk/src/ioFileRegular.cc (modified) (8 diffs)
-
trunk/src/ioFileTemp.cc (modified) (3 diffs)
-
trunk/src/ioMemory.cc (modified) (3 diffs)
-
trunk/src/ioNetworkClient.cc (modified) (1 diff)
-
trunk/src/ioNetworkConnection.cc (modified) (2 diffs)
-
trunk/src/ioNetworkExchange.cc (modified) (3 diffs)
-
trunk/src/ioNetworkHttp.cc (modified) (4 diffs)
-
trunk/src/ioNetworkServer.cc (modified) (2 diffs)
-
trunk/src/ioNetworkSslClient.cc (modified) (4 diffs)
-
trunk/src/ioNetworkSslExchange.cc (modified) (5 diffs)
-
trunk/src/ioNetworkSslServer.cc (modified) (5 diffs)
-
trunk/src/ioPipe.cc (modified) (3 diffs)
-
trunk/src/ioStdio.cc (modified) (2 diffs)
-
trunk/src/pcProcessCollection.cc (modified) (1 diff)
-
trunk/src/pcSyncProtector.cc (modified) (2 diffs)
-
trunk/src/pcThreadCollection.cc (modified) (1 diff)
-
trunk/src/rpcJsonValue.cc (modified) (2 diffs)
-
trunk/src/rpcXmlValue.cc (modified) (1 diff)
-
trunk/src/toolsCode.cc (modified) (9 diffs)
-
trunk/src/toolsFilesystem.cc (modified) (6 diffs)
-
trunk/src/toolsNetwork.cc (modified) (2 diffs)
-
trunk/src/toolsOs.cc (modified) (10 diffs)
-
trunk/src/toolsTime.cc (modified) (2 diffs)
-
trunk/src/xexec.cc (modified) (1 diff)
-
uncrustify/.uncrustify.cfg (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/libdodo/cgi.h
r1164 r1166 214 214 */ 215 215 __cgiCookie(const dodoString &name, 216 const dodoString &value,217 const dodoString &exDate,218 const dodoString &path,219 const dodoString &domain,220 bool secure);221 222 dodoString name; ///< name of the cookie223 dodoString value; ///< value of the cookie224 225 dodoString expires; ///< expiration date226 dodoString path; ///< cookie path227 dodoString domain; ///< cookie domain228 bool secure; ///< defines cookie security; false by default216 const dodoString &value, 217 const dodoString &exDate, 218 const dodoString &path, 219 const dodoString &domain, 220 bool secure); 221 222 dodoString name; ///< name of the cookie 223 dodoString value; ///< value of the cookie 224 225 dodoString expires; ///< expiration date 226 dodoString path; ///< cookie path 227 dodoString domain; ///< cookie domain 228 bool secure; ///< defines cookie security; false by default 229 229 }; 230 230 … … 236 236 CGI_REQUESTMETHOD_GET, 237 237 CGI_REQUESTMETHOD_POST, 238 CGI_REQUESTMETHOD_GET_POST ///< if POST method and request Url also contains ?name=value&.... format data238 CGI_REQUESTMETHOD_GET_POST ///< if POST method and request Url also contains ?name=value&.... format data 239 239 }; 240 240 … … 255 255 struct __cgiAuthInfo 256 256 { 257 dodoString user; ///< user name258 short type; ///< authenfication type[see cgiAuthTypeEnum]257 dodoString user; ///< user name 258 short type; ///< authenfication type[see cgiAuthTypeEnum] 259 259 }; 260 260 }; -
trunk/include/libdodo/cgiBasicExchange.h
r1160 r1166 62 62 /** 63 63 * constructor 64 * @param protection defines type of IO protection[see channelProtectionTypeEnum] 64 65 */ 65 exchange( );66 exchange(short protection = io::CHANNEL_PROTECTION_PROCESS); 66 67 67 68 /** -
trunk/include/libdodo/cgiDialogue.h
r1164 r1166 93 93 * @param postFilesTmpDir defines directory for POST files if on they are saved on the disk 94 94 */ 95 dialogue(exchange &cf,96 bool silent = false,97 bool autocleanFiles = true,98 bool postFilesInMem = true,95 dialogue(exchange &cf, 96 bool silent = false, 97 bool autocleanFiles = true, 98 bool postFilesInMem = true, 99 99 dodoString postFilesTmpDir = "/tmp/"); 100 100 … … 108 108 * @param postFilesTmpDir defines directory for POST files if on they are saved on the disk 109 109 */ 110 dialogue(exchange &cf,110 dialogue(exchange &cf, 111 111 dodoMap<short, dodoString> &headers, 112 bool silent = false,113 bool autocleanFiles = true,114 bool postFilesInMem = true,115 dodoString postFilesTmpDir = "/tmp/");112 bool silent = false, 113 bool autocleanFiles = true, 114 bool postFilesInMem = true, 115 dodoString postFilesTmpDir = "/tmp/"); 116 116 117 117 /** -
trunk/include/libdodo/cgiExchange.h
r1160 r1166 49 49 50 50 /** 51 * constructor 52 */ 53 exchange(short protection); 54 55 /** 51 56 * destructor 52 57 */ -
trunk/include/libdodo/cgiFastExchange.h
r1161 r1166 67 67 * constructor 68 68 * @param request defines CGI request descriptor 69 * @param protection defines type of IO protection[see channelProtectionTypeEnum] 69 70 */ 70 exchange(FCGX_Request *request); 71 exchange(FCGX_Request *request, 72 short protection = io::CHANNEL_PROTECTION_PROCESS); 71 73 72 74 /** -
trunk/include/libdodo/cgiFastServer.h
r1164 r1166 82 82 */ 83 83 server(unsigned long limit = 0, 84 bool threading = true,85 unsigned int threadsNum = 10);84 bool threading = true, 85 unsigned int threadsNum = 10); 86 86 87 87 #else -
trunk/include/libdodo/dataBaseConnector.h
r1164 r1166 82 82 */ 83 83 __tuples(dodoArray<dodoStringArray> rows, 84 dodoStringArray fields);84 dodoStringArray fields); 85 85 86 86 /** … … 114 114 */ 115 115 __connectionInfo(const dodoString &db, 116 const dodoString &host,117 const dodoString &user,118 const dodoString &password,119 const dodoString &path = __dodostring__,120 int port = 0);121 122 dodoString db; ///< database name123 dodoString host; ///< hostname124 dodoString user; ///< username125 dodoString password; ///< password126 dodoString path; ///< path to db or unix socket127 unsigned int port; ///< port116 const dodoString &host, 117 const dodoString &user, 118 const dodoString &password, 119 const dodoString &path = __dodostring__, 120 int port = 0); 121 122 dodoString db; ///< database name 123 dodoString host; ///< hostname 124 dodoString user; ///< username 125 dodoString password; ///< password 126 dodoString path; ///< path to db or unix socket 127 unsigned int port; ///< port 128 128 }; 129 129 -
trunk/include/libdodo/dataFormatXmlNode.h
r1164 r1166 94 94 * @param ns defines node namespace 95 95 */ 96 node(const dodoString &name,96 node(const dodoString &name, 97 97 const dodoStringMap &attributes, 98 const dodoString &value,99 const dodoString &ns = __dodostring__);98 const dodoString &value, 99 const dodoString &ns = __dodostring__); 100 100 101 101 /** -
trunk/include/libdodo/dataFormatXmlProcessor.h
r1164 r1166 68 68 */ 69 69 __nodeDef(const dodoString &name, 70 const dodoString &ns = __dodostring__);70 const dodoString &ns = __dodostring__); 71 71 72 72 dodoString name; ///< name of the node [[tag]]; if empty - for first - gets root, for children - all[but if children do not have in definition own children] … … 97 97 */ 98 98 __info(const dodoString &version, 99 const dodoString &encoding,100 const dodoString &root,101 int compression);99 const dodoString &encoding, 100 const dodoString &root, 101 int compression); 102 102 103 103 dodoString version; ///< version of XML document -
trunk/include/libdodo/exceptionBasic.h
r1163 r1166 143 143 }; 144 144 145 #define BASEEX_MODULES 51145 #define BASEEX_MODULES 51 146 146 147 147 #ifdef DL_EXT … … 153 153 struct __basicMod 154 154 { 155 char name[64]; ///< name of the library155 char name[64]; ///< name of the library 156 156 char discription[256]; ///< discription of the library 157 char hook[64]; ///< name of the function in module that will be as a hook158 short module; ///< for what module handler should be set[see errorModuleEnum]157 char hook[64]; ///< name of the function in module that will be as a hook 158 short module; ///< for what module handler should be set[see errorModuleEnum] 159 159 }; 160 160 … … 193 193 struct __call 194 194 { 195 dodoString object; ///< name of the object where call was found196 dodoString symbol; ///< name of the call197 void *address;///< address of the call195 dodoString object; ///< name of the object where call was found 196 dodoString symbol; ///< name of the call 197 void *address; ///< address of the call 198 198 }; 199 199 … … 229 229 * @param message defines custom message that might clarify the exception 230 230 */ 231 basic(int errModule,232 int functionID,233 int errnoSource,234 int baseErrno,231 basic(int errModule, 232 int functionID, 233 int errnoSource, 234 int baseErrno, 235 235 const dodoString &baseErrstr, 236 unsigned long line,236 unsigned long line, 237 237 const dodoString &file, 238 238 const dodoString &message = __dodostring__) throw (); … … 262 262 #endif 263 263 264 int errModule; ///< module where exception has been thrown265 int funcID; ///< function where exception has been thrown[see *Ex.h headers for IDs]266 int errnoSource; ///< the source of the error code and of the error string267 268 int baseErrno; ///< error code269 dodoString baseErrstr; ///< error string270 271 unsigned long line; ///< line where exception has been thrown272 dodoString file; ///< file where exception has been thrown273 274 dodoString message; ///< custom message that might clarify the exception264 int errModule; ///< module where exception has been thrown 265 int funcID; ///< function where exception has been thrown[see *Ex.h headers for IDs] 266 int errnoSource; ///< the source of the error code and of the error string 267 268 int baseErrno; ///< error code 269 dodoString baseErrstr; ///< error string 270 271 unsigned long line; ///< line where exception has been thrown 272 dodoString file; ///< file where exception has been thrown 273 274 dodoString message; ///< custom message that might clarify the exception 275 275 276 276 #ifdef CALLSTACK_EX 277 277 278 dodoArray<__call> callStack; ///< call stack of the raised exception278 dodoArray<__call> callStack; ///< call stack of the raised exception 279 279 280 280 #endif … … 287 287 */ 288 288 static void setErrorHandler(errorModuleEnum module, 289 errorHandler handler,290 void *data);289 errorHandler handler, 290 void *data); 291 291 292 292 /** … … 296 296 */ 297 297 static void setErrorHandlers(errorHandler handler, 298 void *data);298 void *data); 299 299 300 300 /** … … 317 317 */ 318 318 static __basicMod getModuleInfo(const dodoString &path, 319 void *toInit = NULL);319 void *toInit = NULL); 320 320 321 321 /** … … 328 328 */ 329 329 static bool setErrorHandler(const dodoString &path, 330 void *data,331 void *toInit = NULL);330 void *data, 331 void *toInit = NULL); 332 332 333 333 /** … … 339 339 */ 340 340 static bool setErrorHandlers(const dodoString &path, 341 void *data,342 void *toInit = NULL);341 void *data, 342 void *toInit = NULL); 343 343 344 344 #endif … … 348 348 static errorHandler handlersEx[BASEEX_MODULES]; ///< exception handlers 349 349 350 static bool handlerSetEx[BASEEX_MODULES]; ///< map of set handlers351 352 static void *handlerDataEx[BASEEX_MODULES]; ///< data that will be passed to the handler350 static bool handlerSetEx[BASEEX_MODULES]; ///< map of set handlers 351 352 static void *handlerDataEx[BASEEX_MODULES]; ///< data that will be passed to the handler 353 353 354 354 #ifdef DL_EXT 355 355 356 static void *handlesEx[BASEEX_MODULES]; ///< handles to the libraries357 358 static bool handlesOpenedEx[BASEEX_MODULES]; ///< map of the opened libraries356 static void *handlesEx[BASEEX_MODULES]; ///< handles to the libraries 357 358 static bool handlesOpenedEx[BASEEX_MODULES]; ///< map of the opened libraries 359 359 360 360 #endif … … 392 392 #ifdef PTHREAD_EXT 393 393 394 static pthread_mutex_t keeper; ///< mutex394 static pthread_mutex_t keeper; ///< mutex 395 395 396 396 #endif 397 397 }; 398 398 399 static syncThreadSection keeper; ///< lock399 static syncThreadSection keeper; ///< lock 400 400 401 401 /** -
trunk/include/libdodo/ioChannel.h
r1164 r1166 37 37 #include <libdodo/ioEventInfo.h> 38 38 #include <libdodo/pcSyncProcessSection.h> 39 #include <libdodo/pcSyncThreadSection.h> 39 40 #include <libdodo/pcSyncProtector.h> 40 41 … … 44 45 { 45 46 /** 46 * @enum exchangeOperationTypeEnum describes type of operation for hook 47 * @enum channelProtectionTypeEnum defines type of protection for io objects 48 * in IO interaction in parallel environment 47 49 */ 48 enum exchangeOperationTypeEnum 50 enum channelProtectionTypeEnum 51 { 52 CHANNEL_PROTECTION_NONE, 53 CHANNEL_PROTECTION_THREAD, 54 CHANNEL_PROTECTION_PROCESS 55 }; 56 /** 57 * @enum ioOperationTypeEnum describes type of operation for hook 58 */ 59 enum ioOperationTypeEnum 49 60 { 50 61 IO_OPERATION_READ, … … 95 106 /** 96 107 * constructor 108 * @param protection defines type of IO protection[see channelProtectionTypeEnum] 97 109 */ 98 channel( );110 channel(short protection); 99 111 100 112 /** … … 167 179 #ifndef IO_WO_XEXEC 168 180 169 __xexecIoChannelCollectedData collectedData; ///< data collected for xexec181 __xexecIoChannelCollectedData collectedData; ///< data collected for xexec 170 182 171 183 #endif 172 pc::sync::section *keeper; ///< section locker 184 pc::sync::section *keeper; ///< section locker 185 short protection; ///< type of IO protection[see channelProtectionTypeEnum] 173 186 }; 174 187 }; -
trunk/include/libdodo/ioEvent.h
r1161 r1166 139 139 int descs; ///< descriptors counter 140 140 141 pc::sync::section *keeper; ///< section locker141 pc::sync::section *keeper; ///< section locker 142 142 }; 143 143 }; -
trunk/include/libdodo/ioFileFifo.h
r1164 r1166 83 83 /** 84 84 * constructor 85 * @param protection defines type of IO protection[see channelProtectionTypeEnum] 85 86 */ 86 fifo( );87 fifo(short protection = CHANNEL_PROTECTION_PROCESS); 87 88 88 89 /** … … 90 91 * @param path defines path to the file 91 92 * @param mode defines mode to open file[see fifoOpenmodeEnum] 93 * @param protection defines type of IO protection[see channelProtectionTypeEnum] 92 94 */ 93 95 fifo(const dodoString &path, 94 short mode); 96 short mode, 97 short protection = CHANNEL_PROTECTION_PROCESS); 95 98 96 99 /** -
trunk/include/libdodo/ioFileRegular.h
r1164 r1166 88 88 /** 89 89 * constructor 90 * @param protection defines type of IO protection[see channelProtectionTypeEnum] 91 */ 92 regular(short protection = CHANNEL_PROTECTION_PROCESS); 93 94 /** 95 * constructor 90 96 * @param path defines path to the file 91 97 * @param mode defines mode to open file[see regularOpenmodeEnum] 98 * @param protection defines type of IO protection[see channelProtectionTypeEnum] 92 99 */ 93 100 regular(const dodoString &path, 94 short mode); 95 96 /** 97 * constructor 98 */ 99 regular(); 101 short mode, 102 short protection = CHANNEL_PROTECTION_PROCESS); 100 103 101 104 /** -
trunk/include/libdodo/ioFileTemp.h
r1160 r1166 78 78 * constructor 79 79 * @param open defines whether temp file should be opened in constructor 80 * @param protection defines type of IO protection[see channelProtectionTypeEnum] 80 81 */ 81 temp(bool open = false); 82 temp(bool open = false, 83 short protection = CHANNEL_PROTECTION_PROCESS); 82 84 83 85 /** -
trunk/include/libdodo/ioMemory.h
r1163 r1166 60 60 /** 61 61 * constructor 62 * @param protection defines type of IO protection[see channelProtectionTypeEnum] 62 63 */ 63 memory( );64 memory(short protection = CHANNEL_PROTECTION_PROCESS); 64 65 65 66 /** … … 70 71 71 72 /** 72 * co py constructor73 * @ note xexec object is not copied73 * constructor 74 * @param protection defines type of IO protection[see channelProtectionTypeEnum] 74 75 */ 75 memory(const dodoString &data); 76 memory(const dodoString &data, 77 short protection = CHANNEL_PROTECTION_PROCESS); 76 78 77 79 /** -
trunk/include/libdodo/ioNetworkExchange.h
r1161 r1166 112 112 /** 113 113 * constructor 114 */ 115 exchange(); 114 * @param protection defines type of IO protection[see channelProtectionTypeEnum] 115 */ 116 exchange(short protection = CHANNEL_PROTECTION_PROCESS); 116 117 117 118 /** … … 125 126 * constructor 126 127 * @param init is initial data[got from the ::accept method] 128 * @param protection defines type of IO protection[see channelProtectionTypeEnum] 127 129 * @note the object that has inited the object of current instance can be used for another connections 128 130 */ 129 exchange(__initialAccept &init); 131 exchange(__initialAccept &init, 132 short protection = CHANNEL_PROTECTION_PROCESS); 130 133 131 134 /** -
trunk/include/libdodo/ioNetworkSslExchange.h
r1161 r1166 111 111 /** 112 112 * constructor 113 */ 114 exchange(); 113 * @param protection defines type of IO protection[see channelProtectionTypeEnum] 114 */ 115 exchange(short protection = CHANNEL_PROTECTION_PROCESS); 115 116 116 117 /** … … 124 125 * constructor 125 126 * @param init is initial data[got from the ::accept method] 127 * @param protection defines type of IO protection[see channelProtectionTypeEnum] 126 128 * @note the object that has inited the object of current instance can be used for another connections 127 129 */ 128 exchange(__initialAccept &init); 130 exchange(__initialAccept &init, 131 short protection = CHANNEL_PROTECTION_PROCESS); 129 132 130 133 /** -
trunk/include/libdodo/ioPipe.h
r1161 r1166 77 77 * constructor 78 78 * @param open defines whether pipe should be opened in constructor 79 * @param protection defines type of IO protection[see channelProtectionTypeEnum] 79 80 */ 80 pipe(bool open = false); 81 pipe(bool open = false, 82 short protection = CHANNEL_PROTECTION_PROCESS); 81 83 82 84 /** -
trunk/include/libdodo/ioStdio.h
r1161 r1166 65 65 /** 66 66 * constructor 67 * @param protection defines type of IO protection[see channelProtectionTypeEnum] 67 68 */ 68 stdio( );69 stdio(short protection = CHANNEL_PROTECTION_PROCESS); 69 70 70 71 /** -
trunk/include/libdodo/pcSyncProcessDataCollection.h
r1161 r1166 124 124 dodoList<pc::sync::data::__info>::iterator current; ///< iterator for list of shared data[for matched with getShare method] 125 125 126 section *keeper; ///< section locker126 section *keeper; ///< section locker 127 127 }; 128 128 }; -
trunk/include/libdodo/pcSyncThreadDataCollection.h
r1161 r1166 124 124 dodoList<pc::sync::data::__info>::iterator current; ///< iterator for list of shared data[for matched with getShare method] 125 125 126 section *keeper; ///< section locker126 section *keeper; ///< section locker 127 127 }; 128 128 }; -
trunk/include/libdodo/toolsLogger.h
r1161 r1166 136 136 static const int syslogLevels[LOGGER_LEVELS]; ///< syslog log levels 137 137 138 pc::sync::section *keeper; ///< section locker138 pc::sync::section *keeper; ///< section locker 139 139 }; 140 140 }; -
trunk/include/libdodo/toolsTime.h
r1164 r1166 95 95 unsigned int month, 96 96 unsigned int year, 97 bool daylight = true);97 bool daylight = true); 98 98 99 99 unsigned int sec; ///< seconds [0, 60] … … 120 120 * @param month defines month[1, 12] 121 121 */ 122 static unsigned short int daysInMonth(unsigned intyear,123 unsigned short int month);122 static unsigned short daysInMonth(unsigned int year, 123 unsigned short month); 124 124 125 125 /** -
trunk/include/libdodo/types.h
r1160 r1166 122 122 * @return logger instance which can be used globally 123 123 */ 124 static T &getInstance() 124 static T & 125 getInstance() 125 126 { 126 127 static T t; -
trunk/src/cgiBasicExchange.cc
r1162 r1166 32 32 using namespace dodo::cgi::basic; 33 33 34 exchange::exchange(exchange &cf) 34 exchange::exchange(exchange &cf) : dodo::cgi::exchange(cf.protection), 35 io::channel(cf.protection) 35 36 { 36 37 } … … 38 39 //------------------------------------------------------------------- 39 40 40 exchange::exchange() 41 exchange::exchange(short protection) : dodo::cgi::exchange(protection), 42 io::channel(protection) 41 43 { 42 44 #ifndef IO_WO_XEXEC -
trunk/src/cgiDialogue.cc
r1162 r1166 862 862 switch (errno) 863 863 { 864 case EACCES:865 case EISDIR:866 867 file.error = CGI_POSTFILEERR_ACCESS_DENY;868 869 break;870 871 case ENAMETOOLONG:872 case ENOTDIR:873 874 file.error = CGI_POSTFILEERR_BAD_FILE_NAME;875 876 break;877 878 case ENOMEM:879 880 file.error = CGI_POSTFILEERR_NO_SPACE;881 882 break;883 884 default:885 886 throw exception::basic(exception::ERRMODULE_CGIDIALOGUE, DIALOGUEEX_MAKEPOST, exception::ERRNO_ERRNO, errno, strerror(errno), __LINE__, __FILE__);864 case EACCES: 865 case EISDIR: 866 867 file.error = CGI_POSTFILEERR_ACCESS_DENY; 868 869 break; 870 871 case ENAMETOOLONG: 872 case ENOTDIR: 873 874 file.error = CGI_POSTFILEERR_BAD_FILE_NAME; 875 876 break; 877 878 case ENOMEM: 879 880 file.error = CGI_POSTFILEERR_NO_SPACE; 881 882 break; 883 884 default: 885 886 throw exception::basic(exception::ERRMODULE_CGIDIALOGUE, DIALOGUEEX_MAKEPOST, exception::ERRNO_ERRNO, errno, strerror(errno), __LINE__, __FILE__); 887 887 } 888 888 } -
trunk/src/cgiExchange.cc
r975 r1166 32 32 using namespace dodo::cgi; 33 33 34 35 exchange::exchange(short protection) : channel(protection) 36 { 37 } 38 39 //------------------------------------------------------------------- 40 34 41 exchange::~exchange() 35 42 { -
trunk/src/cgiFastExchange.cc
r1162 r1166 34 34 using namespace dodo::cgi::fast; 35 35 36 exchange::exchange(exchange &cf) 36 exchange::exchange(exchange &cf) : dodo::cgi::exchange(cf.protection), 37 channel(cf.protection) 37 38 { 38 39 } … … 40 41 //------------------------------------------------------------------- 41 42 42 exchange::exchange(FCGX_Request *a_request) : request(a_request) 43 exchange::exchange(FCGX_Request *a_request, 44 short protection) : request(a_request), 45 dodo::cgi::exchange(protection), 46 channel(protection) 43 47 { 44 48 #ifndef IO_WO_XEXEC -
trunk/src/dataBasePostgresql.cc
r1162 r1166 427 427 switch (status) 428 428 { 429 case PGRES_EMPTY_QUERY:430 case PGRES_BAD_RESPONSE:431 case PGRES_NONFATAL_ERROR:432 case PGRES_FATAL_ERROR:433 434 throw exception::basic(exception::ERRMODULE_DATABASEPOSTGRESQL, POSTGRESQLEX_GETFIELDSTYPES, exception::ERRNO_MYSQL, status, PQerrorMessage(pgHandle), __LINE__, __FILE__);429 case PGRES_EMPTY_QUERY: 430 case PGRES_BAD_RESPONSE: 431 case PGRES_NONFATAL_ERROR: 432 case PGRES_FATAL_ERROR: 433 434 throw exception::basic(exception::ERRMODULE_DATABASEPOSTGRESQL, POSTGRESQLEX_GETFIELDSTYPES, exception::ERRNO_MYSQL, status, PQerrorMessage(pgHandle), __LINE__, __FILE__); 435 435 } 436 436 … … 576 576 switch (status) 577 577 { 578 case PGRES_EMPTY_QUERY:579 case PGRES_BAD_RESPONSE:580 case PGRES_NONFATAL_ERROR:581 case PGRES_FATAL_ERROR:582 583 throw exception::basic(exception::ERRMODULE_DATABASEPOSTGRESQL, POSTGRESQLEX_EXEC, exception::ERRNO_MYSQL, status, PQerrorMessage(pgHandle), __LINE__, __FILE__);578 case PGRES_EMPTY_QUERY: 579 case PGRES_BAD_RESPONSE: 580 case PGRES_NONFATAL_ERROR: 581 case PGRES_FATAL_ERROR: 582 583 throw exception::basic(exception::ERRMODULE_DATABASEPOSTGRESQL, POSTGRESQLEX_EXEC, exception::ERRNO_MYSQL, status, PQerrorMessage(pgHandle), __LINE__, __FILE__); 584 584 } 585 585 -
trunk/src/dataBaseSqlConstructor.cc
r1162 r1166 485 485 switch (collectedData.qType) 486 486 { 487 case ACCUMULATOR_REQUEST_SELECT:488 489 selectCollect();490 selectAction = true;491 492 break;493 494 case ACCUMULATOR_REQUEST_INSERT:495 496 insertCollect();497 additionalActions = false;498 499 break;500 501 case ACCUMULATOR_REQUEST_UPDATE:502 503 updateCollect();504 505 break;506 507 case ACCUMULATOR_REQUEST_DELETE:508 509 delCollect();510 511 break;512 513 case ACCUMULATOR_REQUEST_INSERT_SELECT:514 515 insertSelectCollect();516 selectAction = true;517 518 break;519 520 case SUBREQUEST_UNION:521 case SUBREQUEST_UNION_ALL:522 case SUBREQUEST_MINUS:523 case SUBREQUEST_INTERSECT:524 525 subCollect();526 additionalActions = false;527 528 break;529 530 case ACCUMULATOR_REQUEST_CALL_FUNCTION:531 532 callFunctionCollect();533 selectAction = true;534 535 break;536 537 case ACCUMULATOR_REQUEST_CALL_PROCEDURE:538 539 callProcedureCollect();540 541 break;542 543 default:544 545 additionalActions = false;487 case ACCUMULATOR_REQUEST_SELECT: 488 489 selectCollect(); 490 selectAction = true; 491 492 break; 493 494 case ACCUMULATOR_REQUEST_INSERT: 495 496 insertCollect(); 497 additionalActions = false; 498 499 break; 500 501 case ACCUMULATOR_REQUEST_UPDATE: 502 503 updateCollect(); 504 505 break; 506 507 case ACCUMULATOR_REQUEST_DELETE: 508 509 delCollect(); 510 511 break; 512 513 case ACCUMULATOR_REQUEST_INSERT_SELECT: 514 515 insertSelectCollect(); 516 selectAction = true; 517 518 break; 519 520 case SUBREQUEST_UNION: 521 case SUBREQUEST_UNION_ALL: 522 case SUBREQUEST_MINUS: 523 case SUBREQUEST_INTERSECT: 524 525 subCollect(); 526 additionalActions = false; 527 528 break; 529 530 case ACCUMULATOR_REQUEST_CALL_FUNCTION: 531 532 callFunctionCollect(); 533 selectAction = true; 534 535 break; 536 537 case ACCUMULATOR_REQUEST_CALL_PROCEDURE: 538 539 callProcedureCollect(); 540 541 break; 542 543 default: 544 545 additionalActions = false; 546 546 } 547 547 -
trunk/src/dataBaseSqlite.cc
r1162 r1166 196 196 switch (sqlite3_step(sqliteResult)) 197 197 { 198 case SQLITE_BUSY:199 200 continue;201 202 case SQLITE_DONE:203 204 iterate = false;205 206 break;207 208 case SQLITE_ERROR:209 210 throw exception::basic(exception::ERRMODULE_DATABASESQLITE, SQLITEEX_FETCHROWS, exception::ERRNO_SQLITE, sqlite3_errcode(sqliteHandle), sqlite3_errmsg(sqliteHandle), __LINE__, __FILE__);211 212 case SQLITE_ROW:213 214 rowsPart.clear();198 case SQLITE_BUSY: 199 200 continue; 201 202 case SQLITE_DONE: 203 204 iterate = false; 205 206 break; 207 208 case SQLITE_ERROR: 209 210 throw exception::basic(exception::ERRMODULE_DATABASESQLITE, SQLITEEX_FETCHROWS, exception::ERRNO_SQLITE, sqlite3_errcode(sqliteHandle), sqlite3_errmsg(sqliteHandle), __LINE__, __FILE__); 211 212 case SQLITE_ROW: 213 214 rowsPart.clear(); 215 215 216 216 #ifndef USE_DEQUE 217 rowsPart.reserve(numFields);218 #endif 219 220 for (i = 0; i < numFields; ++i)221 {222 switch (sqlite3_column_type(sqliteResult, i))223 {224 case SQLITE_INTEGER:225 226 rowsPart.push_back(tools::string::iToString(sqlite3_column_int(sqliteResult, i)));227 228 break;229 230 case SQLITE_FLOAT:231 232 rowsPart.push_back(tools::string::dToString(sqlite3_column_double(sqliteResult, i)));233 234 break;235 236 case SQLITE_TEXT:237 238 rowsPart.push_back(dodoString((const char *)sqlite3_column_text(sqliteResult, i), sqlite3_column_bytes(sqliteResult, i)));239 240 break;241 242 case SQLITE_BLOB:243 244 rowsPart.push_back(dodoString((const char *)sqlite3_column_blob(sqliteResult, i), sqlite3_column_bytes(sqliteResult, i)));245 246 break;247 248 case SQLITE_NULL:249 default:250 251 rowsPart.push_back(statements[SQLCONSTRUCTOR_STATEMENT_NULL]);252 253 break;254 }255 }256 257 rows.push_back(rowsPart);258 259 break;217 rowsPart.reserve(numFields); 218 #endif 219 220 for (i = 0; i < numFields; ++i) 221 { 222 switch (sqlite3_column_type(sqliteResult, i)) 223 { 224 case SQLITE_INTEGER: 225 226 rowsPart.push_back(tools::string::iToString(sqlite3_column_int(sqliteResult, i))); 227 228 break; 229 230 case SQLITE_FLOAT: 231 232 rowsPart.push_back(tools::string::dToString(sqlite3_column_double(sqliteResult, i))); 233 234 break; 235 236 case SQLITE_TEXT: 237 238 rowsPart.push_back(dodoString((const char *)sqlite3_column_text(sqliteResult, i), sqlite3_column_bytes(sqliteResult, i))); 239 240 break; 241 242 case SQLITE_BLOB: 243 244 rowsPart.push_back(dodoString((const char *)sqlite3_column_blob(sqliteResult, i), sqlite3_column_bytes(sqliteResult, i))); 245 246 break; 247 248 case SQLITE_NULL: 249 default: 250 251 rowsPart.push_back(statements[SQLCONSTRUCTOR_STATEMENT_NULL]); 252 253 break; 254 } 255 } 256 257 rows.push_back(rowsPart); 258 259 break; 260 260 } 261 261 } … … 339 339 switch (result) 340 340 { 341 case SQLITE_BUSY:342 343 continue;344 345 case SQLITE_DONE:346 347 iterate = false;348 349 break;350 351 case SQLITE_ERROR:352 353 throw exception::basic(exception::ERRMODULE_DATABASESQLITE, SQLITEEX_FETCHROWS, exception::ERRNO_SQLITE, sqlite3_errcode(sqliteHandle), sqlite3_errmsg(sqliteHandle), __LINE__, __FILE__);354 355 case SQLITE_ROW:356 357 ++numRows;358 359 break;341 case SQLITE_BUSY: 342 343 continue; 344 345 case SQLITE_DONE: 346 347 iterate = false; 348 349 break; 350 351 case SQLITE_ERROR: 352 353 throw exception::basic(exception::ERRMODULE_DATABASESQLITE, SQLITEEX_FETCHROWS, exception::ERRNO_SQLITE, sqlite3_errcode(sqliteHandle), sqlite3_errmsg(sqliteHandle), __LINE__, __FILE__); 354 355 case SQLITE_ROW: 356 357 ++numRows; 358 359 break; 360 360 } 361 361 } … … 567 567 switch (sqlite3_step(sqliteResult)) 568 568 { 569 case SQLITE_BUSY: 570 571 continue; 572 573 case SQLITE_DONE: 574 575 iterate = false; 576 577 break; 578 579 case SQLITE_ERROR: 580 581 throw exception::basic(exception::ERRMODULE_DATABASESQLITE, SQLITEEX_GETFIELDSTYPES, exception::ERRNO_SQLITE, sqlite3_errcode(sqliteHandle), sqlite3_errmsg(sqliteHandle), __LINE__, __FILE__); 582 583 case SQLITE_ROW: 584 585 columnName = (const char *)sqlite3_column_text(sqliteResult, 1); 586 columnType = (const char *)sqlite3_column_text(sqliteResult, 2); 587 588 field = types->second.find(columnName); 589 590 if (field == fieldsEnd) 591 { 592 if (strcasestr(columnType, "char") != NULL || 593 strcasestr(columnType, "date") != NULL || 594 strcasestr(columnType, "time") != NULL || 595 strcasestr(columnType, "text") != NULL || 596 strcasestr(columnType, "enum") != NULL || 597 strcasestr(columnType, "set") != NULL) 598 { 599 types->second.insert(make_pair(dodoString(columnName), sql::FIELDTYPE_TEXT)); 569 case SQLITE_BUSY: 570 571 continue; 572 573 case SQLITE_DONE: 574 575 iterate = false; 576 577 break; 578 579 case SQLITE_ERROR: 580 581 throw exception::basic(exception::ERRMODULE_DATABASESQLITE, SQLITEEX_GETFIELDSTYPES, exception::ERRNO_SQLITE, sqlite3_errcode(sqliteHandle), sqlite3_errmsg(sqliteHandle), __LINE__, __FILE__); 582 583 case SQLITE_ROW: 584 585 columnName = (const char *)sqlite3_column_text(sqliteResult, 1); 586 columnType = (const char *)sqlite3_column_text(sqliteResult, 2); 587 588 field = types->second.find(columnName); 589 590 if (field == fieldsEnd) 591 { 592 if (strcasestr(columnType, "char") != NULL || 593 strcasestr(columnType, "date") != NULL || 594 strcasestr(columnType, "time") != NULL || 595 strcasestr(columnType, "text") != NULL || 596 strcasestr(columnType, "enum") != NULL || 597 strcasestr(columnType, "set") != NULL) 598 { 599 types->second.insert(make_pair(dodoString(columnName), sql::FIELDTYPE_TEXT)); 600 } 601 else 602 { 603 if (strcasestr(columnType, "blob") != NULL) 604 { 605 types->second.insert(make_pair(dodoString(columnName), sql::FIELDTYPE_BINARY)); 606 } 607 else 608 { 609 types->second.insert(make_pair(dodoString(columnName), sql::FIELDTYPE_NUMERIC)); 610 } 611 } 600 612 } 601 613 else 602 614 { 603 if (strcasestr(columnType, "blob") != NULL) 604 { 605 types->second.insert(make_pair(dodoString(columnName), sql::FIELDTYPE_BINARY)); 615 if (strcasestr(columnType, "char") != NULL || 616 strcasestr(columnType, "date") != NULL || 617 strcasestr(columnType, "time") != NULL || 618 strcasestr(columnType, "text") != NULL || 619 strcasestr(columnType, "enum") != NULL || 620 strcasestr(columnType, "set") != NULL) 621 { 622 field->second = sql::FIELDTYPE_TEXT; 606 623 } 607 624 else 608 625 { 609 types->second.insert(make_pair(dodoString(columnName), sql::FIELDTYPE_NUMERIC)); 610 } 611 } 612 } 613 else 614 { 615 if (strcasestr(columnType, "char") != NULL || 616 strcasestr(columnType, "date") != NULL || 617 strcasestr(columnType, "time") != NULL || 618 strcasestr(columnType, "text") != NULL || 619 strcasestr(columnType, "enum") != NULL || 620 strcasestr(columnType, "set") != NULL) 621 { 622 field->second = sql::FIELDTYPE_TEXT; 623 } 624 else 625 { 626 if (strcasestr(columnType, "blob") != NULL) 627 { 628 field->second = sql::FIELDTYPE_BINARY; 629 } 630 else 631 { 632 field->second = sql::FIELDTYPE_NUMERIC; 633 } 634 } 635 } 636 637 break; 626 if (strcasestr(columnType, "blob") != NULL) 627 { 628 field->second = sql::FIELDTYPE_BINARY; 629 } 630 else 631 { 632 field->second = sql::FIELDTYPE_NUMERIC; 633 } 634 } 635 } 636 637 break; 638 638 } 639 639 } … … 1078 1078 switch (sqlite3_step(sqliteResult)) 1079 1079 { 1080 case SQLITE_BUSY:1081 1082 continue;1083 1084 case SQLITE_DONE:1085 1086 iterate = false;1087 1088 break;1089 1090 case SQLITE_ERROR:1091 1092 throw exception::basic(exception::ERRMODULE_DATABASESQLITE, SQLITEEX_FETCHFIELDSTOROWS, exception::ERRNO_SQLITE, sqlite3_errcode(sqliteHandle), sqlite3_errmsg(sqliteHandle), __LINE__, __FILE__);1093 1094 case SQLITE_ROW:1095 1096 rowFieldsPart.clear();1097 1098 for (i = 0; i < numFields; ++i)1099 {1100 switch (sqlite3_column_type(sqliteResult, i))1101 {1102 case SQLITE_INTEGER:1103 1104 rowFieldsPart.insert(make_pair(sqlite3_column_name(sqliteResult, i), tools::string::iToString(sqlite3_column_int(sqliteResult, i))));1105 1106 break;1107 1108 case SQLITE_FLOAT:1109 1110 rowFieldsPart.insert(make_pair(sqlite3_column_name(sqliteResult, i), tools::string::dToString(sqlite3_column_double(sqliteResult, i))));1111 1112 break;1113 1114 case SQLITE_TEXT:1115 1116 rowFieldsPart.insert(make_pair(sqlite3_column_name(sqliteResult, i), dodoString((const char *)sqlite3_column_text(sqliteResult, i), sqlite3_column_bytes(sqliteResult, i))));1117 1118 break;1119 1120 case SQLITE_BLOB:1121 1122 rowFieldsPart.insert(make_pair(sqlite3_column_name(sqliteResult, i), dodoString((const char *)sqlite3_column_blob(sqliteResult, i), sqlite3_column_bytes(sqliteResult, i))));1123 1124 break;1125 1126 case SQLITE_NULL:1127 default:1128 1129 rowFieldsPart.insert(make_pair(dodoString(sqlite3_column_name(sqliteResult, i)), statements[SQLCONSTRUCTOR_STATEMENT_NULL]));1130 1131 break;1132 }1133 }1134 1135 rowsFields.push_back(rowFieldsPart);1136 1137 break;1080 case SQLITE_BUSY: 1081 1082 continue; 1083 1084 case SQLITE_DONE: 1085 1086 iterate = false; 1087 1088 break; 1089 1090 case SQLITE_ERROR: 1091 1092 throw exception::basic(exception::ERRMODULE_DATABASESQLITE, SQLITEEX_FETCHFIELDSTOROWS, exception::ERRNO_SQLITE, sqlite3_errcode(sqliteHandle), sqlite3_errmsg(sqliteHandle), __LINE__, __FILE__); 1093 1094 case SQLITE_ROW: 1095 1096 rowFieldsPart.clear(); 1097 1098 for (i = 0; i < numFields; ++i) 1099 { 1100 switch (sqlite3_column_type(sqliteResult, i)) 1101 { 1102 case SQLITE_INTEGER: 1103 1104 rowFieldsPart.insert(make_pair(sqlite3_column_name(sqliteResult, i), tools::string::iToString(sqlite3_column_int(sqliteResult, i)))); 1105 1106 break; 1107 1108 case SQLITE_FLOAT: 1109 1110 rowFieldsPart.insert(make_pair(sqlite3_column_name(sqliteResult, i), tools::string::dToString(sqlite3_column_double(sqliteResult, i)))); 1111 1112 break; 1113 1114 case SQLITE_TEXT: 1115 1116 rowFieldsPart.insert(make_pair(sqlite3_column_name(sqliteResult, i), dodoString((const char *)sqlite3_column_text(sqliteResult, i), sqlite3_column_bytes(sqliteResult, i)))); 1117 1118 break; 1119 1120 case SQLITE_BLOB: 1121 1122 rowFieldsPart.insert(make_pair(sqlite3_column_name(sqliteResult, i), dodoString((const char *)sqlite3_column_blob(sqliteResult, i), sqlite3_column_bytes(sqliteResult, i)))); 1123 1124 break; 1125 1126 case SQLITE_NULL: 1127 default: 1128 1129 rowFieldsPart.insert(make_pair(dodoString(sqlite3_column_name(sqliteResult, i)), statements[SQLCONSTRUCTOR_STATEMENT_NULL])); 1130 1131 break; 1132 } 1133 } 1134 1135 rowsFields.push_back(rowFieldsPart); 1136 1137 break; 1138 1138 } 1139 1139 } -
trunk/src/dataFormatJsonProcessor.cc
r1162 r1166 49 49 switch (root.valueDataType) 50 50 { 51 case DATATYPE_STRING: 52 { 53 dodoString jsonObject = "\""; 54 dodoString stringValue = root.stringValue; 55 tools::string::replace("\"", "\\\"", stringValue); 56 jsonObject.append(stringValue); 57 jsonObject.append("\""); 58 59 return jsonObject; 60 } 61 62 case DATATYPE_OBJECT: 63 { 64 dodoString jsonObject = "{"; 65 66 dodoMap<dodoString, node, dodoMapStringCompare>::const_iterator i = root.objectValue.begin(), j = root.objectValue.end(); 67 if (i != j) 68 { 69 for (--j; i != j; ++i) 51 case DATATYPE_STRING: 52 { 53 dodoString jsonObject = "\""; 54 dodoString stringValue = root.stringValue; 55 tools::string::replace("\"", "\\\"", stringValue); 56 jsonObject.append(stringValue); 57 jsonObject.append("\""); 58 59 return jsonObject; 60 } 61 62 case DATATYPE_OBJECT: 63 { 64 dodoString jsonObject = "{"; 65 66 dodoMap<dodoString, node, dodoMapStringCompare>::const_iterator i = root.objectValue.begin(), j = root.objectValue.end(); 67 if (i != j) 70 68 { 69 for (--j; i != j; ++i) 70 { 71 jsonObject.append("\""); 72 jsonObject.append(i->first); 73 jsonObject.append("\":"); 74 75 jsonObject.append(make(i->second)); 76 jsonObject.append(","); 77 } 71 78 jsonObject.append("\""); 72 79 jsonObject.append(i->first); … … 74 81 75 82 jsonObject.append(make(i->second)); 76 jsonObject.append(",");77 83 } 78 jsonObject.append("\""); 79 jsonObject.append(i->first); 80 jsonObject.append("\":"); 81 82 jsonObject.append(make(i->second)); 83 } 84 85 jsonObject.append("}"); 86 87 return jsonObject; 88 } 89 90 case DATATYPE_ARRAY: 91 { 92 dodoString jsonObject = "["; 93 94 dodoArray<node>::const_iterator i = root.arrayValue.begin(), j = root.arrayValue.end(); 95 if (i != j) 96 { 97 --j; 98 for (; i != j; ++i) 84 85 jsonObject.append("}"); 86 87 return jsonObject; 88 } 89 90 case DATATYPE_ARRAY: 91 { 92 dodoString jsonObject = "["; 93 94 dodoArray<node>::const_iterator i = root.arrayValue.begin(), j = root.arrayValue.end(); 95 if (i != j) 99 96 { 97 --j; 98 for (; i != j; ++i) 99 { 100 jsonObject.append(make(*i)); 101 jsonObject.append(","); 102 } 100 103 jsonObject.append(make(*i)); 101 jsonObject.append(",");102 104 } 103 jsonObject.append(make(*i)); 104 } 105 106 jsonObject.append("]"); 107 108 return jsonObject; 109 } 110 111 case DATATYPE_NUMERIC: 112 113 return tools::string::lToString(root.numericValue); 114 115 case DATATYPE_BOOLEAN: 116 117 return root.booleanValue ? "true" : "false"; 118 119 case DATATYPE_NULL: 120 default: 121 122 return "null"; 105 106 jsonObject.append("]"); 107 108 return jsonObject; 109 } 110 111 case DATATYPE_NUMERIC: 112 113 return tools::string::lToString(root.numericValue); 114 115 case DATATYPE_BOOLEAN: 116 117 return root.booleanValue ? "true" : "false"; 118 119 case DATATYPE_NULL: 120 default: 121 122 return "null"; 123 123 } 124 124 … … 144 144 switch (root[i]) 145 145 { 146 case ' ': 147 case '\r': 148 case '\n': 149 case '\t': 150 151 break; 152 153 case '[': 154 155 if (initial) 156 { 157 initial = false; 158 } 159 else 160 { 146 case ' ': 147 case '\r': 148 case '\n': 149 case '\t': 150 151 break; 152 153 case '[': 154 155 if (initial) 156 { 157 initial = false; 158 } 159 else 160 { 161 i = processValue(subNode, root, i); 162 163 jnode.push_back(subNode); 164 } 165 166 break; 167 168 case ']': 169 170 return i; 171 172 case ',': 173 174 break; 175 176 default: 177 161 178 i = processValue(subNode, root, i); 162 179 163 180 jnode.push_back(subNode); 164 }165 166 break;167 168 case ']':169 170 return i;171 172 case ',':173 174 break;175 176 default:177 178 i = processValue(subNode, root, i);179 180 jnode.push_back(subNode);181 181 } 182 182 } … … 199 199 switch (root[i]) 200 200 { 201 case ' ':202 case '\r':203 case '\n':204 case '\t':205 206 break;207 208 case '"':209 210 node.valueDataType = DATATYPE_STRING;211 212 return processString(node.stringValue, root, i);213 214 case '{':215 216 node.valueDataType = DATATYPE_OBJECT;217 218 return processObject(node.objectValue, root, i);219 220 case '[':221 222 node.valueDataType = DATATYPE_ARRAY;223 224 return processArray(node.arrayValue, root, i);225 226 case 't':227 case 'f':228 229 node.valueDataType = DATATYPE_BOOLEAN;230 231 return processBoolean(node.booleanValue, root, i);232 233 case 'n':234 235 node.valueDataType = DATATYPE_NULL;236 237 return processNull(root, i);238 239 default:240 241 node.valueDataType = DATATYPE_NUMERIC;242 243 return processNumeric(node.numericValue, root, i);201 case ' ': 202 case '\r': 203 case '\n': 204 case '\t': 205 206 break; 207 208 case '"': 209 210 node.valueDataType = DATATYPE_STRING; 211 212 return processString(node.stringValue, root, i); 213 214 case '{': 215 216 node.valueDataType = DATATYPE_OBJECT; 217 218 return processObject(node.objectValue, root, i); 219 220 case '[': 221 222 node.valueDataType = DATATYPE_ARRAY; 223 224 return processArray(node.arrayValue, root, i); 225 226 case 't': 227 case 'f': 228 229 node.valueDataType = DATATYPE_BOOLEAN; 230 231 return processBoolean(node.booleanValue, root, i); 232 233 case 'n': 234 235 node.valueDataType = DATATYPE_NULL; 236 237 return processNull(root, i); 238 239 default: 240 241 node.valueDataType = DATATYPE_NUMERIC; 242 243 return processNumeric(node.numericValue, root, i); 244 244 } 245 245 } … … 318 318 switch (root[i]) 319 319 { 320 case ' ':321 case '\r':322 case '\n':323 case '\t':324 325 break;326 327 case '1':328 case '2':329 case '3':330 case '4':331 case '5':332 case '6':333 case '7':334 case '8':335 case '9':336 case '0':337 case '+':338 case '-':339 case 'e':340 case 'E':341 342 numeric.append(1, root[i]);343 344 break;345 346 case ',':347 case ']':348 case '}':349 350 node = tools::string::stringToL(numeric);351 352 return i - 1;353 354 default:355 356 throw exception::basic(exception::ERRMODULE_DATAFORMATJSONPROCESSOR, PROCESSOREX_PROCESSNUMERIC, exception::ERRNO_LIBDODO, PROCESSOREX_MALFORMEDJSONNUMERIC, DATAFORMATJSONPROCESSOREX_MALFORMEDJSONNUMERIC_STR, __LINE__, __FILE__);320 case ' ': 321 case '\r': 322 case '\n': 323 case '\t': 324 325 break; 326 327 case '1': 328 case '2': 329 case '3': 330 case '4': 331 case '5': 332 case '6': 333 case '7': 334 case '8': 335 case '9': 336 case '0': 337 case '+': 338 case '-': 339 case 'e': 340 case 'E': 341 342 numeric.append(1, root[i]); 343 344 break; 345 346 case ',': 347 case ']': 348 case '}': 349 350 node = tools::string::stringToL(numeric); 351 352 return i - 1; 353 354 default: 355 356 throw exception::basic(exception::ERRMODULE_DATAFORMATJSONPROCESSOR, PROCESSOREX_PROCESSNUMERIC, exception::ERRNO_LIBDODO, PROCESSOREX_MALFORMEDJSONNUMERIC, DATAFORMATJSONPROCESSOREX_MALFORMEDJSONNUMERIC_STR, __LINE__, __FILE__); 357 357 } 358 358 } … … 381 381 switch (root[i]) 382 382 { 383 case ' ': 384 case '\r': 385 case '\n': 386 case '\t': 387 case ':': 388 case ',': 389 390 break; 391 392 case '{': 393 394 if (state == JSON_STATE_OBJECT_INITIAL) 395 { 396 state = JSON_STATE_OBJECT_OBJECTNAME; 397 398 break; 399 } 400 else 401 { 383 case ' ': 384 case '\r': 385 case '\n': 386 case '\t': 387 case ':': 388 case ',': 389 390 break; 391 392 case '{': 393 394 if (state == JSON_STATE_OBJECT_INITIAL) 395 { 396 state = JSON_STATE_OBJECT_OBJECTNAME; 397 398 break; 399 } 400 else 401 { 402 if (state == JSON_STATE_OBJECT_OBJECTVALUE) 403 { 404 subNodeValue.clear(); 405 406 subNodeValue.valueDataType = DATATYPE_OBJECT; 407 408 i = processObject(subNodeValue.objectValue, root, i); 409 jnode.insert(make_pair(subNodeName, subNodeValue)); 410 411 state = JSON_STATE_OBJECT_OBJECTNAME; 412 413 break; 414 } 415 } 416 417 case '}': 418 419 return i; 420 421 case '"': 422 423 if (state == JSON_STATE_OBJECT_OBJECTNAME) 424 { 425 i = processString(subNodeName, root, i); 426 427 state = JSON_STATE_OBJECT_OBJECTVALUE; 428 429 break; 430 } 431 else 432 { 433 if (state == JSON_STATE_OBJECT_OBJECTVALUE) 434 { 435 subNodeValue.clear(); 436 437 subNodeValue.valueDataType = DATATYPE_STRING; 438 439 i = processString(subNodeValue.stringValue, root, i); 440 jnode.insert(make_pair(subNodeName, subNodeValue)); 441 442 state = JSON_STATE_OBJECT_OBJECTNAME; 443 444 break; 445 } 446 } 447 448 default: 449 402 450 if (state == JSON_STATE_OBJECT_OBJECTVALUE) 403 451 { 404 subNodeValue.clear(); 405 406 subNodeValue.valueDataType = DATATYPE_OBJECT; 407 408 i = processObject(subNodeValue.objectValue, root, i); 452 i = processValue(subNodeValue, root, i); 409 453 jnode.insert(make_pair(subNodeName, subNodeValue)); 410 454 411 455 state = JSON_STATE_OBJECT_OBJECTNAME; 412 413 break; 414 } 415 } 416 417 case '}': 418 419 return i; 420 421 case '"': 422 423 if (state == JSON_STATE_OBJECT_OBJECTNAME) 424 { 425 i = processString(subNodeName, root, i); 426 427 state = JSON_STATE_OBJECT_OBJECTVALUE; 428 429 break; 430 } 431 else 432 { 433 if (state == JSON_STATE_OBJECT_OBJECTVALUE) 434 { 435 subNodeValue.clear(); 436 437 subNodeValue.valueDataType = DATATYPE_STRING; 438 439 i = processString(subNodeValue.stringValue, root, i); 440 jnode.insert(make_pair(subNodeName, subNodeValue)); 441 442 state = JSON_STATE_OBJECT_OBJECTNAME; 443 444 break; 445 } 446 } 447 448 default: 449 450 if (state == JSON_STATE_OBJECT_OBJECTVALUE) 451 { 452 i = processValue(subNodeValue, root, i); 453 jnode.insert(make_pair(subNodeName, subNodeValue)); 454 455 state = JSON_STATE_OBJECT_OBJECTNAME; 456 } 456 } 457 457 } 458 458 } … … 543 543 switch (root[i]) 544 544 { 545 case '\\': 546 547 if (!escape) 548 { 549 escape = true; 550 551 break; 552 } 553 554 case '"': 555 556 if (!escape) 557 { 558 if (initial) 559 { 560 initial = false; 545 case '\\': 546 547 if (!escape) 548 { 549 escape = true; 561 550 562 551 break; 563 552 } 553 554 case '"': 555 556 if (!escape) 557 { 558 if (initial) 559 { 560 initial = false; 561 562 break; 563 } 564 else 565 { 566 return i; 567 } 568 } 569 570 default: 571 572 if (escape) 573 { 574 escape = false; 575 576 jnode.append(1, '\\'); 577 jnode.append(1, root[i]); 578 } 564 579 else 565 580 { 566 return i; 567 } 568 } 569 570 default: 571 572 if (escape) 573 { 574 escape = false; 575 576 jnode.append(1, '\\'); 577 jnode.append(1, root[i]); 578 } 579 else 580 { 581 jnode.append(1, root[i]); 582 } 581 jnode.append(1, root[i]); 582 } 583 583 } 584 584 } -
trunk/src/dataTplProcessor.cc
r1162 r1166 356 356 switch (temp[0]) 357 357 { 358 case 'p': 359 360 k = temp.find(statements[PROCESSOR_STATEMENT_PRINT]); 361 if (k == 0) 362 { 363 j = _print(j, dodoString(temp.data() + 5, temp.size() - 5), tpl, path); 364 } 365 else 366 { 358 case 'p': 359 360 k = temp.find(statements[PROCESSOR_STATEMENT_PRINT]); 361 if (k == 0) 362 { 363 j = _print(j, dodoString(temp.data() + 5, temp.size() - 5), tpl, path); 364 } 365 else 366 { 367 keywordNotFound = true; 368 } 369 370 break; 371 372 case 'i': 373 374 k = temp.find(statements[PROCESSOR_STATEMENT_OPEN_IF]); 375 if (k == 0) 376 { 377 ++namespaceDeepness; 378 379 j = _if(buffer, j, dodoString(temp.data() + 2, temp.size() - 2), tpl, path); 380 381 cleanNamespace(); 382 383 --namespaceDeepness; 384 } 385 else 386 { 387 k = temp.find(statements[PROCESSOR_STATEMENT_INCLUDE]); 388 if (k == 0) 389 { 390 j = _include(j, dodoString(temp.data() + 8, temp.size() - 8), tpl, path); 391 } 392 else 393 { 394 keywordNotFound = true; 395 } 396 } 397 398 break; 399 400 case 'f': 401 402 k = temp.find(statements[PROCESSOR_STATEMENT_OPEN_FOR]); 403 if (k == 0) 404 { 405 ++loopDeepness; 406 ++namespaceDeepness; 407 408 j = _for(buffer, j, dodoString(temp.data() + 3, temp.size() - 3), tpl, path); 409 410 cleanNamespace(); 411 412 --namespaceDeepness; 413 --loopDeepness; 414 } 415 else 416 { 417 keywordNotFound = true; 418 } 419 420 break; 421 422 case 'b': 423 424 k = temp.find(statements[PROCESSOR_STATEMENT_BREAK]); 425 if (k == 0) 426 { 427 if (_break(j, dodoString(temp.data() + 5, temp.size() - 5), path)) 428 { 429 breakLoop = true; 430 } 431 } 432 else 433 { 434 keywordNotFound = true; 435 } 436 437 break; 438 439 case 'c': 440 441 k = temp.find(statements[PROCESSOR_STATEMENT_CONT]); 442 if (k == 0) 443 { 444 if (loopDeepness > 0) 445 { 446 continueFlag = true; 447 448 breakLoop = true; 449 } 450 } 451 else 452 { 453 keywordNotFound = true; 454 } 455 456 break; 457 458 case 'a': 459 460 k = temp.find(statements[PROCESSOR_STATEMENT_ASSIGN]); 461 if (k == 0) 462 { 463 j = _assign(j, dodoString(temp.data() + 6, temp.size() - 6), path); 464 } 465 else 466 { 467 keywordNotFound = true; 468 } 469 470 break; 471 472 case 'n': 473 474 k = temp.find(statements[PROCESSOR_STATEMENT_OPEN_NS]); 475 if (k == 0) 476 { 477 ++namespaceDeepness; 478 479 j = _ns(buffer, j, tpl, path); 480 481 cleanNamespace(); 482 483 --namespaceDeepness; 484 }
