cgicc: CgiUtils.h Source File

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

# CgiUtils.h

Go to the documentation of this file.

    00001 /* -*-mode:c++; c-file-style: "gnu";-*- */
    00002 /*
    00003  *  $Id: CgiUtils.h,v 1.16 2009/01/03 17:12:07 sebdiaz Exp $
    00004  *
    00005  *  Copyright (C) 1996 - 2004 Stephen F. Booth <sbooth@gnu.org>
    00006  *                       2007 Sebastien DIAZ <sebastien.diaz@gmail.com>
    00007  *  Part of the GNU cgicc library, http://www.gnu.org/software/cgicc
    00008  *
    00009  *  This library is free software; you can redistribute it and/or
    00010  *  modify it under the terms of the GNU Lesser General Public
    00011  *  License as published by the Free Software Foundation; either
    00012  *  version 3 of the License, or (at your option) any later version.
    00013  *
    00014  *  This library is distributed in the hope that it will be useful,
    00015  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
    00016  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00017  *  Lesser General Public License for more details.
    00018  *
    00019  *  You should have received a copy of the GNU Lesser General Public
    00020  *  License along with this library; if not, write to the Free Software
    00021  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
    00022  */
    00023
    00024 #ifndef _CGIUTILS_H_
    00025 #define _CGIUTILS_H_ 1
    00026
    00027 #ifdef __GNUG__
    00028 #  pragma interface
    00029 #endif
    00030
    00038 #include <new>
    00039 #include <string>
    00040 #include <fstream>
    00041
    00042 #include "cgicc/CgiDefs.h"
    00043
    00044
    00045 namespace cgicc {
    00046
    00055   CGICC_API bool
    00056   stringsAreEqual(const std::string& s1,
    00057                   const std::string& s2);
    00058
    00068   CGICC_API bool
    00069   stringsAreEqual(const std::string& ss1,
    00070                   const std::string& ss2,
    00071                   size_t n);
    00072
    00083   CGICC_API std::string
    00084   form_urldecode(const std::string& src);
    00085
    00093   CGICC_API std::string
    00094   form_urlencode(const std::string& src);
    00095
    00096
    00110   CGICC_API std::string
    00111   charToHex(char c);
    00112
    00127   CGICC_API char
    00128   hexToChar(char first,
    00129             char second);
    00130
    00146   std::string
    00147   extractBetween(const std::string& data,
    00148                  const std::string& separator1,
    00149                  const std::string& separator2);
    00150
    00159   inline std::string
    00160   extractBetween(const std::string& datas,
    00161                  const std::string& separators)
    00162   { return extractBetween(datas, separators, separators); }
    00163
    00171   void
    00172   writeString(std::ostream& out,
    00173               const std::string& s);
    00174
    00182   void
    00183   writeLong(std::ostream& out,
    00184             unsigned long l);
    00185
    00193   std::string
    00194   readString(std::istream& in);
    00195
    00203   unsigned long
    00204   readLong(std::istream& in);
    00205
    00206 } // namespace cgicc
    00207
    00208 #endif /* ! _CGIUTILS_H_ */