CgiUtils.h Source File

Main Page Namespace List Class Hierarchy Compound List File List Namespace Members Compound Members File Members Related Pages

# CgiUtils.h

Go to the documentation of this file.

    00001 /* -*-c++-*- */
    00002 /*
    00003  *  $Id: CgiUtils.h,v 1.5 2002/03/06 02:49:55 sbooth Exp $
    00004  *
    00005  *  Copyright (C) 1996 - 2002 Stephen F. Booth
    00006  *
    00007  *  This library is free software; you can redistribute it and/or
    00008  *  modify it under the terms of the GNU Lesser General Public
    00009  *  License as published by the Free Software Foundation; either
    00010  *  version 2.1 of the License, or (at your option) any later version.
    00011  *
    00012  *  This library is distributed in the hope that it will be useful,
    00013  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
    00014  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00015  *  Lesser General Public License for more details.
    00016  *
    00017  *  You should have received a copy of the GNU Lesser General Public
    00018  *  License along with this library; if not, write to the Free Software
    00019  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    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 /* ! _CGIUTILS_H_ */