00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef _CGIUTILS_H_
00023 #define _CGIUTILS_H_ 1
00024
00025 #ifdef __GNUG__
00026 # pragma interface
00027 #endif
00028
00036 #include <new>
00037 #include <string>
00038 #include <fstream>
00039
00040 #include "cgicc/CgiDefs.h"
00041
00042 #if DEBUG
00043
00044 extern STDNS ofstream gLogFile;
00045 #define LOGLN(s) gLogFile << s << STDNS endl;
00046 #define LOG(s) gLogFile << s;
00047
00048 #else
00049
00056 #define LOGLN(s)
00057
00064 #define LOG(s)
00065
00066 #endif
00067
00068
00069 CGICC_BEGIN_NAMESPACE
00070
00079 CGICC_API STDNS string
00080 safeGetenv(const char *varName);
00081
00090 CGICC_API bool
00091 stringsAreEqual(const STDNS string& s1,
00092 const STDNS string& s2);
00093
00103 CGICC_API bool
00104 stringsAreEqual(const STDNS string& s1,
00105 const STDNS string& s2,
00106 size_t n);
00107
00116 CGICC_API int
00117 saferSystem(const STDNS string& command);
00118
00128 CGICC_API STDNS string
00129 unescapeString(const STDNS string& src);
00130
00145 CGICC_API char
00146 hexToChar(char first,
00147 char second);
00148
00164 STDNS string
00165 extractBetween(const STDNS string& data,
00166 const STDNS string& separator1,
00167 const STDNS string& separator2);
00168
00177 inline STDNS string
00178 extractBetween(const STDNS string& data,
00179 const STDNS string& separator)
00180 { return extractBetween(data, separator, separator); }
00181
00189 void
00190 writeString(STDNS ostream& out,
00191 const STDNS string& s);
00192
00200 void
00201 writeLong(STDNS ostream& out,
00202 unsigned long l);
00203
00211 STDNS string
00212 readString(STDNS istream& in);
00213
00221 unsigned long
00222 readLong(STDNS istream& in);
00223
00224 CGICC_END_NAMESPACE
00225
00226 #endif