Changeset 7429
- Timestamp:
- 2004-05-25T13:47:36+12:00 (20 years ago)
- Location:
- trunk/gsdl/src/recpt
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/src/recpt/cgiargs.cpp
r1285 r7429 177 177 // as the results will be meaningless. 178 178 bool cgiargsinfoclass::addarginfo (ostream *logout, const cgiarginfo &info) { 179 outconvertclass text_t2ascii;180 179 181 180 cgiarginfo *orginfo = getarginfo (info.shortname); … … 187 186 if (orginfo->longname != info.longname) { 188 187 if (logout != NULL) { 188 outconvertclass text_t2ascii; 189 189 (*logout) << text_t2ascii << "Error: cgi argument name clash for argument \"" 190 190 << info.shortname << "\".\nOne long name was\n \"" << orginfo->longname … … 196 196 if (orginfo->multiplevalue != info.multiplevalue) { 197 197 if (logout != NULL) { 198 outconvertclass text_t2ascii; 198 199 (*logout) << text_t2ascii << "Error: cgi argument \"" << info.shortname 199 200 << "\" was given as being a single value option\n" … … 205 206 if (orginfo->multiplechar != info.multiplechar) { 206 207 if (logout != NULL) { 208 outconvertclass text_t2ascii; 207 209 (*logout) << text_t2ascii << "Error: cgi argument \"" << info.shortname 208 210 << "\" was given as being a single character option\n" … … 214 216 if (!info.multiplechar && info.argdefault.size() > 1) { 215 217 if (logout != NULL) { 218 outconvertclass text_t2ascii; 216 219 (*logout) << text_t2ascii << "Error: cgi argument \"" << info.shortname 217 220 << "\" was defined as being a single character option\n" … … 227 230 info.savedarginfo==cgiarginfo::mustnot)) { 228 231 if (logout != NULL) { 232 outconvertclass text_t2ascii; 229 233 (*logout) << text_t2ascii << "Error: it was specified that cgi argument \"" 230 234 << info.shortname << "\" should be saved in the state\n" … … 260 264 } 261 265 266 bool cgiargsinfoclass::addarginfo (ostream *logout, const text_t& argshortname, const text_tmap& mapinfo) 267 { 268 cgiarginfo *arginfo = getarginfo (argshortname); 269 if (arginfo == NULL) { 270 arginfo = &(argsinfo[argshortname]); 271 arginfo->shortname = argshortname; 272 arginfo->defaultstatus = cgiarginfo::config; 273 } 274 text_tmap::const_iterator thisInfo = mapinfo.begin(); 275 text_tmap::const_iterator endInfo = mapinfo.end(); 276 while (thisInfo != endInfo) { 277 if (thisInfo->first == "longname") arginfo->longname = thisInfo->second; 278 else if (thisInfo->first == "multiplechar") arginfo->multiplechar = (thisInfo->second == "true"); 279 else if (thisInfo->first == "defaultstatus") { 280 if (thisInfo->second == "none") arginfo->defaultstatus = cgiarginfo::none; 281 else if (thisInfo->second == "weak") arginfo->defaultstatus = cgiarginfo::weak; 282 else if (thisInfo->second == "good") arginfo->defaultstatus = cgiarginfo::good; 283 else if (thisInfo->second == "config") arginfo->defaultstatus = cgiarginfo::config; 284 else if (thisInfo->second == "imperative") arginfo->defaultstatus = cgiarginfo::imperative; 285 } 286 else if (thisInfo->first == "argdefault") { 287 arginfo->argdefault = thisInfo->second; 288 } 289 else if (thisInfo->first == "savedarginfo") { 290 if (thisInfo->second == "mustnot") arginfo->savedarginfo = cgiarginfo::mustnot; 291 else if (thisInfo->second == "can") arginfo->savedarginfo = cgiarginfo::can; 292 else if (thisInfo->second == "must") arginfo->savedarginfo = cgiarginfo::must; 293 } else if (logout != NULL) { 294 (*logout) << ("Invalid argument for cgiarg for " + argshortname + " (" + thisInfo->first + ")\n"); 295 } 296 thisInfo++; 297 } 298 return true; 299 } 300 301 bool cgiargsinfoclass::addarginfo (ostream *logout, const confcgiarg_tmap& info) 302 { 303 confcgiarg_tmap::const_iterator thisArg = info.begin(); 304 confcgiarg_tmap::const_iterator endArg = info.end(); 305 while (thisArg != endArg) { 306 if (!addarginfo(logout, thisArg->first, thisArg->second)) return false; 307 thisArg++; 308 } 309 return true; 310 } 311 262 312 cgiarginfo *cgiargsinfoclass::getarginfo (const text_t &key) { 263 313 iterator here = argsinfo.find (key); -
trunk/gsdl/src/recpt/cgiargs.h
r1285 r7429 50 50 // response_t is used to define what type of cgi header 51 51 // should be produced 52 enum response_t {location, content}; 52 // fullcontent same as content but the action should put content-type as last header. 53 enum response_t {location, content, fullcontent}; 53 54 54 55 … … 68 69 69 70 typedef map<text_t, cgiarg_t, lttext_t> cgiarg_tmap; 71 typedef map<text_t, text_tmap, lttext_t> confcgiarg_tmap; 70 72 71 73 // cgiargsclass is used to store a particular set … … 225 227 bool addarginfo (ostream *logout, const cgiargsinfoclass &info); 226 228 229 // addarginfo will override args info with info loaded from config files 230 // if the args do not exists will be created 231 bool addarginfo (ostream *logout, const text_t& argshortname, const text_tmap& mapinfo); 232 bool addarginfo (ostream *logout, const confcgiarg_tmap& info); 233 227 234 cgiarginfo *getarginfo (const text_t &key); 228 235 const cgiarginfo *getarginfo (const text_t &key) const;
Note:
See TracChangeset
for help on using the changeset viewer.