CgiDefs.h   CgiDefs.h 
/* -*-c++-*- */ /* -*-c++-*- */
/* /*
* $Id: CgiDefs.h.in,v 1.6 2001/09/02 19:53:17 sbooth Exp $ * $Id: CgiDefs.h.in,v 1.8 2003/07/13 14:20:35 sbooth Exp $
* *
* Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 Stephen F. Booth * Copyright (C) 1996 - 2003 Stephen F. Booth
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either * License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version. * version 2.1 of the License, or (at your option) any later version.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details. * Lesser General Public License for more details.
skipping to change at line 47 skipping to change at line 47
/*! \namespace cgicc /*! \namespace cgicc
* \brief The namespace containing the cgicc library * \brief The namespace containing the cgicc library
* *
* The namespace containing all classes and functions of the * The namespace containing all classes and functions of the
* GNU cgicc library. * GNU cgicc library.
*/ */
// Win32-specific setup // Win32-specific setup
#ifdef WIN32 #ifdef WIN32
// always use namespaces
# define CGICC_USE_NAMESPACES 1
// export library symbols // export library symbols
# ifdef CGICC_EXPORTS # ifdef CGICC_EXPORTS
# define CGICC_API __declspec(dllexport) # define CGICC_API __declspec(dllexport)
# else # else
# define CGICC_API __declspec(dllimport) # define CGICC_API __declspec(dllimport)
# endif # endif
# define HOST "Win32" # define HOST "Win32"
# define VERSION "3.2.1" # define VERSION "3.2.3"
#else #else
# define CGICC_USE_NAMESPACES 1
# define CGICC_API # define CGICC_API
#endif /* WIN32 */ #endif /* WIN32 */
// Handle namespaces
#if CGICC_USE_NAMESPACES
# define CGICC_BEGIN_NAMESPACE namespace cgicc {
# define CGICC_END_NAMESPACE }
# define CGICCNS cgicc::
# define STDNS std::
#else
# define CGICC_BEGIN_NAMESPACE
# define CGICC_END_NAMESPACE
# define CGICCNS
# define STDNS
#endif /* CGICC_USE_NAMESPACES */
#endif /* ! _CGIDEFS_H_ */ #endif /* ! _CGIDEFS_H_ */
 End of changes. 6 change blocks. 
20 lines changed or deleted 3 lines changed or added


 CgiEnvironment.h   CgiEnvironment.h 
/* -*-c++-*- */ /* -*-c++-*- */
/* /*
* $Id: CgiEnvironment.h,v 1.12 2002/03/06 02:46:21 sbooth Exp $ * $Id: CgiEnvironment.h,v 1.15 2003/07/17 05:16:03 sbooth Exp $
* *
* Copyright (C) 1996 - 2002 Stephen F. Booth * Copyright (C) 1996 - 2003 Stephen F. Booth
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either * License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version. * version 2.1 of the License, or (at your option) any later version.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details. * Lesser General Public License for more details.
skipping to change at line 47 skipping to change at line 47
#include <string> #include <string>
#include <vector> #include <vector>
#include <cstdlib> #include <cstdlib>
#include "cgicc/CgiDefs.h" #include "cgicc/CgiDefs.h"
#include "cgicc/CgiUtils.h" #include "cgicc/CgiUtils.h"
#include "cgicc/CgiInput.h" #include "cgicc/CgiInput.h"
#include "cgicc/HTTPCookie.h" #include "cgicc/HTTPCookie.h"
CGICC_BEGIN_NAMESPACE namespace cgicc {
#ifdef WIN32 #ifdef WIN32
template class CGICC_API STDNS vector<HTTPCookie>; template class CGICC_API std::vector<HTTPCookie>;
#endif #endif
// ============================================================ // ============================================================
// Iterator typedefs // Iterator typedefs
// ============================================================ // ============================================================
//! A vector of HTTPCookie objects //! A vector of HTTPCookie objects
typedef STDNS vector<HTTPCookie>::iterator cookie_iterator; typedef std::vector<HTTPCookie>::iterator cookie_iterator;
//! A vector of \c const HTTPCookie objects //! A vector of \c const HTTPCookie objects
typedef STDNS vector<HTTPCookie>::const_iterator const_cookie_iterator; typedef std::vector<HTTPCookie>::const_iterator const_cookie_iterator;
// ============================================================ // ============================================================
// Class CgiEnvironment // Class CgiEnvironment
// ============================================================ // ============================================================
/*! \class CgiEnvironment CgiEnvironment.h cgicc/CgiEnvironment.h /*! \class CgiEnvironment CgiEnvironment.h cgicc/CgiEnvironment.h
* \brief Class encapsulating the CGI runtime environment * \brief Class encapsulating the CGI runtime environment
* *
* The \c CgiEnvironment class encapsulates the environment of * The \c CgiEnvironment class encapsulates the environment of
* the CGI application as described by the HTTP server. \c CgiEnvironment * the CGI application as described by the HTTP server. \c CgiEnvironmen
* contains the \c GET or \c POST data along with all environment variables t
* set by the HTTP server specified in the CGI specification. * contains the \c GET or \c POST data along with all environment variabl
*/ es
class CGICC_API CgiEnvironment * set by the HTTP server specified in the CGI specification.
{ */
public: class CGICC_API CgiEnvironment
{
public:
friend class Cgicc; friend class Cgicc;
// ============================================================ // ============================================================
/*! \name Constructor and Destructor */ /*! \name Constructor and Destructor */
//@{ //@{
/*! /*!
* \brief Read in the CGI environment passed to the CGI application * \brief Read in the CGI environment passed to the CGI application
* by the server * by the server
* *
* This function is not usually called directly; instead, an object of ty * This function is not usually called directly; instead, an object of
pe type
* CgiEnvironment is retrieved by calling the \c getEnvironment() method * CgiEnvironment is retrieved by calling the \c getEnvironment() metho
* on Cgicc. d
* If you are using %cgicc with FastCGI, you will need to pass * on Cgicc.
* a \c CgiInput subclass that %cgicc will use to read input. If * If you are using %cgicc with FastCGI, you will need to pass
* \c input is omitted, standard input and environment * a \c CgiInput subclass that %cgicc will use to read input. If
* variables will be used. * \c input is omitted, standard input and environment
* \param input A CgiInput object to use for reading input * variables will be used.
* \see Cgicc::getEnvironment * \param input A CgiInput object to use for reading input
*/ * \see Cgicc::getEnvironment
CgiEnvironment(CgiInput *input); */
CgiEnvironment(CgiInput *input);
/*! /*!
* \brief Destructor * \brief Destructor
* *
* Delete this CgiEnvironment object * Delete this CgiEnvironment object
*/ */
~CgiEnvironment(); ~CgiEnvironment();
//@} //@}
// ============================================================ // ============================================================
/*! \name Server Information /*! \name Server Information
* Information on the server handling the HTTP/CGI request * Information on the server handling the HTTP/CGI request
*/ */
//@{ //@{
/*! /*!
* \brief Get the name and version of the HTTP server software * \brief Get the name and version of the HTTP server software
* *
* For example, \c Apache/1.3.4 * For example, \c Apache/1.3.4
* \return The name of the server software * \return The name of the server software
*/ */
inline STDNS string inline std::string
getServerSoftware() const getServerSoftware() const
{ return fServerSoftware; } { return fServerSoftware; }
/*! /*!
* \brief Get the hostname, DNS name or IP address of the HTTP server * \brief Get the hostname, DNS name or IP address of the HTTP server
* *
* This is \e not a URL, for example \c www.gnu.org (no leading http://) * This is \e not a URL, for example \c www.gnu.org (no leading http://
* \return The name of the server )
*/ * \return The name of the server
inline STDNS string */
getServerName() const inline std::string
getServerName() const
{ return fServerName; } { return fServerName; }
/*! /*!
* \brief Get the name and version of the gateway interface. * \brief Get the name and version of the gateway interface.
* *
* This is usually \c CGI/1.1 * This is usually \c CGI/1.1
* \return The name and version of the gateway interface * \return The name and version of the gateway interface
*/ */
inline STDNS string inline std::string
getGatewayInterface() const getGatewayInterface() const
{ return fGatewayInterface;} { return fGatewayInterface;}
/*! /*!
* \brief Get the name and revision of the protocol used for this request * \brief Get the name and revision of the protocol used for this reque
. st.
* *
* This is usually \c HTTP/1.0 or \c HTTP/1.1 * This is usually \c HTTP/1.0 or \c HTTP/1.1
* \return The protocol in use * \return The protocol in use
*/ */
inline STDNS string inline std::string
getServerProtocol() const getServerProtocol() const
{ return fServerProtocol; } { return fServerProtocol; }
/*! /*!
* \brief Get the port number on the server to which this request was sen * \brief Get the port number on the server to which this request was s
t. ent.
* *
* This will usually be 80. * This will usually be 80.
* \return The port number * \return The port number
*/ */
inline unsigned long inline unsigned long
getServerPort() const getServerPort() const
{ return fServerPort; } { return fServerPort; }
/*! /*!
* \brief Determine if this is a secure request * \brief Determine if this is a secure request
* *
* A secure request is usually made using SSL via HTTPS * A secure request is usually made using SSL via HTTPS
* \return \c true if this connection is via https, \c false otherwise * \return \c true if this connection is via https, \c false otherwise
*/ */
inline bool inline bool
usingHTTPS() const usingHTTPS() const
{ return fUsingHTTPS; } { return fUsingHTTPS; }
//@} //@}
// ============================================================ // ============================================================
/*! \name CGI Query Information /*! \name CGI Query Information
* Information specific to this CGI query * Information specific to this CGI query
*/ */
//@{ //@{
/*! /*!
* \brief Get the HTTP cookies associated with this query, if any. * \brief Get the HTTP cookies associated with this query, if any.
* *
* The string returned by this method may contain multiple cookies; it is * The string returned by this method may contain multiple cookies; it
* recommended to use the method getCookieList() instead, which returns is
* a \c vector<HTTPCookie>. * recommended to use the method getCookieList() instead, which returns
* \return The HTTP cookies * a \c vector<HTTPCookie>.
* \see getCookieList * \return The HTTP cookies
*/ * \see getCookieList
inline STDNS string */
getCookies() const inline std::string
getCookies() const
{ return fCookie; } { return fCookie; }
/*! /*!
* \brief Get a \c vector containing the HTTP cookies * \brief Get a \c vector containing the HTTP cookies
* associated with this query * associated with this query
* *
* This vector may be empty * This vector may be empty
* \return A \c vector containing the HTTP cookies associated with this * \return A \c vector containing the HTTP cookies associated with this
* query * query
* \see HTTPCookie * \see HTTPCookie
*/ */
inline const STDNS vector<HTTPCookie>& inline const std::vector<HTTPCookie>&
getCookieList() const getCookieList() const
{ return fCookies; } { return fCookies; }
/*! /*!
* \brief Get the request method used for this query. * \brief Get the request method used for this query.
* *
* This is usually one of \c GET or \c POST * This is usually one of \c GET or \c POST
* \return The request method * \return The request method
*/ */
inline STDNS string inline std::string
getRequestMethod() const getRequestMethod() const
{ return fRequestMethod; } { return fRequestMethod; }
/*! /*!
* \brief Get the extra path information for this request, given by the * \brief Get the extra path information for this request, given by the
* client. * client.
* *
* For example, in the string \c foo.cgi/cgicc the path information is * For example, in the string \c foo.cgi/cgicc the path information is
* \c cgicc. * \c cgicc.
* \return The absolute path info * \return The absolute path info
*/ */
inline STDNS string inline std::string
getPathInfo() const getPathInfo() const
{ return fPathInfo; } { return fPathInfo; }
/*! /*!
* \brief Get the translated path information (virtual to physical mappin * \brief Get the translated path information (virtual to physical mapp
g). ing).
* *
* For example, \c www.gnu.org may be translated to \c /htdocs/index.html * For example, \c www.gnu.org may be translated to \c /htdocs/index.ht
* \return The translated path info ml
*/ * \return The translated path info
inline STDNS string */
getPathTranslated() const inline std::string
getPathTranslated() const
{ return fPathTranslated; } { return fPathTranslated; }
/*! /*!
* \brief Get the full path to this CGI application * \brief Get the full path to this CGI application
* *
* This is useful for self-referencing URIs * This is useful for self-referencing URIs
* \return The full path of this application * \return The full path of this application
*/ */
inline STDNS string inline std::string
getScriptName() const getScriptName() const
{ return fScriptName; } { return fScriptName; }
/*! /*!
* \brief Get the query string for this request. * \brief Get the query string for this request.
* *
* The query string follows the <TT>?</TT> in the URI which called this * The query string follows the <tt>?</tt> in the URI which called this
* application. This is usually only valid for scripts called with * application. This is usually only valid for scripts called with
* the \c GET method. For example, in the string \c foo.cgi?cgicc=yes * the \c GET method. For example, in the string \c foo.cgi?cgicc=yes
* the query string is \c cgicc=yes. * the query string is \c cgicc=yes.
* @return The query string * @return The query string
*/ */
inline STDNS string inline std::string
getQueryString() const getQueryString() const
{ return fQueryString; } { return fQueryString; }
/*! /*!
* \brief Get the length of the data read from standard input, in chars. * \brief Get the length of the data read from standard input, in chars
* .
* This is usually only valid for scripts called with the POST method. *
* \return The data length * This is usually only valid for scripts called with the POST method.
*/ * \return The data length
inline unsigned long */
getContentLength() const inline unsigned long
getContentLength() const
{ return fContentLength; } { return fContentLength; }
/*! /*!
* \brief Get the content type of the submitted information. * \brief Get the content type of the submitted information.
* *
* For applications called via the GET method, this information is * For applications called via the GET method, this information is
* irrelevant. For applications called with the POST method, this is * irrelevant. For applications called with the POST method, this is
* specifies the MIME type of the information, * specifies the MIME type of the information,
* usually \c application/x-www-form-urlencoded or as specified by * usually \c application/x-www-form-urlencoded or as specified by
* getContentType(). * getContentType().
* \return The content type * \return The content type
* \see getContentType * \see getContentType
*/ */
inline STDNS string inline std::string
getContentType() const getContentType() const
{ return fContentType; } { return fContentType; }
/*! /*!
* \brief Get the data passed to the CGI application via standard input. * \brief Get the data passed to the CGI application via standard input
* .
* This data is of MIME type \c getContentType(). *
* \return The post data. * This data is of MIME type \c getContentType().
*/ * \return The post data.
inline STDNS string */
getPostData() const inline std::string
getPostData() const
{ return fPostData; } { return fPostData; }
//@} //@}
// ============================================================ // ============================================================
/*! \name Server Specific Information /*! \name Server Specific Information
* Information dependent on the type of HTTP server in use * Information dependent on the type of HTTP server in use
*/ */
//@{ //@{
/*! /*!
* \brief Get the URL of the page which called this CGI application. * \brief Get the URL of the page which called this CGI application.
* *
* Depending on the HTTP server software, this value may not be set. * Depending on the HTTP server software, this value may not be set.
* \return The URI which called this application. * \return The URI which called this application.
*/ */
inline STDNS string inline std::string
getReferrer() const getReferrer() const
{ return fReferrer; } { return fReferrer; }
//@} //@}
// ============================================================ // ============================================================
/*! \name Remote User Information /*! \name Remote User Information
* Information about the user making the CGI request * Information about the user making the CGI request
*/ */
//@{ //@{
/*! /*!
* \brief Get the hostname of the remote machine making this request * \brief Get the hostname of the remote machine making this request
* *
* This may be either an IP address or a hostname * This may be either an IP address or a hostname
* \return The remote host * \return The remote host
*/ */
inline STDNS string inline std::string
getRemoteHost() const getRemoteHost() const
{ return fRemoteHost; } { return fRemoteHost; }
/*! /*!
* \brief Get the IP address of the remote machine making this request * \brief Get the IP address of the remote machine making this request
* *
* This is a standard IP address of the form \c 123.123.123.123 * This is a standard IP address of the form \c 123.123.123.123
* \return The remote IP address * \return The remote IP address
*/ */
inline STDNS string inline std::string
getRemoteAddr() const getRemoteAddr() const
{ return fRemoteAddr; } { return fRemoteAddr; }
/*! /*!
* \brief Get the protocol-specific user authentication method used. * \brief Get the protocol-specific user authentication method used.
* *
* This is only applicable if the server supports user authentication, * This is only applicable if the server supports user authentication,
* and the user has authenticated. * and the user has authenticated.
* \return The authorization type * \return The authorization type
*/ */
inline STDNS string inline std::string
getAuthType() const getAuthType() const
{ return fAuthType; } { return fAuthType; }
/*! /*!
* \brief Get the authenticated remote user name. * \brief Get the authenticated remote user name.
* *
* This is only applicable if the server supports user authentication, * This is only applicable if the server supports user authentication,
* and the user has authenticated. * and the user has authenticated.
* \return The remote username * \return The remote username
*/ */
inline STDNS string inline std::string
getRemoteUser() const getRemoteUser() const
{ return fRemoteUser; } { return fRemoteUser; }
/*! /*!
* \brief Get the remote user name retrieved from the server. * \brief Get the remote user name retrieved from the server.
* *
* This is only applicable if the server supports RFC 931 * This is only applicable if the server supports RFC 931
* identification. This variable should \e only be used * identification. This variable should \e only be used
* for logging purposes. * for logging purposes.
* \return The remote identification * \return The remote identification
* \see RFC 1431 at * \see RFC 1431 at
* http://info.internet.isi.edu:80/in-notes/rfc/files/rfc1413.txt * http://info.internet.isi.edu:80/in-notes/rfc/files/rfc1413.txt
*/ */
inline STDNS string inline std::string
getRemoteIdent() const getRemoteIdent() const
{ return fRemoteIdent; } { return fRemoteIdent; }
/*! /*!
* \brief Get the MIME data types accepted by the client's browser. * \brief Get the MIME data types accepted by the client's browser.
* *
* For example <TT>image/gif, image/x-xbitmap, image/jpeg, image/pjpeg</T * For example <TT>image/gif, image/x-xbitmap, image/jpeg, image/pjpeg<
T> /TT>
* \return The accepted data types * \return The accepted data types
*/ */
inline STDNS string inline std::string
getAccept() const getAccept() const
{ return fAccept; } { return fAccept; }
/*! /*!
* \brief Get the name of the browser used for this CGI request. * \brief Get the name of the browser used for this CGI request.
* *
* For example <TT>Mozilla/5.0 (X11; U; Linux 2.4.0 i686; en-US; 0.8.1) * For example <TT>Mozilla/5.0 (X11; U; Linux 2.4.0 i686; en-US; 0.8.1)
* Gecko/20010421</TT> * Gecko/20010421</TT>
* \return The browser name * \return The browser name
*/ */
inline STDNS string inline std::string
getUserAgent() const getUserAgent() const
{ return fUserAgent; } { return fUserAgent; }
//@} //@}
// ============================================================ // ============================================================
/*! \name ErrorDocument Handling /*! \name ErrorDocument Handling
* For a tutorial on ErrorDocument handling, see * For a tutorial on ErrorDocument handling, see
* http://hoohoo.ncsa.uiuc.edu/cgi/ErrorCGI.html * http://hoohoo.ncsa.uiuc.edu/cgi/ErrorCGI.html
*/ */
//@{ //@{
/*! /*!
* \brief Get the redirect request. * \brief Get the redirect request.
* *
* This will only be valid if you are using this script as a script * This will only be valid if you are using this script as a script
* to use in place of the default server messages. * to use in place of the default server messages.
* @return The redirect request. * @return The redirect request.
*/ */
inline STDNS string inline std::string
getRedirectRequest() const getRedirectRequest() const
{ return fRedirectRequest; } { return fRedirectRequest; }
/*! /*!
* \brief Get the redirect URL. * \brief Get the redirect URL.
* *
* This will only be valid if you are using this script as a script * This will only be valid if you are using this script as a script
* to use in place of the default server messages. * to use in place of the default server messages.
* \return The redirect URL. * \return The redirect URL.
* \see \URL{http://hoohoo.ncsa.uiuc.edu/docs/setup/srm/ErrorDocument.htm * \see http://hoohoo.ncsa.uiuc.edu/docs/setup/srm/ErrorDocument.html
l} */
*/ inline std::string
inline STDNS string getRedirectURL() const
getRedirectURL() const
{ return fRedirectURL; } { return fRedirectURL; }
/*! /*!
* \brief Get the redirect status. * \brief Get the redirect status.
* *
* This will only be valid if you are using this script as a script * This will only be valid if you are using this script as a script
* to use in place of the default server messages. * to use in place of the default server messages.
* \return The redirect status. * \return The redirect status.
*/ */
inline STDNS string inline std::string
getRedirectStatus() const getRedirectStatus() const
{ return fRedirectStatus; } { return fRedirectStatus; }
//@} //@}
protected: protected:
// ============================================================ // ============================================================
/*! \name Saving and Restoring /*! \name Saving and Restoring
* These are implementation methods only * These are implementation methods only
*/ */
//@{ //@{
/*! /*!
* \brief Implementation of save, for saving CGI environments * \brief Implementation of save, for saving CGI environments
* *
* This is called internally by Cgicc * This is called internally by Cgicc
* \param filename The name of the file to which to save * \param filename The name of the file to which to save
*/ */
void void
save(const STDNS string& filename) const; save(const std::string& filename) const;
/*! /*!
* \brief Implementation of restore, for restoring CGI environments * \brief Implementation of restore, for restoring CGI environments
* *
* This is called internally by Cgicc * This is called internally by Cgicc
* \param filename The name of the file from which to restore * \param filename The name of the file from which to restore
*/ */
// Implementation of restore // Implementation of restore
void void
restore(const STDNS string& filename); restore(const std::string& filename);
//@} //@}
// ============================================================ // ============================================================
private: private:
// Parse the list of cookies from a string to a vector // Parse the list of cookies from a string to a vector
void void
parseCookies(); parseCookies();
// Parse a single cookie string (name=value) pair // Parse a single cookie string (name=value) pair
void void
parseCookie(const STDNS string& data); parseCookie(const std::string& data);
// Read in all the environment variables // Read in all the environment variables
void void
readEnvironmentVariables(CgiInput *input); readEnvironmentVariables(CgiInput *input);
unsigned long fServerPort; unsigned long fServerPort;
unsigned long fContentLength; unsigned long fContentLength;
bool fUsingHTTPS; bool fUsingHTTPS;
STDNS string fServerSoftware; std::string fServerSoftware;
STDNS string fServerName; std::string fServerName;
STDNS string fGatewayInterface; std::string fGatewayInterface;
STDNS string fServerProtocol; std::string fServerProtocol;
STDNS string fRequestMethod; std::string fRequestMethod;
STDNS string fPathInfo; std::string fPathInfo;
STDNS string fPathTranslated; std::string fPathTranslated;
STDNS string fScriptName; std::string fScriptName;
STDNS string fQueryString; std::string fQueryString;
STDNS string fRemoteHost; std::string fRemoteHost;
STDNS string fRemoteAddr; std::string fRemoteAddr;
STDNS string fAuthType; std::string fAuthType;
STDNS string fRemoteUser; std::string fRemoteUser;
STDNS string fRemoteIdent; std::string fRemoteIdent;
STDNS string fContentType; std::string fContentType;
STDNS string fAccept; std::string fAccept;
STDNS string fUserAgent; std::string fUserAgent;
STDNS string fPostData; std::string fPostData;
STDNS string fRedirectRequest; std::string fRedirectRequest;
STDNS string fRedirectURL; std::string fRedirectURL;
STDNS string fRedirectStatus; std::string fRedirectStatus;
STDNS string fReferrer; std::string fReferrer;
STDNS string fCookie; std::string fCookie;
STDNS vector<HTTPCookie> fCookies; std::vector<HTTPCookie> fCookies;
}; };
CGICC_END_NAMESPACE } // namespace cgicc
#endif /* ! _CGIENVIRONMENT_H_ */ #endif /* ! _CGIENVIRONMENT_H_ */
 End of changes. 66 change blocks. 
396 lines changed or deleted 403 lines changed or added


 CgiInput.h   CgiInput.h 
/* -*-c++-*- */ /* -*-c++-*- */
/* /*
* $Id: CgiInput.h,v 1.2 2002/03/03 17:39:52 sbooth Exp $ * $Id: CgiInput.h,v 1.4 2003/07/13 14:20:35 sbooth Exp $
* *
* Copyright (C) 1996 - 2002 Stephen F. Booth * Copyright (C) 1996 - 2003 Stephen F. Booth
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either * License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version. * version 2.1 of the License, or (at your option) any later version.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details. * Lesser General Public License for more details.
skipping to change at line 40 skipping to change at line 40
* \brief Class that abstracts a data source * \brief Class that abstracts a data source
* *
* This class allows the data source for the CGI application to be * This class allows the data source for the CGI application to be
* something other than standard input. * something other than standard input.
*/ */
#include <string> #include <string>
#include "cgicc/CgiDefs.h" #include "cgicc/CgiDefs.h"
CGICC_BEGIN_NAMESPACE namespace cgicc {
// ============================================================
// Class CgiInput
// ============================================================
/*! \class CgiInput CgiInput.h cgicc/CgiInput.h
* \brief Class that abstracts a data source
*
* The \c CgiInput class is an abstraction for all input data to the
* CGI application. This allows input data to come from something other tha
n
* standard input (cin). This is useful, in fact necessary, when using
* %cgicc with FastCgi.
* Library users wishing to exploit this functionality should create a
* subclass and override the \c read and \c getenv methods.
*/
class CGICC_API CgiInput
{
public:
// ============================================================ // ============================================================
// Class CgiInput
// ============================================================
/*! \name Constructor and Destructor */ /*! \class CgiInput CgiInput.h cgicc/CgiInput.h
//@{ * \brief Class that abstracts a data source
/*!
* \brief Constructor
* *
* Create a new CgiInput object * The \c CgiInput class is an abstraction for all input data to the
* CGI application. This allows input data to come from something other t
han
* standard input (cin). This is useful, in fact necessary, when using
* %cgicc with FastCgi.
* Library users wishing to exploit this functionality should create a
* subclass and override the \c read and \c getenv methods.
*/ */
inline class CGICC_API CgiInput
CgiInput() {
{} public:
/*! // ============================================================
* \brief Copy constructor
*
* If you subclass CgiInput, you <strong>must</strong> overload
* operator=
* \param input The CgiInput object to copy
*/
inline
CgiInput(const CgiInput& input)
{ operator=(input); }
/*! /*! \name Constructor and Destructor */
* \brief Destructor //@{
*
* Delete this CgiInput object
*/
virtual ~CgiInput();
//@}
// ============================================================ /*!
* \brief Constructor
*
* Create a new CgiInput object
*/
inline
CgiInput()
{}
/*! \name Overloaded Operators */ /*!
//@{ * \brief Copy constructor
*
* If you subclass CgiInput, you <strong>must</strong> overload
* operator=
* \param input The CgiInput object to copy
*/
inline
CgiInput(const CgiInput& input)
{ operator=(input); }
/*! /*!
* \brief Compare two CgiInput objects for equality * \brief Destructor
* *
* In the default implementation all CgiInput objects are equal * Delete this CgiInput object
* \param input The CgiInput object to compare to this one */
* \return \c true virtual ~CgiInput();
*/ //@}
inline bool
operator== (const CgiInput& /*input*/) const // ============================================================
/*! \name Overloaded Operators */
//@{
/*!
* \brief Compare two CgiInput objects for equality
*
* In the default implementation all CgiInput objects are equal
* \param input The CgiInput object to compare to this one
* \return \c true
*/
inline bool
operator== (const CgiInput& /*input*/) const
{ return true; } { return true; }
/*! /*!
* \brief Compare two CgiInput objects for inequality * \brief Compare two CgiInput objects for inequality
* *
* In the default implementation all CgiInput objects are equal * In the default implementation all CgiInput objects are equal
* \param input The CgiInput object to compare to this one * \param input The CgiInput object to compare to this one
* \return \c false * \return \c false
*/ */
inline bool inline bool
operator!= (const CgiInput& input) const operator!= (const CgiInput& input) const
{ return ! operator==(input); } { return ! operator==(input); }
/*! /*!
* \brief Assign one CgiInput to another * \brief Assign one CgiInput to another
* *
* Does nothing in the default implementation * Does nothing in the default implementation
* \param input The CgiInput object to copy * \param input The CgiInput object to copy
* \return A reference to this. * \return A reference to this.
*/ */
inline CgiInput& inline CgiInput&
operator= (const CgiInput& /*input*/) operator= (const CgiInput& /*input*/)
{ return *this; } { return *this; }
//@} //@}
// ============================================================ // ============================================================
/*! \name Data Sources */ /*! \name Data Sources */
//@{ //@{
/*! /*!
* \brief Read data from a data source * \brief Read data from a data source
* *
* In the default implementation, this is a wrapper for \c cin.read() * In the default implementation, this is a wrapper for \c cin.read()
* \param data The target buffer * \param data The target buffer
* \param length The number of characters to read * \param length The number of characters to read
* \return The number of characters read * \return The number of characters read
*/ */
virtual size_t read(char *data, size_t length); virtual size_t read(char *data, size_t length);
/*! /*!
* \brief Query the value of an environment variable * \brief Query the value of an environment variable
* *
* In the default implementation, this is a wrapper for std::getenv() * In the default implementation, this is a wrapper for std::getenv()
* \param varName The name of an environment variable * \param varName The name of an environment variable
* \return The value of the requested environment variable, or an empty * \return The value of the requested environment variable, or an empty
* string if not found. * string if not found.
*/ */
virtual STDNS string getenv(const char *varName); virtual std::string getenv(const char *varName);
//@} //@}
}; };
CGICC_END_NAMESPACE } // namespace cgicc
#endif /* ! _CGIINPUT_H_ */ #endif /* ! _CGIINPUT_H_ */
 End of changes. 19 change blocks. 
104 lines changed or deleted 104 lines changed or added


 CgiUtils.h   CgiUtils.h 
/* -*-c++-*- */ /* -*-c++-*- */
/* /*
* $Id: CgiUtils.h,v 1.5 2002/03/06 02:49:55 sbooth Exp $ * $Id: CgiUtils.h,v 1.10 2003/07/13 14:20:35 sbooth Exp $
* *
* Copyright (C) 1996 - 2002 Stephen F. Booth * Copyright (C) 1996 - 2003 Stephen F. Booth
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either * License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version. * version 2.1 of the License, or (at your option) any later version.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details. * Lesser General Public License for more details.
skipping to change at line 44 skipping to change at line 44
*/ */
#include <new> #include <new>
#include <string> #include <string>
#include <fstream> #include <fstream>
#include "cgicc/CgiDefs.h" #include "cgicc/CgiDefs.h"
#if DEBUG #if DEBUG
extern STDNS ofstream gLogFile; extern std::ofstream gLogFile;
#define LOGLN(s) gLogFile << s << STDNS endl; #define LOGLN(s) gLogFile << s << std::endl;
#define LOG(s) gLogFile << s; #define LOG(s) gLogFile << s;
#else #else
/*! /*!
* \brief Output a string to the debugging log, followed by a newline. * \brief Output a string to the debugging log, followed by a newline.
* *
* The debugging log is a user-specified \c ostream. * The debugging log is a user-specified \c ostream.
* \param s The string to log * \param s The string to log
*/ */
skipping to change at line 68 skipping to change at line 68
/*! /*!
* \brief Output a string to the debugging log * \brief Output a string to the debugging log
* *
* The debugging log is a user-specified \c ostream. * The debugging log is a user-specified \c ostream.
* \param s The string to log * \param s The string to log
*/ */
#define LOG(s) #define LOG(s)
#endif #endif
CGICC_BEGIN_NAMESPACE namespace cgicc {
/*! /*!
* \brief Query the value of an environment variable * \brief Compare two strings for equality, ignoring case.
* *
* This function is used internally by CgiEnvironment * For case-sensitive comparison, use (s1 == s2);
* \param varName The name of an environment variable * \param s1 The first string to compare
* \return The value of the requested environment variable, or an empty * \param s2 The second string to compare
* string if not found. * \return \c true if the strings are equal, \c false if they are not
*/ */
CGICC_API STDNS string CGICC_API bool
safeGetenv(const char *varName); stringsAreEqual(const std::string& s1,
const std::string& s2);
/*! /*!
* \brief Compare two strings for equality, ignoring case. * \brief Compare two strings for equality, ignoring case.
* *
* For case-sensitive comparison, use (s1 == s2); * For case-sensitive comparison, use (s1 == s2);
* \param s1 The first string to compare * \param s1 The first string to compare
* \param s2 The second string to compare * \param s2 The second string to compare
* \return \c true if the strings are equal, \c false if they are not * \param n The number of characters to compare.
*/ * \return \c true if the strings are equal, \c false if they are not
CGICC_API bool */
stringsAreEqual(const STDNS string& s1, CGICC_API bool
const STDNS string& s2); stringsAreEqual(const std::string& s1,
const std::string& s2,
size_t n);
/*! /*!
* \brief Compare two strings for equality, ignoring case. * \brief Convert an ASCII string to a URL-safe string.
* *
* For case-sensitive comparison, use (s1 == s2); * For example, '!' is converted to "%21" and ' ' is converted to '+'.
* \param s1 The first string to compare * \param src The src string containing the characters to encode
* \param s2 The second string to compare * \return The converted string
* \param n The number of characters to compare. */
* \return \c true if the strings are equal, \c false if they are not CGICC_API std::string
*/ form_urldecode(const std::string& src);
CGICC_API bool
stringsAreEqual(const STDNS string& s1,
const STDNS string& s2,
size_t n);
/*! /*!
* \brief A safer alternative to system(). * \brief Convert encoded characters in form data to normal ASCII.
* *
* This command will escape out (by prepending \) all semicolons, pipes * For example, "%21" is converted to '!' and '+' is converted to a space
* and redirects (;|<>) present in the command string. .
* \param command The command to be sanitized and run * Normally, this is called internally to decode the query string or post
* \return The result of running the sanitized version of \e command * data.
*/ * \param src The src string containing the encoded characters
CGICC_API int * \return The converted string
saferSystem(const STDNS string& command); */
CGICC_API std::string
form_urlencode(const std::string& src);
/*! /*!
* \brief Convert encoded characters in form data to normal ASCII. * \brief Convert an ASCII character to its hexadecimal equivalent.
* *
* For example, %21 is converted to ! and + is converted to a space. * For example, after the call
* Normally, this is called internally to decode the query string or post * \code
* data. * string s = charToHex(':');
* \param src The src string containing the encoded characters * \endcode
* \return The converted string * \c s will have a value of "3A".
*/ * Normally, this is called internally to encode characters by
CGICC_API STDNS string * escapeString.
unescapeString(const STDNS string& src); * \param c The character to encode
* \return A string representing the hexadecimal value of c
*/
CGICC_API std::string
charToHex(char c);
/*! /*!
* \brief Convert a hex-encoded character to its ASCII equivalent. * \brief Convert a hex-encoded character to its ASCII equivalent.
* *
* For example, after the call * For example, after the call
* \code * \code
* char c = hexToChar('2', '1'); * char c = hexToChar('2', '1');
* \endcode * \endcode
* \c c will have a value of '!'. * \c c will have a value of '!'.
* Normally, this is called internally to decode encoded characters in * Normally, this is called internally to decode encoded characters in
* the query string or post data. * the query string or post data.
* \param first The first character of the hex value * \param first The first hex digit
* \param second the second character of the hex value * \param second The second hex digit
* \return The ASCII character * \return The ASCII character
*/ */
CGICC_API char CGICC_API char
hexToChar(char first, hexToChar(char first,
char second); char second);
/*! /*!
* \brief Extract a substring contained within two separators. * \brief Extract a substring contained within two separators.
* *
* For example, after the call * For example, after the call
* \code * \code
* STDNS string data = "11foo22"; * std::string data = "11foo22";
* STDNS string res; * std::string res;
* res = extractBetween(data, "11", "22"); * res = extractBetween(data, "11", "22");
* \endcode * \endcode
* \c res will be "foo". * \c res will be "foo".
* \param data The data to search. * \param data The data to search.
* \param separator1 The first logical separator. * \param separator1 The first logical separator.
* \param separator2 The second logical separator. * \param separator2 The second logical separator.
* \return The substring between the separators. * \return The substring between the separators.
*/ */
STDNS string std::string
extractBetween(const STDNS string& data, extractBetween(const std::string& data,
const STDNS string& separator1, const std::string& separator1,
const STDNS string& separator2); const std::string& separator2);
/*! /*!
* \brief Extract a substring contained between a separator. * \brief Extract a substring contained between a separator.
* *
* This function is used internally to decode \c multipart/form-data * This function is used internally to decode \c multipart/form-data
* \param data The data to search. * \param data The data to search.
* \param separator The separator. * \param separator The separator.
* \return The substring between the separator. * \return The substring between the separator.
*/ */
inline STDNS string inline std::string
extractBetween(const STDNS string& data, extractBetween(const std::string& data,
const STDNS string& separator) const std::string& separator)
{ return extractBetween(data, separator, separator); } { return extractBetween(data, separator, separator); }
/*! /*!
* \brief Write a string to an ostream. * \brief Write a string to an ostream.
* *
* This function is used internally for saving environments. * This function is used internally for saving environments.
* \param out The ostream to which to write. * \param out The ostream to which to write.
* \param s The string to write. * \param s The string to write.
*/ */
void void
writeString(STDNS ostream& out, writeString(std::ostream& out,
const STDNS string& s); const std::string& s);
/*! /*!
* \brief Write a long to an ostream. * \brief Write a long to an ostream.
* *
* This function is used internally for saving environments. * This function is used internally for saving environments.
* \param out The ostream to which to write. * \param out The ostream to which to write.
* \param l The long to write. * \param l The long to write.
*/ */
void void
writeLong(STDNS ostream& out, writeLong(std::ostream& out,
unsigned long l); unsigned long l);
/*! /*!
* \brief Read a string from an istream. * \brief Read a string from an istream.
* *
* This function is used internally by cgicc for restoring environments. * This function is used internally by cgicc for restoring environments.
* \param in The istream from which to read. * \param in The istream from which to read.
* \return The string read. * \return The string read.
*/ */
STDNS string std::string
readString(STDNS istream& in); readString(std::istream& in);
/*! /*!
* \brief Read a long from an istream. * \brief Read a long from an istream.
* *
* This function is used internally by cgicc for restoring environments. * This function is used internally by cgicc for restoring environments.
* \param in The istream from which to read. * \param in The istream from which to read.
* \return The long read. * \return The long read.
*/ */
unsigned long unsigned long
readLong(STDNS istream& in); readLong(std::istream& in);
CGICC_END_NAMESPACE } // namespace cgicc
#endif /* ! _CGIUTILS_H_ */ #endif /* ! _CGIUTILS_H_ */
 End of changes. 17 change blocks. 
147 lines changed or deleted 152 lines changed or added


 Cgicc.h   Cgicc.h 
/* -*-c++-*- */ /* -*-c++-*- */
/* /*
* $Id: Cgicc.h,v 1.11 2002/03/09 18:34:18 sbooth Exp $ * $Id: Cgicc.h,v 1.13 2003/07/13 14:20:35 sbooth Exp $
* *
* Copyright (C) 1996 - 2002 Stephen F. Booth * Copyright (C) 1996 - 2003 Stephen F. Booth
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either * License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version. * version 2.1 of the License, or (at your option) any later version.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details. * Lesser General Public License for more details.
skipping to change at line 50 skipping to change at line 50
#include <vector> #include <vector>
#include <string> #include <string>
#include "cgicc/CgiDefs.h" #include "cgicc/CgiDefs.h"
#include "cgicc/FormEntry.h" #include "cgicc/FormEntry.h"
#include "cgicc/FormFile.h" #include "cgicc/FormFile.h"
#include "cgicc/CgiInput.h" #include "cgicc/CgiInput.h"
#include "cgicc/CgiEnvironment.h" #include "cgicc/CgiEnvironment.h"
CGICC_BEGIN_NAMESPACE namespace cgicc {
#ifdef WIN32 #ifdef WIN32
template class CGICC_API STDNS vector<FormEntry>; template class CGICC_API std::vector<FormEntry>;
template class CGICC_API STDNS vector<FormFile>; template class CGICC_API std::vector<FormFile>;
#endif #endif
class MultipartHeader; class MultipartHeader;
// ============================================================
// Iterator typedefs
// ============================================================
//! A vector of FormEntry objects
typedef STDNS vector<FormEntry>::iterator form_iterator;
//! A vector of \c const FormEntry objects
typedef STDNS vector<FormEntry>::const_iterator const_form_iterator;
//! A vector of FormFile objects // ============================================================
typedef STDNS vector<FormFile>::iterator file_iterator; // Iterator typedefs
//! A vector of \c const FormFile objects // ============================================================
typedef STDNS vector<FormFile>::const_iterator const_file_iterator;
// ============================================================ //! A vector of FormEntry objects
// Class Cgicc typedef std::vector<FormEntry>::iterator form_iterator;
// ============================================================ //! A vector of \c const FormEntry objects
typedef std::vector<FormEntry>::const_iterator const_form_iterator;
/*! \class Cgicc Cgicc.h cgicc/Cgicc.h //! A vector of FormFile objects
* \brief The main class of the GNU %cgicc library typedef std::vector<FormFile>::iterator file_iterator;
* //! A vector of \c const FormFile objects
* Cgicc is used to retrieve information on specific HTML form elements typedef std::vector<FormFile>::const_iterator const_file_iterator;
* (such as checkboxes, radio buttons, and text fields), on uploaded files,
* and to save, restore, and retrieve information on the CGI
* environment.
*
* Normally, you will instantiate an object of this type in
* \c main():
* \code
* int
* main(int argc, char **argv) {
* try {
* cgicc::Cgicc cgi;
* // do something with cgi
* }
*
* catch(const exception& e) {
* //handle the error
* }
* }
* \endcode
*/
class CGICC_API Cgicc {
public:
// ============================================================ // ============================================================
// Class Cgicc
// ============================================================
/*! \name Constructor and Destructor */ /*! \class Cgicc Cgicc.h cgicc/Cgicc.h
//@{ * \brief The main class of the GNU %cgicc library
/*!
* \brief Constructor
* *
* If you are using %cgicc with FastCGI, you will need to pass * Cgicc is used to retrieve information on specific HTML form elements
* a \c CgiInput subclass that %cgicc will use to read input. If * (such as checkboxes, radio buttons, and text fields), on uploaded file
* \c input is omitted, standard input and environment s,
* variables will be used. * and to save, restore, and retrieve information on the CGI
* \param input A CgiInput object to use for reading input * environment.
*/
Cgicc(CgiInput *input = 0);
/*!
* \brief Destructor
* *
* Delete this Cgicc object * Normally, you will instantiate an object of this type in
* \c main():
* \code
* int
* main(int argc, char **argv) {
* try {
* cgicc::Cgicc cgi;
* // do something with cgi
* }
*
* catch(const exception& e) {
* //handle the error
* }
* }
* \endcode
*/ */
~Cgicc(); class CGICC_API Cgicc {
//@} public:
// ============================================================ // ============================================================
/*! \name Library Information /*! \name Constructor and Destructor */
* Information on this installation of %cgicc //@{
*/
//@{
/*! /*!
* \brief Get the date on which this library was compiled. * \brief Constructor
* *
* This is a string of the form <TT>mmm dd yyyy</TT>. * If you are using %cgicc with FastCGI, you will need to pass
* \return The compile date * a \c CgiInput subclass that %cgicc will use to read input. If
*/ * \c input is omitted, standard input and environment
const char* * variables will be used.
getCompileDate() const; * \param input A CgiInput object to use for reading input
*/
Cgicc(CgiInput *input = 0);
/*! /*!
* \brief Get the time at which this library was compiled. * \brief Destructor
* *
* This is a string of the form \c hh:mm:ss in 24-hour time. * Delete this Cgicc object
* \return The compile time */
*/ ~Cgicc();
const char* //@}
getCompileTime() const;
/*! // ============================================================
* \brief Get the version number of cgicc.
*
* The version number is a string of the form \c #.#.
* \return The version number
*/
const char*
getVersion() const;
/*! /*! \name Library Information
* \brief Get the platform for which Cgicc was configured. * Information on this installation of %cgicc
* */
* The host is a string of the form \c processor-manufacturer-os //@{
* return The host triplet.
*/
const char*
getHost() const;
//@}
// ============================================================ /*!
* \brief Get the date on which this library was compiled.
*
* This is a string of the form <TT>mmm dd yyyy</TT>.
* \return The compile date
*/
const char*
getCompileDate() const;
/*! \name Form Element Access /*!
* Information on submitted form elements * \brief Get the time at which this library was compiled.
*/ *
//@{ * This is a string of the form \c hh:mm:ss in 24-hour time.
* \return The compile time
*/
const char*
getCompileTime() const;
/*! /*!
* \brief Query whether a checkbox is checked. * \brief Get the version number of cgicc.
* *
* \param elementName The name of the element to query * The version number is a string of the form \c #.#.
* \return \c true if the desired checkbox was checked, \c false if not * \return The version number
*/ */
bool const char*
queryCheckbox(const STDNS string& elementName) const; getVersion() const;
/*! /*!
* \brief Find a radio button in a radio group, or a selected list item. * \brief Get the platform for which Cgicc was configured.
* *
* \param name The name of the radio button or list item to find. * The host is a string of the form \c processor-manufacturer-os
* \return An iterator referring to the desired element, if found. * return The host triplet.
*/ */
inline form_iterator const char*
operator[] (const STDNS string& name) getHost() const;
//@}
// ============================================================
/*! \name Form Element Access
* Information on submitted form elements
*/
//@{
/*!
* \brief Query whether a checkbox is checked.
*
* \param elementName The name of the element to query
* \return \c true if the desired checkbox was checked, \c false if not
*/
bool
queryCheckbox(const std::string& elementName) const;
/*!
* \brief Find a radio button in a radio group, or a selected list item
.
*
* \param name The name of the radio button or list item to find.
* \return An iterator referring to the desired element, if found.
*/
inline form_iterator
operator[] (const std::string& name)
{ return getElement(name); } { return getElement(name); }
/*! /*!
* \brief Find a radio button in a radio group, or a selected list item. * \brief Find a radio button in a radio group, or a selected list item
* .
* \param name The name of the radio button or list item to find. *
* \return An iterator referring to the desired element, if found. * \param name The name of the radio button or list item to find.
*/ * \return An iterator referring to the desired element, if found.
inline const_form_iterator */
operator[] (const STDNS string& name) const inline const_form_iterator
operator[] (const std::string& name) const
{ return getElement(name); } { return getElement(name); }
/*! /*!
* \brief Find a radio button in a radio group, or a selected list item. * \brief Find a radio button in a radio group, or a selected list item
* .
* \param name The name of the radio button or list item to find. *
* \return An iterator referring to the desired element, if found. * \param name The name of the radio button or list item to find.
*/ * \return An iterator referring to the desired element, if found.
form_iterator */
getElement(const STDNS string& name); form_iterator
getElement(const std::string& name);
/*! /*!
* \brief Find a radio button in a radio group, or a selected list item. * \brief Find a radio button in a radio group, or a selected list item
* .
* \param name The name of the radio button or list item to find. *
* \return A const_iterator referring to the desired element, if found. * \param name The name of the radio button or list item to find.
*/ * \return A const_iterator referring to the desired element, if found.
const_form_iterator */
getElement(const STDNS string& name) const; const_form_iterator
getElement(const std::string& name) const;
/*! /*!
* \brief Find multiple checkboxes in a group or selected items in a list * \brief Find multiple checkboxes in a group or selected items in a li
. st.
* *
* \param name The name of the checkboxes or list to find. * \param name The name of the checkboxes or list to find.
* \param result A vector to hold the result. * \param result A vector to hold the result.
* \return \c true if any elements were found, \c false if not. * \return \c true if any elements were found, \c false if not.
*/ */
bool bool
getElement(const STDNS string& name, getElement(const std::string& name,
STDNS vector<FormEntry>& result) const; std::vector<FormEntry>& result) const;
/*! /*!
* \brief Find a radio button in a radio group, or a selected list item. * \brief Find a radio button in a radio group, or a selected list item
* .
* \param value The value of the radio button or list item to find. *
* \return An iterator referring to the desired element, if found. * \param value The value of the radio button or list item to find.
*/ * \return An iterator referring to the desired element, if found.
form_iterator */
getElementByValue(const STDNS string& value); form_iterator
getElementByValue(const std::string& value);
/*! /*!
* \brief Find a radio button in a radio group, or a selected list item. * \brief Find a radio button in a radio group, or a selected list item
* .
* \param value The value of the radio button or list item to find. *
* \return A const_iterator referring to the desired element, if found. * \param value The value of the radio button or list item to find.
*/ * \return A const_iterator referring to the desired element, if found.
const_form_iterator */
getElementByValue(const STDNS string& value) const; const_form_iterator
getElementByValue(const std::string& value) const;
/*! /*!
* \brief Find multiple checkboxes in a group or selected items in a list * \brief Find multiple checkboxes in a group or selected items in a li
. st.
* *
* \param value The value of the checkboxes or list to find. * \param value The value of the checkboxes or list to find.
* \param result A vector to hold the result. * \param result A vector to hold the result.
* \return true if any elements were found, false if not. * \return true if any elements were found, false if not.
*/ */
bool bool
getElementByValue(const STDNS string& value, getElementByValue(const std::string& value,
STDNS vector<FormEntry>& result) const; std::vector<FormEntry>& result) const;
/*! /*!
* \brief Get all the submitted form entries, excluding files. * \brief Get all the submitted form entries, excluding files.
* *
* \return A vector containing all the submitted elements. * \return A vector containing all the submitted elements.
*/ */
inline const STDNS vector<FormEntry>& inline const std::vector<FormEntry>&
operator* () const operator* () const
{ return fFormData; } { return fFormData; }
/*! /*!
* \brief Get all the submitted form elements, excluding files. * \brief Get all the submitted form elements, excluding files.
* *
* \return A vector containing all the submitted elements. * \return A vector containing all the submitted elements.
*/ */
inline const STDNS vector<FormEntry>& inline const std::vector<FormEntry>&
getElements() const getElements() const
{ return fFormData; } { return fFormData; }
//@} //@}
// ============================================================ // ============================================================
/*! \name Uploaded File Access */ /*! \name Uploaded File Access */
//@{ //@{
/*! /*!
* \brief Find an uploaded file. * \brief Find an uploaded file.
* *
* \param name The name of the file. * \param name The name of the file.
* \return An iterator referring to the desired file, if found. * \return An iterator referring to the desired file, if found.
*/ */
file_iterator file_iterator
getFile(const STDNS string& name); getFile(const std::string& name);
/*! /*!
* \brief Find an uploaded file. * \brief Find an uploaded file.
* *
* \param name The name of the file. * \param name The name of the file.
* \return An iterator referring to the desired file, if found. * \return An iterator referring to the desired file, if found.
*/ */
const_file_iterator const_file_iterator
getFile(const STDNS string& name) const; getFile(const std::string& name) const;
/*! /*!
* Get all uploaded files. * Get all uploaded files.
* \return A vector containing all the uploaded files. * \return A vector containing all the uploaded files.
*/ */
inline const STDNS vector<FormFile>& inline const std::vector<FormFile>&
getFiles() const getFiles() const
{ return fFormFiles; } { return fFormFiles; }
//@} //@}
// ============================================================ // ============================================================
/*! \name Environment Access */ /*! \name Environment Access */
//@{ //@{
/*! /*!
* Get the current runtime environment. * Get the current runtime environment.
* \return The current CGI environment. * \return The current CGI environment.
*/ */
inline const CgiEnvironment& inline const CgiEnvironment&
getEnvironment() const getEnvironment() const
{ return fEnvironment;} { return fEnvironment;}
//@} //@}
// ============================================================ // ============================================================
/*! \name Save and Restore */ /*! \name Save and Restore */
//@{ //@{
/*! /*!
* \brief Save the current CGI environment to a file. * \brief Save the current CGI environment to a file.
* *
* This is useful for debugging CGI applications. * This is useful for debugging CGI applications.
* \param filename The name of the file to which to save. * \param filename The name of the file to which to save.
*/ */
void void
save(const STDNS string& filename) const; save(const std::string& filename) const;
/*! /*!
* \brief Restore from a previously-saved CGI environment. * \brief Restore from a previously-saved CGI environment.
* *
* This is useful for debugging CGI applications. * This is useful for debugging CGI applications.
* \param filename The name of the file from which to restore. * \param filename The name of the file from which to restore.
*/ */
void void
restore(const STDNS string& filename); restore(const std::string& filename);
//@} //@}
private: private:
CgiEnvironment fEnvironment; CgiEnvironment fEnvironment;
STDNS vector<FormEntry> fFormData; std::vector<FormEntry> fFormData;
STDNS vector<FormFile> fFormFiles; std::vector<FormFile> fFormFiles;
// Convert query string into a list of FormEntries // Convert query string into a list of FormEntries
void void
parseFormInput(const STDNS string& data); parseFormInput(const std::string& data);
// Parse a multipart/form-data header // Parse a multipart/form-data header
MultipartHeader MultipartHeader
parseHeader(const STDNS string& data); parseHeader(const std::string& data);
// Parse a (name=value) form entry // Parse a (name=value) form entry
void void
parsePair(const STDNS string& data); parsePair(const std::string& data);
// Parse a MIME entry for ENCTYPE="" // Parse a MIME entry for ENCTYPE=""
void void
parseMIME(const STDNS string& data); parseMIME(const std::string& data);
// Find elements in the list of entries // Find elements in the list of entries
bool bool
findEntries(const STDNS string& param, findEntries(const std::string& param,
bool byName, bool byName,
STDNS vector<FormEntry>& result) const; std::vector<FormEntry>& result) const;
}; };
CGICC_END_NAMESPACE } // namespace cgicc
#endif /* ! _CGICC_H_ */ #endif /* ! _CGICC_H_ */
 End of changes. 54 change blocks. 
281 lines changed or deleted 288 lines changed or added


 FormEntry.h   FormEntry.h 
/* -*-c++-*- */ /* -*-c++-*- */
/* /*
* $Id: FormEntry.h,v 1.5 2002/03/06 02:49:55 sbooth Exp $ * $Id: FormEntry.h,v 1.10 2003/07/13 14:20:35 sbooth Exp $
* *
* Copyright (C) 1996 - 2002 Stephen F. Booth * Copyright (C) 1996 - 2003 Stephen F. Booth
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either * License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version. * version 2.1 of the License, or (at your option) any later version.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details. * Lesser General Public License for more details.
skipping to change at line 47 skipping to change at line 47
*/ */
#include <iostream> #include <iostream>
#include <string> #include <string>
#include <climits> #include <climits>
#include <cfloat> #include <cfloat>
#include "cgicc/CgiDefs.h" #include "cgicc/CgiDefs.h"
#include "cgicc/CgiUtils.h" #include "cgicc/CgiUtils.h"
CGICC_BEGIN_NAMESPACE namespace cgicc {
// ============================================================
// Class FormEntry
// ============================================================
/*! \class FormEntry FormEntry.h cgicc/FormEntry.h
* \brief Class representing a single HTML form entry.
*
* FormEntry is an immutable class representing a single user entry
* in an HTML form element such as a text field, radio button, or a
* checkbox. A FormEntry is essentially a name/value pair, where the
* name is the name of the form element as specified in the HTML form
* itself, and the value is the user-entered or user-selected value.
*
* If a \c QUERY_STRING contained the fragment \c cgicc=yes the
* corresponding FormEntry would have a name of \c cgicc and a value
* of \c yes
*
* \sa FormFile
*/
class CGICC_API FormEntry
{
public:
// ============================================================ // ============================================================
// Class FormEntry
// ============================================================
/*! \name Constructors and Destructor */ /*! \class FormEntry FormEntry.h cgicc/FormEntry.h
//@{ * \brief Class representing a single HTML form entry.
/*!
* \brief Default constructor
* *
* Shouldn't be used. * FormEntry is an immutable class representing a single user entry
* in an HTML form element such as a text field, radio button, or a
* checkbox. A FormEntry is essentially a name/value pair, where the
* name is the name of the form element as specified in the HTML form
* itself, and the value is the user-entered or user-selected value.
*
* If a \c QUERY_STRING contained the fragment \c cgicc=yes the
* corresponding FormEntry would have a name of \c cgicc and a value
* of \c yes
*
* \sa FormFile
*/ */
inline class CGICC_API FormEntry
FormEntry() {
public:
// ============================================================
/*! \name Constructors and Destructor */
//@{
/*!
* \brief Default constructor
*
* Shouldn't be used.
*/
inline
FormEntry()
{} {}
/*! /*!
* \brief Create a new FormEntry * \brief Create a new FormEntry
* *
* This is usually not called directly, but by Cgicc. * This is usually not called directly, but by Cgicc.
* \param name The name of the form element * \param name The name of the form element
* \param value The value of the form element * \param value The value of the form element
*/ */
inline inline
FormEntry(const STDNS string& name, FormEntry(const std::string& name,
const STDNS string& value) const std::string& value)
: fName(name), fValue(value) : fName(name), fValue(value)
{} {}
/*! /*!
* \brief Copy constructor. * \brief Copy constructor.
* *
* Sets the name and value of this FormEntry to those of \c entry. * Sets the name and value of this FormEntry to those of \c entry.
* \param entry The FormEntry to copy. * \param entry The FormEntry to copy.
*/ */
inline inline
FormEntry(const FormEntry& entry) FormEntry(const FormEntry& entry)
{ operator=(entry); } { operator=(entry); }
/*! /*!
* \brief Destructor. * \brief Destructor.
* *
* Delete this FormEntry object * Delete this FormEntry object
*/ */
inline inline
~FormEntry() ~FormEntry()
{} {}
//@} //@}
// ============================================================ // ============================================================
/*! \name Overloaded Operators */ /*! \name Overloaded Operators */
//@{ //@{
/*! /*!
* \brief Compare two FormEntrys for equality. * \brief Compare two FormEntrys for equality.
* *
* FormEntrys are equal if they have the same name and value. * FormEntrys are equal if they have the same name and value.
* \param entry The FormEntry to compare to this one. * \param entry The FormEntry to compare to this one.
* \return \c true if the two FormEntrys are equal, \c false otherwise. * \return \c true if the two FormEntrys are equal, \c false otherwise.
*/ */
inline bool inline bool
operator== (const FormEntry& entry) const operator== (const FormEntry& entry) const
{ return stringsAreEqual(fName, entry.fName); } { return stringsAreEqual(fName, entry.fName); }
/*! /*!
* \brief Compare two FormEntrys for inequality. * \brief Compare two FormEntrys for inequality.
* *
* FormEntrys are equal if they have the same name and value. * FormEntrys are equal if they have the same name and value.
* \param entry The FormEntry to compare to this one. * \param entry The FormEntry to compare to this one.
* \return \c false if the two FormEntrys are equal, \c true otherwise. * \return \c false if the two FormEntrys are equal, \c true otherwise.
*/ */
inline bool inline bool
operator!= (const FormEntry& entry) const operator!= (const FormEntry& entry) const
{ return ! operator==(entry); } { return ! operator==(entry); }
#ifdef WIN32 #ifdef WIN32
/* Dummy operator for MSVC++ */ /* Dummy operator for MSVC++ */
inline bool inline bool
operator< (const FormEntry& entry) const operator< (const FormEntry& entry) const
{ return false; } { return false; }
#endif #endif
/*! /*!
* \brief Assign one FormEntry to another. * \brief Assign one FormEntry to another.
* *
* Sets the name and value of this FormEntry to those of \c entry. * Sets the name and value of this FormEntry to those of \c entry.
* \param entry The FormEntry to copy. * \param entry The FormEntry to copy.
* \return A reference to this. * \return A reference to this.
*/ */
FormEntry& FormEntry&
operator= (const FormEntry& entry); operator= (const FormEntry& entry);
//@} //@}
// ============================================================ // ============================================================
/*! \name Accessor Methods /*! \name Accessor Methods
* Information on the form element * Information on the form element
*/ */
//@{ //@{
/*! /*!
* \brief Get the name of the form element. * \brief Get the name of the form element.
* *
* The name of the form element is specified in the HTML form that * The name of the form element is specified in the HTML form that
* called the CGI application. * called the CGI application.
* \return The name of the form element. * \return The name of the form element.
*/ */
inline STDNS string inline std::string
getName() const getName() const
{ return fName; } { return fName; }
/*! /*!
* \brief Get the value of the form element as a string * \brief Get the value of the form element as a string
* *
* The value returned may contain line breaks. * The value returned may contain line breaks.
* \return The value of the form element. * \return The value of the form element.
*/ */
inline STDNS string inline std::string
getValue() const getValue() const
{ return fValue; } { return fValue; }
/*! /*!
* \brief Get the value of the form element as a string * \brief Get the value of the form element as a string
* *
* The value returned may contain line breaks. * The value returned may contain line breaks.
* \return The value of the form element. * \return The value of the form element.
*/ */
inline STDNS string inline std::string
operator* () const operator* () const
{ return getValue(); } { return getValue(); }
/*! /*!
* \brief Get the value of the form element as a string * \brief Get the value of the form element as a string
* *
* The value returned will be truncated to a specific length. * The value returned will be truncated to a specific length.
* The value may contain line breaks. * The value may contain line breaks.
* \param maxChars The maximum number of characters to return. * \param maxChars The maximum number of characters to return.
* \return The value of the form element, truncated to the specified len * \return The value of the form element, truncated to the specified le
gth. ngth.
*/ */
inline STDNS string inline std::string
getValue(STDNS string::size_type maxChars) const getValue(std::string::size_type maxChars) const
{ return makeString(maxChars, true); } { return makeString(maxChars, true); }
/*! /*!
* \brief Get the value of the form element as a string * \brief Get the value of the form element as a string
* *
* The value returned will be stripped of all line breaks. * The value returned will be stripped of all line breaks.
* \return The value of the form element, stripped of all line breaks. * \return The value of the form element, stripped of all line breaks.
*/ */
inline STDNS string inline std::string
getStrippedValue() const getStrippedValue() const
{ return getStrippedValue(INT_MAX); } { return getStrippedValue(INT_MAX); }
/*! /*!
* \brief Get the value of the form element as a string * \brief Get the value of the form element as a string
* *
* The value returned will be stripped of all line breaks * The value returned will be stripped of all line breaks
* and truncated to a specific length. * and truncated to a specific length.
* \param maxChars The maximum number of characters to return. * \param maxChars The maximum number of characters to return.
* \return The value of the form element, stripped of all line breaks and * \return The value of the form element, stripped of all line breaks a
* truncated to the specified length. nd
*/ * truncated to the specified length.
inline STDNS string */
getStrippedValue(STDNS string::size_type maxChars) const inline std::string
getStrippedValue(std::string::size_type maxChars) const
{ return makeString(maxChars, false); } { return makeString(maxChars, false); }
/*! /*!
* \brief Get the value of the form element as an integer * \brief Get the value of the form element as an integer
* *
* No syntax checking is performed on the string value. * No syntax checking is performed on the string value.
* \param min The minimum value to return (optional). * \param min The minimum value to return (optional).
* \param max The maximum value to return (optional). * \param max The maximum value to return (optional).
* \return The integer value of the form element. * \return The integer value of the form element.
*/ */
long long
getIntegerValue(long min = LONG_MIN, getIntegerValue(long min = LONG_MIN,
long max = LONG_MAX) const; long max = LONG_MAX) const;
/*! /*!
* \brief Get the value of the form element as a double * \brief Get the value of the form element as an integer
* *
* No syntax checking is performed on the string value. * No syntax checking is performed on the string value.
* \param min The minimum value to return (optional). * \param min The minimum value to return.
* \param max The maximum value to return (optional). * \param max The maximum value to return.
* \return The double value of the form element. * \param bounded Set to \c true if the value was originally outside th
*/ e
double * limits, \c false otherwise
getDoubleValue(double min = DBL_MIN, * \return The integer value of the form element.
double max = DBL_MAX) const; */
long
getIntegerValue(long min,
long max,
bool& bounded) const;
/*! /*!
* \brief Get the number of characters in the value of the form element. * \brief Get the value of the form element as a double
* *
* Note that a character may or may not equal one byte. * No syntax checking is performed on the string value.
* \return The length of the value of the form element * \param min The minimum value to return (optional).
*/ * \param max The maximum value to return (optional).
inline STDNS string::size_type * \return The double value of the form element.
length() const */
double
getDoubleValue(double min = -DBL_MAX,
double max = DBL_MAX) const;
/*!
* \brief Get the value of the form element as a double
*
* No syntax checking is performed on the string value.
* \param min The minimum value to return.
* \param max The maximum value to return.
* \param bounded Set to \c true if the value was originally outside th
e
* limits, \c false otherwise
* \return The double value of the form element.
*/
double
getDoubleValue(double min,
double max,
bool& bounded) const;
/*!
* \brief Get the number of characters in the value of the form element
.
*
* Note that a character may or may not equal one byte.
* \return The length of the value of the form element
*/
inline std::string::size_type
length() const
{ return fValue.length(); } { return fValue.length(); }
/*! /*!
* \brief Determine if this form element is empty * \brief Determine if this form element is empty
* *
* In an empty form element, length() == 0. * In an empty form element, length() == 0.
* \return \c true if this form element is empty, \c false otherwise. * \return \c true if this form element is empty, \c false otherwise.
*/ */
inline bool inline bool
isEmpty() const isEmpty() const
{ return (length() == 0); } { return (length() == 0); }
//@} //@}
private: private:
// utility function // utility function
STDNS string std::string
makeString(STDNS string::size_type maxLen, makeString(std::string::size_type maxLen,
bool allowNewlines) const; bool allowNewlines) const;
STDNS string fName; // the name of this form element std::string fName; // the name of this form element
STDNS string fValue; // the value of this form element std::string fValue; // the value of this form element
}; };
CGICC_END_NAMESPACE } // namespace cgicc
#endif /* ! _FORMENTRY_H_ */ #endif /* ! _FORMENTRY_H_ */
 End of changes. 33 change blocks. 
204 lines changed or deleted 238 lines changed or added


 FormFile.h   FormFile.h 
/* -*-c++-*- */ /* -*-c++-*- */
/* /*
* $Id: FormFile.h,v 1.6 2002/03/06 02:49:55 sbooth Exp $ * $Id: FormFile.h,v 1.8 2003/07/13 14:20:35 sbooth Exp $
* *
* Copyright (C) 1996 - 2002 Stephen F. Booth * Copyright (C) 1996 - 2003 Stephen F. Booth
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either * License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version. * version 2.1 of the License, or (at your option) any later version.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details. * Lesser General Public License for more details.
skipping to change at line 43 skipping to change at line 43
* the HTTP file upload mechanism. If you are going to use file upload * the HTTP file upload mechanism. If you are going to use file upload
* in your CGI application, remember to set the ENCTYPE of the form to * in your CGI application, remember to set the ENCTYPE of the form to
* \c multipart/form-data. * \c multipart/form-data.
*/ */
#include <iostream> #include <iostream>
#include <string> #include <string>
#include "cgicc/CgiDefs.h" #include "cgicc/CgiDefs.h"
CGICC_BEGIN_NAMESPACE namespace cgicc {
// ============================================================
// Class FormFile
// ============================================================
/*! \class FormFile FormFile.h cgicc/FormFile.h
* \brief Class representing a file submitted via an HTML form.
*
* FormFile is an immutable class reprenting a file uploaded via
* the HTTP file upload mechanism. If you are going to use file upload
* in your CGI application, remember to set the ENCTYPE of the form to
* \c multipart/form-data.
* \verbatim
<form method="post" action="http://change_this_path/cgi-bin/upload.cgi"
enctype="multipart/form-data">
\endverbatim
* \sa FormEntry
*/
class CGICC_API FormFile
{
public:
// ============================================================ // ============================================================
// Class FormFile
// ============================================================
/*! \name Constructors and Destructor */ /*! \class FormFile FormFile.h cgicc/FormFile.h
//@{ * \brief Class representing a file submitted via an HTML form.
/*!
* \brief Default constructor
* *
* Shouldn't be used. * FormFile is an immutable class reprenting a file uploaded via
* the HTTP file upload mechanism. If you are going to use file upload
* in your CGI application, remember to set the ENCTYPE of the form to
* \c multipart/form-data.
* \verbatim
<form method="post" action="http://change_this_path/cgi-bin/upload.cgi"
enctype="multipart/form-data">
\endverbatim
* \sa FormEntry
*/ */
inline class CGICC_API FormFile
FormFile() {
public:
// ============================================================
/*! \name Constructors and Destructor */
//@{
/*!
* \brief Default constructor
*
* Shouldn't be used.
*/
inline
FormFile()
{} {}
/*! /*!
* \brief Create a new FormFile. * \brief Create a new FormFile.
* *
* This is usually not called directly, but by Cgicc. * This is usually not called directly, but by Cgicc.
* \param name The \e name of the form element. * \param name The \e name of the form element.
* \param filename The \e filename of the file on the remote machine. * \param filename The \e filename of the file on the remote machine.
* \param dataType The MIME content type of the data, if specified, or 0. * \param dataType The MIME content type of the data, if specified, or
* \param data The file data. 0.
*/ * \param data The file data.
FormFile(const STDNS string& name, */
const STDNS string& filename, FormFile(const std::string& name,
const STDNS string& dataType, const std::string& filename,
const STDNS string& data); const std::string& dataType,
const std::string& data);
/*! /*!
* \brief Copy constructor. * \brief Copy constructor.
* *
* Sets the name, filename, datatype, and data to those of \c file * Sets the name, filename, datatype, and data to those of \c file
* @param file The FormFile to copy. * @param file The FormFile to copy.
*/ */
inline inline
FormFile(const FormFile& file) FormFile(const FormFile& file)
{ operator=(file); } { operator=(file); }
/*! /*!
* \brief Destructor * \brief Destructor
* *
* Delete this FormFile object * Delete this FormFile object
*/ */
inline inline
~FormFile() ~FormFile()
{} {}
//@} //@}
// ============================================================ // ============================================================
/*! \name Overloaded Operators */ /*! \name Overloaded Operators */
//@{ //@{
/*! /*!
* \brief Compare two FormFiles for equality. * \brief Compare two FormFiles for equality.
* *
* FormFiles are equal if they have the same filename. * FormFiles are equal if they have the same filename.
* @param file The FormFile to compare to this one. * @param file The FormFile to compare to this one.
* @return \c true if the two FormFiles are equal, \c false otherwise. * @return \c true if the two FormFiles are equal, \c false otherwise.
*/ */
bool bool
operator== (const FormFile& file) const; operator== (const FormFile& file) const;
/*! /*!
* \brief Compare two FormFiles for inequality. * \brief Compare two FormFiles for inequality.
* *
* FormFiles are equal if they have the same filename. * FormFiles are equal if they have the same filename.
* \param file The FormFile to compare to this one. * \param file The FormFile to compare to this one.
* \return \c false if the two FormFiles are equal, \c true otherwise. * \return \c false if the two FormFiles are equal, \c true otherwise.
*/ */
inline bool inline bool
operator!= (const FormFile& file) const operator!= (const FormFile& file) const
{ return ! operator==(file); } { return ! operator==(file); }
#ifdef WIN32 #ifdef WIN32
/* Dummy operator for MSVC++ */ /* Dummy operator for MSVC++ */
inline bool inline bool
operator< (const FormFile& file) const operator< (const FormFile& file) const
{ return false; } { return false; }
#endif #endif
/*! /*!
* \brief Assign one FormFile to another. * \brief Assign one FormFile to another.
* *
* Sets the name, filename, datatype, and data to those of \c file * Sets the name, filename, datatype, and data to those of \c file
* \param file The FormFile to copy. * \param file The FormFile to copy.
* \return A reference to this. * \return A reference to this.
*/ */
FormFile& FormFile&
operator= (const FormFile& file); operator= (const FormFile& file);
//@} //@}
// ============================================================ // ============================================================
/*! \name Accessor Methods /*! \name Accessor Methods
* Information on the uploaded file * Information on the uploaded file
*/ */
//@{ //@{
/*! /*!
* \brief Write this file data to the specified stream. * \brief Write this file data to the specified stream.
* *
* This is useful for saving uploaded data to disk * This is useful for saving uploaded data to disk
* \param out The ostream to which to write. * \param out The ostream to which to write.
*/ */
void void
writeToStream(STDNS ostream& out) const; writeToStream(std::ostream& out) const;
/*! /*!
* \brief Get the name of the form element. * \brief Get the name of the form element.
* *
* The name of the form element is specified in the HTML form that * The name of the form element is specified in the HTML form that
* called the CGI application. * called the CGI application.
* \return The name of the form element. * \return The name of the form element.
*/ */
inline STDNS string inline std::string
getName() const getName() const
{ return fName; } { return fName; }
/*! /*!
* \brief Get the basename of the file on the remote machine. * \brief Get the basename of the file on the remote machine.
* *
* The filename is stripped of all leading directory information * The filename is stripped of all leading directory information
* \return The basename of the file on the remote machine. * \return The basename of the file on the remote machine.
*/ */
inline STDNS string inline std::string
getFilename() const getFilename() const
{ return fFilename; } { return fFilename; }
/*! /*!
* \brief Get the MIME type of the file data. * \brief Get the MIME type of the file data.
* *
* This will be of the form \c text/plain or \c image/jpeg * This will be of the form \c text/plain or \c image/jpeg
* \return The MIME type of the file data. * \return The MIME type of the file data.
*/ */
inline STDNS string inline std::string
getDataType() const getDataType() const
{ return fDataType; } { return fDataType; }
/*! /*!
* \brief Get the file data. * \brief Get the file data.
* *
* This returns the raw file data as a string * This returns the raw file data as a string
* \return The file data. * \return The file data.
*/ */
inline STDNS string inline std::string
getData() const getData() const
{ return fData; } { return fData; }
/*! /*!
* \brief Get the length of the file data * \brief Get the length of the file data
* *
* The length of the file data is usually measured in bytes. * The length of the file data is usually measured in bytes.
* \return The length of the file data, in bytes. * \return The length of the file data, in bytes.
*/ */
inline STDNS string::size_type inline std::string::size_type
getDataLength() const getDataLength() const
{ return fData.length(); } { return fData.length(); }
//@} //@}
private: private:
STDNS string fName; std::string fName;
STDNS string fFilename; std::string fFilename;
STDNS string fDataType; std::string fDataType;
STDNS string fData; std::string fData;
}; };
CGICC_END_NAMESPACE } // namespace cgicc
#endif /* ! _FORMFILE_H_ */ #endif /* ! _FORMFILE_H_ */
 End of changes. 28 change blocks. 
158 lines changed or deleted 159 lines changed or added


 HTMLAtomicElement.h   HTMLAtomicElement.h 
/* -*-c++-*- */ /* -*-c++-*- */
/* /*
* $Id: HTMLAtomicElement.h,v 1.2 2002/03/06 02:49:55 sbooth Exp $ * $Id: HTMLAtomicElement.h,v 1.4 2003/07/13 14:20:35 sbooth Exp $
* *
* Copyright (C) 1996 - 2002 Stephen F. Booth * Copyright (C) 1996 - 2003 Stephen F. Booth
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either * License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version. * version 2.1 of the License, or (at your option) any later version.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details. * Lesser General Public License for more details.
skipping to change at line 34 skipping to change at line 34
/*! \file HTMLAtomicElement.h /*! \file HTMLAtomicElement.h
* \brief Template class for concrete atomic HTMLElement subclasses * \brief Template class for concrete atomic HTMLElement subclasses
* *
*/ */
#include <new> #include <new>
#include "cgicc/HTMLElement.h" #include "cgicc/HTMLElement.h"
CGICC_BEGIN_NAMESPACE namespace cgicc {
// ============================================================
// Template for concrete atomic HTML element classes
// ============================================================
/*! \class HTMLAtomicElement HTMLAtomicElement.h cgicc/HTMLAtomicElement.h
* \brief Template for concrete atomic HTMLElement subclasses
*
* An atomic HTML element is an element in which the opening and closing
* tags are combined. For example, in the HTML code
\verbatim
<meta link="made" href="mailto:sbooth@gnu.org" />
\endverbatim
* The \c meta tag is an atomic HTML element because the opening and closin
g
* tags appear together.
* \sa HTMLElement
* \sa HTMLBooleanElement
*/
template<class Tag>
class HTMLAtomicElement : public HTMLElement
{
public:
// ============================================================ // ============================================================
// Template for concrete atomic HTML element classes
// ============================================================
/*! \name Constructors and Destructor */ /*! \class HTMLAtomicElement HTMLAtomicElement.h cgicc/HTMLAtomicElement.
//@{ h
* \brief Template for concrete atomic HTMLElement subclasses
/*!
* \brief Create a new empty atomic element.
* *
* An atomic HTML element is an element in which the opening and closing
* tags are combined. For example, in the HTML code
\verbatim
<meta link="made" href="mailto:sbooth@gnu.org" />
\endverbatim
* The \c meta tag is an atomic HTML element because the opening and clos
ing
* tags appear together.
* \sa HTMLElement
* \sa HTMLBooleanElement
*/ */
HTMLAtomicElement() template<class Tag>
: HTMLElement(0, 0, 0, eAtomic) class HTMLAtomicElement : public HTMLElement
{} {
public:
/*! // ============================================================
* \brief Create a new element, specifying the HTMLAttributes.
*
* \param attributes The HTMLAttributes contained within the element.
*/
HTMLAtomicElement(const HTMLAttributeList& attributes)
: HTMLElement(&attributes, 0, 0, eAtomic)
{}
/*! /*! \name Constructors and Destructor */
* \brief Destructor //@{
*
*/
virtual ~HTMLAtomicElement()
{}
//@}
/*! /*!
* \brief Clone this element * \brief Create a new empty atomic element.
* *
* \return A newly-allocated copy of this element */
*/ HTMLAtomicElement()
virtual inline HTMLElement* : HTMLElement(0, 0, 0, eAtomic)
clone() const {}
{ return new HTMLAtomicElement<Tag>(*this); }
/*! /*!
* \brief Get the name of this element. * \brief Create a new element, specifying the HTMLAttributes.
* *
* For example, \c meta. * \param attributes The HTMLAttributes contained within the element.
* \return The name of this element */
*/ HTMLAtomicElement(const HTMLAttributeList& attributes)
virtual inline const char* : HTMLElement(&attributes, 0, 0, eAtomic)
getName() const {}
{ return Tag::getName(); }
};
CGICC_END_NAMESPACE /*!
* \brief Destructor
*
*/
virtual ~HTMLAtomicElement()
{}
//@}
/*!
* \brief Clone this element
*
* \return A newly-allocated copy of this element
*/
virtual inline HTMLElement*
clone() const
{ return new HTMLAtomicElement<Tag>(*this); }
/*!
* \brief Get the name of this element.
*
* For example, \c meta.
* \return The name of this element
*/
virtual inline const char*
getName() const
{ return Tag::getName(); }
};
} // namespace cgicc
#endif /* ! _HTMLATOMICELEMENT_H_ */ #endif /* ! _HTMLATOMICELEMENT_H_ */
 End of changes. 12 change blocks. 
68 lines changed or deleted 69 lines changed or added


 HTMLAttribute.h   HTMLAttribute.h 
/* -*-c++-*- */ /* -*-c++-*- */
/* /*
* $Id: HTMLAttribute.h,v 1.3 2002/03/06 02:49:55 sbooth Exp $ * $Id: HTMLAttribute.h,v 1.5 2003/07/13 14:20:35 sbooth Exp $
* *
* Copyright (C) 1996 - 2002 Stephen F. Booth * Copyright (C) 1996 - 2003 Stephen F. Booth
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either * License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version. * version 2.1 of the License, or (at your option) any later version.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details. * Lesser General Public License for more details.
skipping to change at line 45 skipping to change at line 45
\endverbatim \endverbatim
* \c clear is an attribute of the \c br element. * \c clear is an attribute of the \c br element.
*/ */
#include <string> #include <string>
#include <iostream> #include <iostream>
#include "cgicc/CgiDefs.h" #include "cgicc/CgiDefs.h"
#include "cgicc/MStreamable.h" #include "cgicc/MStreamable.h"
CGICC_BEGIN_NAMESPACE namespace cgicc {
// ============================================================
// Class HTMLAttribute
// ============================================================
/*! \class HTMLAttribute HTMLAttribute.h cgicc/HTMLAttribute.h
* \brief Class representing a name or a single name/value pair
*
* An HTMLAttribute represents a single name/value
* pair inside an HTMLElement. For example, in the HTML code:
\verbatim
<a href="mailto:sbooth@gnu.org">Send mail</a>
\endverbatim
* The (name, value) pair <tt>(href, mailto:%sbooth@gnu.org)</tt> is
* an HTMLAttribute.
* HTMLAttribute objects are usually not created directly, but
* using the set() methods. To generate the HTML above using
* %cgicc, write
* \code
* cout << cgicc::a("Send Mail").set("href", "mailto:sbooth@gnu.org");
* \endcode
* \sa HTMLAttributeList
*/
class CGICC_API HTMLAttribute : public MStreamable
{
public:
// ============================================================ // ============================================================
// Class HTMLAttribute
// ============================================================
/*! \name Constructors and Destructor */ /*! \class HTMLAttribute HTMLAttribute.h cgicc/HTMLAttribute.h
//@{ * \brief Class representing a name or a single name/value pair
/*!
* \brief Create an empty HTMLAttribute.
* *
* The name and value are set to an empty string. * An HTMLAttribute represents a single name/value
* pair inside an HTMLElement. For example, in the HTML code:
\verbatim
<a href="mailto:sbooth@gnu.org">Send mail</a>
\endverbatim
* The (name, value) pair <tt>(href, mailto:%sbooth@gnu.org)</tt> is
* an HTMLAttribute.
* HTMLAttribute objects are usually not created directly, but
* using the set() methods. To generate the HTML above using
* %cgicc, write
* \code
* cout << cgicc::a("Send Mail").set("href", "mailto:sbooth@gnu.org");
* \endcode
* \sa HTMLAttributeList
*/ */
HTMLAttribute(); class CGICC_API HTMLAttribute : public MStreamable
{
public:
/*! // ============================================================
* \brief Create an HTMLAttribute with the given name.
*
* This will simply set the name and value to the same value.
* \param name The name of the attribute.
*/
HTMLAttribute(const STDNS string& name);
/*! /*! \name Constructors and Destructor */
* \brief Create an HTMLAttribute with the given name and value. //@{
*
* Most attributes are of this form
* \param name The attribute's name, for example \c href
* \param value The attributes's alue, for exampe \c foo.html
*/
HTMLAttribute(const STDNS string& name,
const STDNS string& value);
/*! /*!
* \brief Copy constructor. * \brief Create an empty HTMLAttribute.
* *
* Sets the name of value of this attribute to those of \c attribute * The name and value are set to an empty string.
* \param attribute The HTMLAttribute to copy. */
*/ HTMLAttribute();
HTMLAttribute(const HTMLAttribute& attribute);
/*! /*!
* \brief Destructor * \brief Create an HTMLAttribute with the given name.
* *
* Delete this HTMLAttribute object * This will simply set the name and value to the same value.
*/ * \param name The name of the attribute.
virtual ~HTMLAttribute(); */
//@} HTMLAttribute(const std::string& name);
// ============================================================ /*!
* \brief Create an HTMLAttribute with the given name and value.
*
* Most attributes are of this form
* \param name The attribute's name, for example \c href
* \param value The attributes's alue, for exampe \c foo.html
*/
HTMLAttribute(const std::string& name,
const std::string& value);
/*! \name Overloaded Operators */ /*!
//@{ * \brief Copy constructor.
*
* Sets the name of value of this attribute to those of \c attribute
* \param attribute The HTMLAttribute to copy.
*/
HTMLAttribute(const HTMLAttribute& attribute);
/*! /*!
* \brief Compare two HTMLAttributes for equality. * \brief Destructor
* *
* HTMLAttributes are equal if they have the same name and value. * Delete this HTMLAttribute object
* \param att The HTMLAttribute to compare to this one. */
* \return \c true if the two HTMLAttributes are equal, \c false otherwis virtual ~HTMLAttribute();
e. //@}
*/
bool
operator== (const HTMLAttribute& att) const;
/*! // ============================================================
* \brief Compare two HTMLAttributes for inequality.
* /*! \name Overloaded Operators */
* HTMLAttributes are equal if they have the same name and value. //@{
* \param att The HTMLAttribute to compare to this one.
* \return \c false if the two HTMLAttributes are equal, \c true otherwis /*!
e. * \brief Compare two HTMLAttributes for equality.
*/ *
inline bool * HTMLAttributes are equal if they have the same name and value.
operator!= (const HTMLAttribute& att) const * \param att The HTMLAttribute to compare to this one.
* \return \c true if the two HTMLAttributes are equal, \c false otherw
ise.
*/
bool
operator== (const HTMLAttribute& att) const;
/*!
* \brief Compare two HTMLAttributes for inequality.
*
* HTMLAttributes are equal if they have the same name and value.
* \param att The HTMLAttribute to compare to this one.
* \return \c false if the two HTMLAttributes are equal, \c true otherw
ise.
*/
inline bool
operator!= (const HTMLAttribute& att) const
{ return ! operator==(att); } { return ! operator==(att); }
#ifdef WIN32 #ifdef WIN32
/* Dummy operator for MSVC++ */ /* Dummy operator for MSVC++ */
inline bool inline bool
operator< (const HTMLAttribute& att) const operator< (const HTMLAttribute& att) const
{ return false; } { return false; }
#endif #endif
/*! /*!
* \brief Assign one HTMLAttribute to another. * \brief Assign one HTMLAttribute to another.
* *
* Sets the name of value of this attribute to those of \c att * Sets the name of value of this attribute to those of \c att
* \param att The HTMLAttribute to copy. * \param att The HTMLAttribute to copy.
* \return A reference to this. * \return A reference to this.
*/ */
HTMLAttribute& HTMLAttribute&
operator= (const HTMLAttribute& att); operator= (const HTMLAttribute& att);
//@} //@}
// ============================================================ // ============================================================
/*! \name Accessor Methods /*! \name Accessor Methods
* Information on the attribute * Information on the attribute
*/ */
//@{ //@{
/*! /*!
* \brief Get the name of this HTMLAttribute. * \brief Get the name of this HTMLAttribute.
* *
* For example, \c HREF * For example, \c HREF
* \return The attribute's name. * \return The attribute's name.
*/ */
inline STDNS string inline std::string
getName() const getName() const
{ return fName; } { return fName; }
/*! /*!
* \brief Get the value of this HTMLAttribute. * \brief Get the value of this HTMLAttribute.
* *
* For example, \c http://www.gnu.org * For example, \c http://www.gnu.org
* \return The attribute's value. * \return The attribute's value.
*/ */
inline STDNS string inline std::string
getValue() const getValue() const
{ return fValue; } { return fValue; }
//@} //@}
// ============================================================ // ============================================================
/*! \name Mutator Methods /*! \name Mutator Methods
* Set properties of the attribute * Set properties of the attribute
*/ */
//@{ //@{
/*! /*!
* \brief Set the name of this HTMLAttribute. * \brief Set the name of this HTMLAttribute.
* *
* Use this method if the name wasn't specified in the constructor * Use this method if the name wasn't specified in the constructor
* \param name The new name of the attribute. * \param name The new name of the attribute.
*/ */
inline void inline void
setName(const STDNS string& name) setName(const std::string& name)
{ fName = name; } { fName = name; }
/*! /*!
* \brief Set the value of this HTMLAttribute. * \brief Set the value of this HTMLAttribute.
* *
* Use this method if the value wasn't specified in the constructor * Use this method if the value wasn't specified in the constructor
* \param value The new value of the attribute. * \param value The new value of the attribute.
*/ */
inline void inline void
setValue(const STDNS string& value) setValue(const std::string& value)
{ fValue = value; } { fValue = value; }
//@} //@}
/*! /*!
* \brief Render this attribute to an ostream * \brief Render this attribute to an ostream
* *
* This is used for output purposes * This is used for output purposes
* \param out The ostream to which to write * \param out The ostream to which to write
*/ */
virtual void virtual void
render(STDNS ostream& out) const; render(std::ostream& out) const;
private: private:
STDNS string fName; std::string fName;
STDNS string fValue; std::string fValue;
}; };
CGICC_END_NAMESPACE } // namespace cgicc
#endif /* ! _HTMLATTRIBUTE_H_ */ #endif /* ! _HTMLATTRIBUTE_H_ */
 End of changes. 30 change blocks. 
160 lines changed or deleted 160 lines changed or added


 HTMLAttributeList.h   HTMLAttributeList.h 
/* -*-c++-*- */ /* -*-c++-*- */
/* /*
* $Id: HTMLAttributeList.h,v 1.2 2002/03/06 02:49:55 sbooth Exp $ * $Id: HTMLAttributeList.h,v 1.4 2003/07/13 14:20:35 sbooth Exp $
* *
* Copyright (C) 1996 - 2002 Stephen F. Booth * Copyright (C) 1996 - 2003 Stephen F. Booth
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either * License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version. * version 2.1 of the License, or (at your option) any later version.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details. * Lesser General Public License for more details.
skipping to change at line 43 skipping to change at line 43
*/ */
#include <string> #include <string>
#include <iostream> #include <iostream>
#include <vector> #include <vector>
#include "cgicc/CgiDefs.h" #include "cgicc/CgiDefs.h"
#include "cgicc/MStreamable.h" #include "cgicc/MStreamable.h"
#include "cgicc/HTMLAttribute.h" #include "cgicc/HTMLAttribute.h"
CGICC_BEGIN_NAMESPACE namespace cgicc {
// ============================================================ // ============================================================
// Class HTMLAttributeList // Class HTMLAttributeList
// ============================================================ // ============================================================
#ifdef WIN32 #ifdef WIN32
template class CGICC_API STDNS vector<HTMLAttribute>; template class CGICC_API std::vector<HTMLAttribute>;
#endif #endif
/*! \class HTMLAttributeList HTMLAttributeList.h cgicc/HTMLAttributeList.h /*! \class HTMLAttributeList HTMLAttributeList.h cgicc/HTMLAttributeList.
* \brief An expandable list of HTMLAttribute objects h
* * \brief An expandable list of HTMLAttribute objects
* An HTMLAttributeList represents any number of HTMLAttribute objects *
* which may be embedded in an HTMLElement. To add HTMLAttribute objects * An HTMLAttributeList represents any number of HTMLAttribute objects
* to an HTMLAttributeList, use the set() methods or functions. * which may be embedded in an HTMLElement. To add HTMLAttribute objects
* For example, * to an HTMLAttributeList, use the set() methods or functions.
* \code * For example,
* cgicc::HTMLAttributeList list = cgicc::set("HEIGHT", "100").set("WIDTH", * \code
"100"); * cgicc::HTMLAttributeList list = cgicc::set("HEIGHT", "100").set("WIDTH
* \endcode ", "100");
* generates an HTMLAttributeList with two elements. * \endcode
* \see HTMLAttribute * generates an HTMLAttributeList with two elements.
* \see HTMLElement * \see HTMLAttribute
*/ * \see HTMLElement
class CGICC_API HTMLAttributeList */
{ class CGICC_API HTMLAttributeList
public: {
public:
// ============================================================ // ============================================================
/*! \name Constructors and Destructor */ /*! \name Constructors and Destructor */
//@{ //@{
/*! /*!
* \brief Create an empty HTMLAttributeList. * \brief Create an empty HTMLAttributeList.
* *
* HTMLAttributeLists are most often created with the set functions * HTMLAttributeLists are most often created with the set functions
*/ */
HTMLAttributeList(); HTMLAttributeList();
/*! /*!
* \brief Create a new HTMLAttributeList, specifying the first element. * \brief Create a new HTMLAttributeList, specifying the first element.
* *
* The first attribute in the list is set to \c head * The first attribute in the list is set to \c head
* \param head The first element of the list * \param head The first element of the list
*/ */
HTMLAttributeList(const HTMLAttribute& head); HTMLAttributeList(const HTMLAttribute& head);
/*! /*!
* \brief Copy constructor. * \brief Copy constructor.
* *
* Sets the elements in this list to those in \c list * Sets the elements in this list to those in \c list
* \param list The HTMLAttributeList to copy. * \param list The HTMLAttributeList to copy.
*/ */
HTMLAttributeList(const HTMLAttributeList& list); HTMLAttributeList(const HTMLAttributeList& list);
/*! /*!
* \brief Destructor * \brief Destructor
* *
* Delete this HTMLAttributeList object * Delete this HTMLAttributeList object
*/ */
~HTMLAttributeList(); ~HTMLAttributeList();
//@} //@}
// ============================================================ // ============================================================
/*! \name Overloaded Operators */ /*! \name Overloaded Operators */
//@{ //@{
/*! /*!
* \brief Assign one HTMLAttributeList to another. * \brief Assign one HTMLAttributeList to another.
* *
* Sets the elements in this list to those in \c list * Sets the elements in this list to those in \c list
* \param list The HTMLAttributeList to copy * \param list The HTMLAttributeList to copy
*/ */
HTMLAttributeList& HTMLAttributeList&
operator= (const HTMLAttributeList &list); operator= (const HTMLAttributeList &list);
//@} //@}
// ============================================================ // ============================================================
/*! \name List Management /*! \name List Management
* Add attributes to the list * Add attributes to the list
*/ */
//@{ //@{
/*!
* \brief Add an atomic HTMLAttribute to this list
*
* \c isindex is an example of an atomic attribute.
* \param name The name of the HTMLAttribute to set.
* \return A reference to \c this
*/
HTMLAttributeList&
set(const std::string& name);
/*!
* \brief Add a HTMLAttribute to this list
*
* For a list of possible attributes see http://www.w3.org/TR/REC-html4
0/
* \param name The name of the HTMLAttribute to set.
* \param value The value of the HTMLAttribute to set.
* \return A reference to \c this
*/
HTMLAttributeList&
set(const std::string& name,
const std::string& value);
//@}
/*! \name Utility Methods */
//@{
/*!
* \brief Render this HTMLAttributeList to an ostream
*
* This is used for output
* \param out The ostream to which to write
*/
void
render(std::ostream& out) const;
//@}
private:
std::vector<HTMLAttribute> fAttributes;
};
// ============================================================
// List manipulators
// ============================================================
/*! /*!
* \brief Add an atomic HTMLAttribute to this list * \brief Create a new HTMLAttributeList, and set an HTMLAttribute.
* *
* \c ISINDEX is an example of an atomic attribute. * This function is usually called from within the constructor of an
* HTMLElement:
* \code
* out << img(set("ISINDEX")) << endl;
* \endcode
* \param name The name of the HTMLAttribute to set. * \param name The name of the HTMLAttribute to set.
* \return A reference to \c this * \return A reference to the list.
*/ */
HTMLAttributeList& inline HTMLAttributeList
set(const STDNS string& name); set(const std::string& name)
{ return HTMLAttributeList(HTMLAttribute(name)); }
/*! /*!
* \brief Add a HTMLAttribute to this list * \brief Create a new HTMLAttributeList, and set an HTMLAttribute.
* *
* For a list of possible attributes see http://www.w3.org/TR/REC-html40/ * This function is usually called from within the constructor of an
* HTMLElement:
* \code
* out << a("link text", set("HREF","http://www.foo.com")) << endl;
* \endcode
* \param name The name of the HTMLAttribute to set. * \param name The name of the HTMLAttribute to set.
* \param value The value of the HTMLAttribute to set. * \param value The value of the HTMLAttribute to set.
* \return A reference to \c this * \return A reference to the list.
*/
HTMLAttributeList&
set(const STDNS string& name,
const STDNS string& value);
//@}
/*! \name Utility Methods */
//@{
/*!
* \brief Render this HTMLAttributeList to an ostream
*
* This is used for output
* \param out The ostream to which to write
*/ */
void inline HTMLAttributeList
render(STDNS ostream& out) const; set(const std::string& name,
//@} const std::string& value)
{ return HTMLAttributeList(HTMLAttribute(name, value)); }
private:
STDNS vector<HTMLAttribute> fAttributes;
};
// ============================================================
// List manipulators
// ============================================================
/*!
* \brief Create a new HTMLAttributeList, and set an HTMLAttribute.
*
* This function is usually called from within the constructor of an
* HTMLElement:
* \code
* out << img(set("ISINDEX")) << endl;
* \endcode
* \param name The name of the HTMLAttribute to set.
* \return A reference to the list.
*/
inline HTMLAttributeList
set(const STDNS string& name)
{ return HTMLAttributeList(HTMLAttribute(name)); }
/*!
* \brief Create a new HTMLAttributeList, and set an HTMLAttribute.
*
* This function is usually called from within the constructor of an
* HTMLElement:
* \code
* out << a("link text", set("HREF","http://www.foo.com")) << endl;
* \endcode
* \param name The name of the HTMLAttribute to set.
* \param value The value of the HTMLAttribute to set.
* \return A reference to the list.
*/
inline HTMLAttributeList
set(const STDNS string& name,
const STDNS string& value)
{ return HTMLAttributeList(HTMLAttribute(name, value)); }
CGICC_END_NAMESPACE } // namespace cgicc
#endif /* ! _HTMLATTRIBUTES_H_ */ #endif /* ! _HTMLATTRIBUTES_H_ */
 End of changes. 26 change blocks. 
138 lines changed or deleted 140 lines changed or added


 HTMLBooleanElement.h   HTMLBooleanElement.h 
/* -*-c++-*- */ /* -*-c++-*- */
/* /*
* $Id: HTMLBooleanElement.h,v 1.2 2002/03/06 02:49:55 sbooth Exp $ * $Id: HTMLBooleanElement.h,v 1.5 2003/07/17 05:16:03 sbooth Exp $
* *
* Copyright (C) 1996 - 2002 Stephen F. Booth * Copyright (C) 1996 - 2003 Stephen F. Booth
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either * License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version. * version 2.1 of the License, or (at your option) any later version.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details. * Lesser General Public License for more details.
skipping to change at line 34 skipping to change at line 34
/*! \file HTMLBooleanElement.h /*! \file HTMLBooleanElement.h
* \brief Template class for concrete boolean HTMLElement subclasses * \brief Template class for concrete boolean HTMLElement subclasses
* *
*/ */
#include <new> #include <new>
#include "cgicc/HTMLElement.h" #include "cgicc/HTMLElement.h"
CGICC_BEGIN_NAMESPACE namespace cgicc {
// ============================================================
// Template for concrete boolean HTML element classes
// ============================================================
/*! \class HTMLBooleanElement HTMLBooleanElement.h cgicc/HTMLBooleanElement
.h
* \brief Template for concrete boolean HTMLElement subclasses
*
* A boolean HTML element is an element having a boolean (open or closed)
* state. Most commonly used HTML tags are boolean elements:
\verbatim
<a href="http://www.gnu.org">GNU Project</a>
\endverbatim
* The \c a element is boolean, since it is either open or closed. Boolean
* elements are often additive:
\verbatim
<b>bold text<i>bold italic text</i></b>
\endverbatim
* Note than under the XHTML 1.0 standard, elements may not overlap; ie,
* in the example above, it would be illegal to close the \c b tag before
* the \c i tag.
* \sa HTMLElement
* \sa HTMLAtomicElement
*/
template<class Tag>
class HTMLBooleanElement : public HTMLElement
{
public:
// ============================================================ // ============================================================
// Template for concrete boolean HTML element classes
// ============================================================
/*! \name Constructors and Destructor */ /*! \class HTMLBooleanElement HTMLBooleanElement.h cgicc/HTMLBooleanEleme
//@{ nt.h
* \brief Template for concrete boolean HTMLElement subclasses
/*!
* \brief Create a new empty boolean element.
* *
* A boolean HTML element is an element having a boolean (open or closed)
* state. Most commonly used HTML tags are boolean elements:
\verbatim
<a href="http://www.gnu.org">GNU Project</a>
\endverbatim
* The \c a element is boolean, since it is either open or closed. Boole
an
* elements are often additive:
\verbatim
<b>bold text<i>bold italic text</i></b>
\endverbatim
* Note than under the XHTML 1.0 standard, elements may not overlap; ie,
* in the example above, it would be illegal to close the \c b tag before
* the \c i tag.
* \sa HTMLElement
* \sa HTMLAtomicElement
*/ */
HTMLBooleanElement() template<class Tag>
: HTMLElement(0, 0, 0, eBoolean) class HTMLBooleanElement : public HTMLElement
{} {
public:
/*! // ============================================================
* \brief Create a new element, specifying the enclosed text.
* \param text The text within the element.
*/
HTMLBooleanElement(const STDNS string& text)
: HTMLElement(0, 0, &text, eBoolean)
{}
/*! /*! \name Constructors and Destructor */
* \brief Create a new element, specifying the HTMLAttribute objects. //@{
* \param attributes The HTMLAttributes contained within the element.
*/
HTMLBooleanElement(const HTMLAttributeList& attributes)
: HTMLElement(&attributes, 0, 0, eBoolean)
{}
/*! /*!
* \brief Create a new element, specifying an embedded HTMLElement. * \brief Create a new empty boolean element.
* \param embed The HTMLElement embedded inside the element. *
*/ */
HTMLBooleanElement(const HTMLElement& embedded) HTMLBooleanElement()
: HTMLElement(0, &embedded, 0, eBoolean) : HTMLElement(0, 0, 0, eBoolean)
{} {}
/*! /*!
* \brief Create a new element, specifying the enclosed text and * \brief Create a new element, specifying the enclosed text.
* HTMLAttribute objects. * \param text The text within the element.
* \param attributes The HTMLAttributes contained within the element. */
* \param text The text within the element. HTMLBooleanElement(const std::string& text)
*/ : HTMLElement(0, 0, &text, eBoolean)
HTMLBooleanElement(const STDNS string& text, {}
const HTMLAttributeList& attributes)
: HTMLElement(&attributes, 0, &text, eBoolean)
{}
/*! /*!
* \brief Create a new element, specifying the HTMLAttributes and embedde * \brief Create a new element, specifying the HTMLAttribute objects.
d * \param attributes The HTMLAttributes contained within the element.
* HTMLElement. */
* \param attributes The HTMLAttributes contained within the element. HTMLBooleanElement(const HTMLAttributeList& attributes)
* \param embed The HTMLElement embedded inside the element. : HTMLElement(&attributes, 0, 0, eBoolean)
*/ {}
HTMLBooleanElement(const HTMLAttributeList& attributes,
const HTMLElement& embed)
: HTMLElement(&attributes, &embed, 0, eBoolean)
{}
/*! /*!
* \brief Destructor * \brief Create a new element, specifying an embedded HTMLElement.
* * \param embedded The HTMLElement embedded inside the element.
*/ */
virtual ~HTMLBooleanElement() HTMLBooleanElement(const HTMLElement& embedded)
{} : HTMLElement(0, &embedded, 0, eBoolean)
//@} {}
// ============================================================ /*!
* \brief Create a new element, specifying the enclosed text and
* HTMLAttribute objects.
* \param attributes The HTMLAttributes contained within the element.
* \param text The text within the element.
*/
HTMLBooleanElement(const std::string& text,
const HTMLAttributeList& attributes)
: HTMLElement(&attributes, 0, &text, eBoolean)
{}
/*! /*!
* \brief Clone this element * \brief Create a new element, specifying the HTMLAttributes and embed
* \return A newly-allocated copy of this element ded
*/ * HTMLElement.
virtual inline HTMLElement* * \param attributes The HTMLAttributes contained within the element.
clone() const * \param embed The HTMLElement embedded inside the element.
{ return new HTMLBooleanElement<Tag>(*this); } */
HTMLBooleanElement(const HTMLAttributeList& attributes,
const HTMLElement& embed)
: HTMLElement(&attributes, &embed, 0, eBoolean)
{}
// ============================================================ /*!
* \brief Destructor
*
*/
virtual ~HTMLBooleanElement()
{}
//@}
/*! // ============================================================
* \brief Get the name of this element. For example, "strong"
* \return The name of this element
*/
virtual inline const char*
getName() const
{ return Tag::getName(); }
// ============================================================ /*!
* \brief Clone this element
* \return A newly-allocated copy of this element
*/
virtual inline HTMLElement*
clone() const
{ return new HTMLBooleanElement<Tag>(*this); }
/*! \name State Management */ // ============================================================
//@{
/*! /*!
* \brief Swap the state of this boolean element * \brief Get the name of this element. For example, "strong"
* * \return The name of this element
* A state of \c true indicates the element is currently open */
*/ virtual inline const char*
virtual inline void getName() const
swapState() const { return Tag::getName(); }
{ sState = ! sState; }
/*! // ============================================================
* \brief Get the state of this boolean element
* \return \c true if this element is open, \c false otherwise
*/
virtual inline bool
getState() const
{ return sState; }
/*! /*! \name State Management */
* \brief Reset the state of this boolean element to closed //@{
*
*/
static inline void
reset()
{ sState = false; }
//@}
private: /*!
static bool sState; * \brief Swap the state of this boolean element
}; *
* A state of \c true indicates the element is currently open
*/
virtual inline void
swapState() const
{ sState = ! sState; }
template<class Tag> /*!
bool CGICCNS HTMLBooleanElement<Tag>::sState = false; * \brief Get the state of this boolean element
* \return \c true if this element is open, \c false otherwise
*/
virtual inline bool
getState() const
{ return sState; }
CGICC_END_NAMESPACE /*!
* \brief Reset the state of this boolean element to closed
*
*/
static inline void
reset()
{ sState = false; }
//@}
private:
static bool sState;
};
template<class Tag>
bool cgicc::HTMLBooleanElement<Tag>::sState = false;
} // namespace cgicc
#endif /* ! _HTMLBOOLEANELEMENT_H_ */ #endif /* ! _HTMLBOOLEANELEMENT_H_ */
 End of changes. 25 change blocks. 
137 lines changed or deleted 138 lines changed or added


 HTMLClasses.h   HTMLClasses.h 
/* -*-c++-*- */ /* -*-c++-*- */
/* /*
* $Id: HTMLClasses.h,v 1.9 2002/03/06 02:49:55 sbooth Exp $ * $Id: HTMLClasses.h,v 1.12 2003/07/17 05:16:03 sbooth Exp $
* *
* Copyright (C) 1996 - 2002 Stephen F. Booth * Copyright (C) 1996 - 2003 Stephen F. Booth
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either * License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version. * version 2.1 of the License, or (at your option) any later version.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details. * Lesser General Public License for more details.
skipping to change at line 77 skipping to change at line 77
* \param name The name of the class to define * \param name The name of the class to define
* \param tag The text to output when this tag is rendered * \param tag The text to output when this tag is rendered
*/ */
#define BOOLEAN_ELEMENT(name, tag) \ #define BOOLEAN_ELEMENT(name, tag) \
TAG(name, tag); typedef HTMLBooleanElement<name##Tag> name TAG(name, tag); typedef HTMLBooleanElement<name##Tag> name
// ============================================================ // ============================================================
// HTML 4.0 elements - for details see http://www.w3.org/ // HTML 4.0 elements - for details see http://www.w3.org/
// ============================================================ // ============================================================
CGICC_BEGIN_NAMESPACE namespace cgicc {
// ============================================================ // ============================================================
// Class comment - needs special render function // Class comment - needs special render function
// ============================================================ // ============================================================
class nullTag class nullTag
{ public: inline static const char* getName() { return 0; } }; { public: inline static const char* getName() { return 0; } };
/*! \class comment HTMLGeneric.h cgicc/HTMLGeneric.h /*! \class comment HTMLClasses.h cgicc/HTMLClasses.h
* \brief An HTML comment * \brief An HTML comment
*/ */
class comment : public HTMLBooleanElement<nullTag> class comment : public HTMLBooleanElement<nullTag>
{
virtual void render(STDNS ostream& out) const
{ {
if(getData().empty() && dataSpecified() == false) { virtual void render(std::ostream& out) const
swapState(); {
out << (getState() ? "<!-- " : " -->"); if(getData().empty() && dataSpecified() == false) {
swapState();
out << (getState() ? "<!-- " : " -->");
}
else
out << "<!-- " << getData() << " -->";
} }
else };
out << "<!-- " << getData() << " -->";
}
};
BOOLEAN_ELEMENT (html, "html"); // HTML document BOOLEAN_ELEMENT (html, "html"); // HTML document
BOOLEAN_ELEMENT (head, "head"); // document head BOOLEAN_ELEMENT (head, "head"); // document head
BOOLEAN_ELEMENT (title, "title"); // document title BOOLEAN_ELEMENT (title, "title"); // document title
ATOMIC_ELEMENT (meta, "meta"); // meta data ATOMIC_ELEMENT (meta, "meta"); // meta data
BOOLEAN_ELEMENT (style, "style"); // style sheet BOOLEAN_ELEMENT (style, "style"); // style sheet
BOOLEAN_ELEMENT (body, "body"); // document body BOOLEAN_ELEMENT (body, "body"); // document body
#if CGICC_USE_NAMESPACES BOOLEAN_ELEMENT (div, "div"); // block-level grouping
BOOLEAN_ELEMENT (div, "div"); // block-level grouping BOOLEAN_ELEMENT (span, "span"); // inline grouping
#else BOOLEAN_ELEMENT (h1, "h1"); // level 1 heading
BOOLEAN_ELEMENT (div_, "div"); // block-level grouping BOOLEAN_ELEMENT (h2, "h2"); // level 2 heading
#endif BOOLEAN_ELEMENT (h3, "h3"); // level 3 heading
BOOLEAN_ELEMENT (span, "span"); // inline grouping BOOLEAN_ELEMENT (h4, "h4"); // level 4 heading
BOOLEAN_ELEMENT (h1, "h1"); // level 1 heading BOOLEAN_ELEMENT (h5, "h5"); // level 5 heading
BOOLEAN_ELEMENT (h2, "h2"); // level 2 heading BOOLEAN_ELEMENT (h6, "h6"); // level 6 heading
BOOLEAN_ELEMENT (h3, "h3"); // level 3 heading BOOLEAN_ELEMENT (address, "address"); // contact information
BOOLEAN_ELEMENT (h4, "h4"); // level 4 heading
BOOLEAN_ELEMENT (h5, "h5"); // level 5 heading
BOOLEAN_ELEMENT (h6, "h6"); // level 6 heading
BOOLEAN_ELEMENT (address, "address"); // contact information
// text markup // text markup
BOOLEAN_ELEMENT (em, "em"); // emphasis BOOLEAN_ELEMENT (em, "em"); // emphasis
BOOLEAN_ELEMENT (strong, "strong"); // stronger emphasis BOOLEAN_ELEMENT (strong, "strong"); // stronger emphasis
BOOLEAN_ELEMENT (cite, "cite"); // citation/reference BOOLEAN_ELEMENT (cite, "cite"); // citation/reference
BOOLEAN_ELEMENT (dfn, "dfn"); // defining instance BOOLEAN_ELEMENT (dfn, "dfn"); // defining instance
BOOLEAN_ELEMENT (code, "code"); // computer code BOOLEAN_ELEMENT (code, "code"); // computer code
BOOLEAN_ELEMENT (samp, "samp"); // sample output BOOLEAN_ELEMENT (samp, "samp"); // sample output
BOOLEAN_ELEMENT (kbd, "kbd"); // user input BOOLEAN_ELEMENT (kbd, "kbd"); // user input
BOOLEAN_ELEMENT (var, "var"); // variable/argument BOOLEAN_ELEMENT (var, "var"); // variable/argument
BOOLEAN_ELEMENT (abbr, "abbr"); // abbreviated form BOOLEAN_ELEMENT (abbr, "abbr"); // abbreviated form
BOOLEAN_ELEMENT (acronym, "acronym"); // acronym BOOLEAN_ELEMENT (acronym, "acronym"); // acronym
BOOLEAN_ELEMENT (blockquote, "blockquote"); // block-level quotation BOOLEAN_ELEMENT (blockquote, "blockquote"); // block-level quotation
BOOLEAN_ELEMENT (q, "q"); // inline quotation BOOLEAN_ELEMENT (q, "q"); // inline quotation
BOOLEAN_ELEMENT (sub, "sub"); // subscript BOOLEAN_ELEMENT (sub, "sub"); // subscript
BOOLEAN_ELEMENT (sup, "sup"); // superscript BOOLEAN_ELEMENT (sup, "sup"); // superscript
BOOLEAN_ELEMENT (p, "p"); // paragraph BOOLEAN_ELEMENT (p, "p"); // paragraph
ATOMIC_ELEMENT (br, "br"); // line break ATOMIC_ELEMENT (br, "br"); // line break
BOOLEAN_ELEMENT (pre, "pre"); // preformatted text BOOLEAN_ELEMENT (pre, "pre"); // preformatted text
BOOLEAN_ELEMENT (ins, "ins"); // inserted text BOOLEAN_ELEMENT (ins, "ins"); // inserted text
BOOLEAN_ELEMENT (del, "del"); // deleted text BOOLEAN_ELEMENT (del, "del"); // deleted text
BOOLEAN_ELEMENT (bdo, "bdo"); // overriding direction BOOLEAN_ELEMENT (bdo, "bdo"); // overriding direction
// lists // lists
BOOLEAN_ELEMENT (ul, "ul"); // unordered list BOOLEAN_ELEMENT (ul, "ul"); // unordered list
BOOLEAN_ELEMENT (ol, "ol"); // ordered list BOOLEAN_ELEMENT (ol, "ol"); // ordered list
BOOLEAN_ELEMENT (li, "li"); // list item BOOLEAN_ELEMENT (li, "li"); // list item
BOOLEAN_ELEMENT (dl, "dl"); // definition list BOOLEAN_ELEMENT (dl, "dl"); // definition list
BOOLEAN_ELEMENT (dt, "dt"); // term to be defined BOOLEAN_ELEMENT (dt, "dt"); // term to be defined
BOOLEAN_ELEMENT (dd, "dd"); // definition of term BOOLEAN_ELEMENT (dd, "dd"); // definition of term
// tables // tables
BOOLEAN_ELEMENT (table, "table"); // table element BOOLEAN_ELEMENT (table, "table"); // table element
BOOLEAN_ELEMENT (caption, "caption"); // table caption BOOLEAN_ELEMENT (caption, "caption"); // table caption
BOOLEAN_ELEMENT (thead, "thead"); // table head section BOOLEAN_ELEMENT (thead, "thead"); // table head section
BOOLEAN_ELEMENT (tfoot, "tfoot"); // table foot section BOOLEAN_ELEMENT (tfoot, "tfoot"); // table foot section
BOOLEAN_ELEMENT (tbody, "tbody"); // table body section BOOLEAN_ELEMENT (tbody, "tbody"); // table body section
BOOLEAN_ELEMENT (colgroup, "colgroup"); // vertical section BOOLEAN_ELEMENT (colgroup, "colgroup"); // vertical section
ATOMIC_ELEMENT (col, "col"); // column attributes ATOMIC_ELEMENT (col, "col"); // column attributes
BOOLEAN_ELEMENT (tr, "tr"); // table row BOOLEAN_ELEMENT (tr, "tr"); // table row
BOOLEAN_ELEMENT (th, "th"); // table header cell BOOLEAN_ELEMENT (th, "th"); // table header cell
BOOLEAN_ELEMENT (td, "td"); // table data cell BOOLEAN_ELEMENT (td, "td"); // table data cell
// links // links
BOOLEAN_ELEMENT (a, "a"); // anchor BOOLEAN_ELEMENT (a, "a"); // anchor
#if CGICC_USE_NAMESPACES ATOMIC_ELEMENT (link, "link"); // document link
ATOMIC_ELEMENT (link, "link"); // document link ATOMIC_ELEMENT (base, "base"); // path information
#else
ATOMIC_ELEMENT (link_, "link"); // document link
#endif
ATOMIC_ELEMENT (base, "base"); // path information
// objects // objects
ATOMIC_ELEMENT (img, "img"); // inline image ATOMIC_ELEMENT (img, "img"); // inline image
BOOLEAN_ELEMENT (object, "object"); // generic object BOOLEAN_ELEMENT (object, "object"); // generic object
ATOMIC_ELEMENT (param, "param"); // object parameters ATOMIC_ELEMENT (param, "param"); // object parameters
BOOLEAN_ELEMENT (map, "map"); // client image map BOOLEAN_ELEMENT (map, "map"); // client image map
ATOMIC_ELEMENT (area, "area"); // image map region ATOMIC_ELEMENT (area, "area"); // image map region
ATOMIC_ELEMENT (hr, "hr"); // horizontal rule ATOMIC_ELEMENT (hr, "hr"); // horizontal rule
// fonts - preferably use stylesheets // fonts - preferably use stylesheets
BOOLEAN_ELEMENT (tt, "tt"); // monospaced text BOOLEAN_ELEMENT (tt, "tt"); // monospaced text
BOOLEAN_ELEMENT (i, "i"); // italic text style BOOLEAN_ELEMENT (i, "i"); // italic text style
BOOLEAN_ELEMENT (b, "b"); // bold text style BOOLEAN_ELEMENT (b, "b"); // bold text style
BOOLEAN_ELEMENT (big, "big"); // large font BOOLEAN_ELEMENT (big, "big"); // large font
BOOLEAN_ELEMENT (small, "small"); // small font BOOLEAN_ELEMENT (small, "small"); // small font
// frames - not part of the strict DTD // frames - not part of the strict DTD
BOOLEAN_ELEMENT (frameset, "frameset"); // frame layout BOOLEAN_ELEMENT (frameset, "frameset"); // frame layout
ATOMIC_ELEMENT (frame, "frame"); // frame contents ATOMIC_ELEMENT (frame, "frame"); // frame contents
BOOLEAN_ELEMENT (noframes, "noframes"); // alternative text BOOLEAN_ELEMENT (noframes, "noframes"); // alternative text
BOOLEAN_ELEMENT (iframe, "iframe"); // inline frame BOOLEAN_ELEMENT (iframe, "iframe"); // inline frame
// forms // forms
BOOLEAN_ELEMENT (form, "form"); // form element BOOLEAN_ELEMENT (form, "form"); // form element
ATOMIC_ELEMENT (input, "input"); // generic input ATOMIC_ELEMENT (input, "input"); // generic input
BOOLEAN_ELEMENT (button, "button"); // special button BOOLEAN_ELEMENT (button, "button"); // special button
#if CGICC_USE_NAMESPACES BOOLEAN_ELEMENT (select, "select"); // option menu
BOOLEAN_ELEMENT (select, "select"); // option menu BOOLEAN_ELEMENT (optgroup, "optgroup"); // option group
#else BOOLEAN_ELEMENT (option, "option"); // option item
BOOLEAN_ELEMENT (select_, "select"); // option menu BOOLEAN_ELEMENT (textarea, "textarea"); // multi-line text input
#endif BOOLEAN_ELEMENT (label, "label"); // input label
BOOLEAN_ELEMENT (optgroup, "optgroup"); // option group BOOLEAN_ELEMENT (fieldset, "fieldset"); // grouping input fields
BOOLEAN_ELEMENT (option, "option"); // option item BOOLEAN_ELEMENT (legend, "legend"); // caption for field set
BOOLEAN_ELEMENT (textarea, "textarea"); // multi-line text input
BOOLEAN_ELEMENT (label, "label"); // input label
BOOLEAN_ELEMENT (fieldset, "fieldset"); // grouping input fields
BOOLEAN_ELEMENT (legend, "legend"); // caption for field set
// scripts // scripts
BOOLEAN_ELEMENT (script, "script"); // script element BOOLEAN_ELEMENT (script, "script"); // script element
BOOLEAN_ELEMENT (noscript, "noscript"); // alternative text BOOLEAN_ELEMENT (noscript, "noscript"); // alternative text
CGICC_END_NAMESPACE } // namespace cgicc
#endif /* ! _HTMLCLASSES_H_ */ #endif /* ! _HTMLCLASSES_H_ */
 End of changes. 28 change blocks. 
124 lines changed or deleted 112 lines changed or added


 HTMLDoctype.h   HTMLDoctype.h 
/* -*-c++-*- */ /* -*-c++-*- */
/* /*
* $Id: HTMLDoctype.h,v 1.3 2002/03/06 02:49:55 sbooth Exp $ * $Id: HTMLDoctype.h,v 1.5 2003/07/13 14:20:35 sbooth Exp $
* *
* Copyright (C) 1996 - 2002 Stephen F. Booth * Copyright (C) 1996 - 2003 Stephen F. Booth
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either * License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version. * version 2.1 of the License, or (at your option) any later version.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details. * Lesser General Public License for more details.
skipping to change at line 38 skipping to change at line 38
/*! \file HTMLDoctype.h /*! \file HTMLDoctype.h
* \brief Class which specifies the DTD of the HTML 4 document * \brief Class which specifies the DTD of the HTML 4 document
* *
*/ */
#include <string> #include <string>
#include "cgicc/MStreamable.h" #include "cgicc/MStreamable.h"
CGICC_BEGIN_NAMESPACE namespace cgicc {
// ============================================================ // ============================================================
// Class HTMLDoctype // Class HTMLDoctype
// ============================================================ // ============================================================
/*! \class HTMLDoctype HTMLDoctype.h cgicc/HTMLDoctype.h /*! \class HTMLDoctype HTMLDoctype.h cgicc/HTMLDoctype.h
* \brief Specifies the DTD of the HTML 4 document * \brief Specifies the DTD of the HTML 4 document
* *
* To use this class, simply write an object of this type to an ostream: * To use this class, simply write an object of this type to an ostream:
* \code * \code
* out << cgicc::HTMLDoctype(); * out << cgicc::HTMLDoctype();
* \endcode * \endcode
* For more information, see \c http://www.w3.org/MarkUp/ and * For more information, see \c http://www.w3.org/MarkUp/ and
* \c http://www.w3.org/TR/REC-html40/ * \c http://www.w3.org/TR/REC-html40/
*/ */
class CGICC_API HTMLDoctype : public MStreamable class CGICC_API HTMLDoctype : public MStreamable
{ {
public: public:
/*! The DTD used by this document. */ /*! The DTD used by this document. */
enum EDocumentType { enum EDocumentType {
/*! The HTML 4.0 strict DTD (the default) */ /*! The HTML 4.0 strict DTD (the default) */
eStrict, eStrict,
/*! The HTML 4.0 Transitional DTD */ /*! The HTML 4.0 Transitional DTD */
eTransitional, eTransitional,
/*! The HTML 4.0 Frameset DTD */ /*! The HTML 4.0 Frameset DTD */
eFrames eFrames
}; };
/*! /*!
* \brief Constructor. * \brief Constructor.
* \param type The version of the HTML 4.0 DTD used by this document. * \param type The version of the HTML 4.0 DTD used by this document.
*/ */
HTMLDoctype(EDocumentType type = eStrict); HTMLDoctype(EDocumentType type = eStrict);
/*! /*!
* \brief Destructor * \brief Destructor
* *
*/ */
virtual ~HTMLDoctype(); virtual ~HTMLDoctype();
virtual void virtual void
render(STDNS ostream& out) const; render(std::ostream& out) const;
private: private:
EDocumentType fType; EDocumentType fType;
}; };
CGICC_END_NAMESPACE } // namespace cgicc
#endif /* ! _HTMLDOCTYPE_H_ */ #endif /* ! _HTMLDOCTYPE_H_ */
 End of changes. 11 change blocks. 
44 lines changed or deleted 44 lines changed or added


 HTMLElement.h   HTMLElement.h 
/* -*-c++-*- */ /* -*-c++-*- */
/* /*
* $Id: HTMLElement.h,v 1.2 2002/03/06 02:49:55 sbooth Exp $ * $Id: HTMLElement.h,v 1.5 2003/07/17 05:16:03 sbooth Exp $
* *
* Copyright (C) 1996 - 2002 Stephen F. Booth * Copyright (C) 1996 - 2003 Stephen F. Booth
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either * License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version. * version 2.1 of the License, or (at your option) any later version.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details. * Lesser General Public License for more details.
skipping to change at line 42 skipping to change at line 42
* For example, \c a, \c img, \c html, and \c body, are all HTML elements. * For example, \c a, \c img, \c html, and \c body, are all HTML elements.
*/ */
#include <string> #include <string>
#include <cstring> #include <cstring>
#include "cgicc/CgiDefs.h" #include "cgicc/CgiDefs.h"
#include "cgicc/MStreamable.h" #include "cgicc/MStreamable.h"
#include "cgicc/HTMLAttributeList.h" #include "cgicc/HTMLAttributeList.h"
CGICC_BEGIN_NAMESPACE namespace cgicc {
class HTMLElementList;
// ============================================================ class HTMLElementList;
// Class HTMLElement
// ============================================================
/*! \class HTMLElement HTMLElements.h cgicc/HTMLElements.h // ============================================================
* \brief Class representing an HTML element. // Class HTMLElement
* // ============================================================
* An HTML element is any entity enclosed in angle brackets (\< and \>)
* interpreted as HTML, for example \c a, \c img, \c html, and \c body.
*
* This class is an abstract base class that defines the interface
* for all HTMLElement subclasses.
*/
class CGICC_API HTMLElement : public MStreamable
{
public:
/*! /*! \class HTMLElement HTMLElement.h cgicc/HTMLElement.h
* \brief Possible types of HTMLElements * \brief Class representing an HTML element.
* *
* An HTMLElement is either atomic, meaning it has no corresponding * An HTML element is any entity enclosed in angle brackets (\< and \>)
* closing tag (elements such as \c hr and \c br are atomic) or * interpreted as HTML, for example \c a, \c img, \c html, and \c body.
* boolean (elements such as \c a and \c ol are boolean) *
* This class is an abstract base class that defines the interface
* for all HTMLElement subclasses.
*/ */
enum EElementType { class CGICC_API HTMLElement : public MStreamable
/*! Atomic element, such as \c hr */ {
eAtomic, public:
/*! Boolean element, such as \c strong */
eBoolean
};
// ============================================================ /*!
* \brief Possible types of HTMLElements
*
* An HTMLElement is either atomic, meaning it has no corresponding
* closing tag (elements such as \c hr and \c br are atomic) or
* boolean (elements such as \c a and \c ol are boolean)
*/
enum EElementType {
/*! Atomic element, such as \c hr */
eAtomic,
/*! Boolean element, such as \c strong */
eBoolean
};
/*! \name Constructors and Destructor */ // ============================================================
//@{
/*! /*! \name Constructors and Destructor */
* \brief Copy constructor. //@{
*
* Sets the name and internal state of this element to those of \c elemen
t
* \param element The HTMLElement to copy.
*/
HTMLElement(const HTMLElement& element);
/*! /*!
* \brief Destructor * \brief Copy constructor.
* *
* Delete this HTMLElement object * Sets the name and internal state of this element to those of \c elem
*/ ent
virtual ~HTMLElement(); * \param element The HTMLElement to copy.
//@} */
HTMLElement(const HTMLElement& element);
// ============================================================ /*!
* \brief Destructor
*
* Delete this HTMLElement object
*/
virtual ~HTMLElement();
//@}
/*! \name Overloaded Operators */ // ============================================================
//@{
/*! /*! \name Overloaded Operators */
* \brief Compare two HTMLElements for equality. //@{
*
* HTMLElements are equal if they have the same name
* \param element The HTMLElement to compare to this one.
* \return \c true if the two HTMLElements are equal, \cfalse otherwise.
*/
bool
operator== (const HTMLElement& element) const;
/*! /*!
* \brief Compare two HTMLElements for inequality. * \brief Compare two HTMLElements for equality.
* *
* HTMLElements are equal if they have the same name * HTMLElements are equal if they have the same name
* \param element The HTMLElement to compare to this one. * \param element The HTMLElement to compare to this one.
* \return \c false if the two HTMLElements are equal, \c true otherwise. * \return \c true if the two HTMLElements are equal, \c false otherwis
*/ e.
inline bool */
operator!= (const HTMLElement& element) const bool
operator== (const HTMLElement& element) const;
/*!
* \brief Compare two HTMLElements for inequality.
*
* HTMLElements are equal if they have the same name
* \param element The HTMLElement to compare to this one.
* \return \c false if the two HTMLElements are equal, \c true otherwis
e.
*/
inline bool
operator!= (const HTMLElement& element) const
{ return ! operator==(element); } { return ! operator==(element); }
#ifdef WIN32 #ifdef WIN32
/* Dummy operator for MSVC++ */ /* Dummy operator for MSVC++ */
inline bool inline bool
operator< (const HTMLElement& element) const operator< (const HTMLElement& element) const
{ return false; } { return false; }
#endif #endif
/*! /*!
* \brief Assignment operator * \brief Assignment operator
* *
* Sets the name and internal state of this element to those of \c elemen * Sets the name and internal state of this element to those of \c elem
t ent
* \param element The HTMLElement to copy * \param element The HTMLElement to copy
* \return A reference to \c this * \return A reference to \c this
*/ */
HTMLElement& HTMLElement&
operator= (const HTMLElement& element); operator= (const HTMLElement& element);
//@} //@}
// ============================================================ // ============================================================
/*! \name Accessor Methods /*! \name Accessor Methods
* Information on the element * Information on the element
*/ */
//@{ //@{
/*! /*!
* \brief Get the name of this element. * \brief Get the name of this element.
* *
* For example, \c html or \c body. * For example, \c html or \c body.
* \return The name of this element. * \return The name of this element.
*/ */
virtual const char* virtual const char*
getName() const = 0; getName() const = 0;
/*! /*!
* \brief Get the data contained in this element, if any. * \brief Get the data contained in this element, if any.
* *
* This is only applicable for boolean elements * This is only applicable for boolean elements
* \return The data contained in this element. * \return The data contained in this element.
*/ */
inline STDNS string inline std::string
getData() const getData() const
{ return fData; } { return fData; }
/*! /*!
* \brief Get the type of this element * \brief Get the type of this element
* *
* Most HTMLElements are boolean * Most HTMLElements are boolean
* \return The type of this element * \return The type of this element
*/ */
inline EElementType inline EElementType
getType() const getType() const
{ return fType; } { return fType; }
//@} //@}
// ============================================================ // ============================================================
/*! \name Mutator Methods /*! \name Mutator Methods
* Set properties of the element * Set properties of the element
*/ */
//@{ //@{
/*! /*!
* \brief Set the data contained in this element. * \brief Set the data contained in this element.
* *
* The data is the text contained between the opening and closing tags * The data is the text contained between the opening and closing tags
* \param data The data to store in this element. * \param data The data to store in this element.
*/ */
inline void inline void
setData(const STDNS string& data) setData(const std::string& data)
{ fData = data; } { fData = data; }
//@} //@}
// ============================================================ // ============================================================
/*! /*!
* \brief Clone this HTMLElement * \brief Clone this HTMLElement
* *
* This performs a deep copy of the element * This performs a deep copy of the element
* \return A pointer to a newly-allocated copy of \c this. * \return A pointer to a newly-allocated copy of \c this.
*/ */
virtual HTMLElement* virtual HTMLElement*
clone() const = 0; clone() const = 0;
// ============================================================ // ============================================================
/*! \name Embedded HTMLElement Management /*! \name Embedded HTMLElement Management
* Manage elements embedded in this one * Manage elements embedded in this one
*/ */
//@{ //@{
/*! /*!
* \brief Get the HTMLElementList embedded in this element, if any. * \brief Get the HTMLElementList embedded in this element, if any.
* *
* If this method returns 0, no elements are embedded * If this method returns 0, no elements are embedded
* \return The embedded element list. * \return The embedded element list.
*/ */
inline const HTMLElementList* inline const HTMLElementList*
getEmbedded() const getEmbedded() const
{ return fEmbedded; } { return fEmbedded; }
/*! /*!
* \brief Set the HTMLElementList associated with this element. * \brief Set the HTMLElementList associated with this element.
* *
* This is usually called by subclass constructors * This is usually called by subclass constructors
* \param elements The HTMLElementList containing the HTMLElements * \param embedded The HTMLElementList containing the HTMLElements
* embedded in this element. * embedded in this element.
*/ */
void void
setEmbedded(const HTMLElementList& embedded); setEmbedded(const HTMLElementList& embedded);
/*! /*!
* \brief Add an embedded HTMLElement in this one * \brief Add an embedded HTMLElement in this one
* *
* *
* \param A reference to an HTMLElement to embed in this one * \param element A reference to an HTMLElement to embed in this one
* \return A reference to \c this * \return A reference to \c this
*/ */
HTMLElement& HTMLElement&
add(const HTMLElement& element); add(const HTMLElement& element);
/*! /*!
* \brief Add an embedded HTMLElement in this one * \brief Add an embedded HTMLElement in this one
* *
* This element takes ownership of \c element, which should not be delete * This element takes ownership of \c element, which should not be dele
d. ted.
* \param A pointer to an HTMLElement to embed. * \param element A pointer to an HTMLElement to embed.
* \return A reference to \c this * \return A reference to \c this
*/ */
HTMLElement& HTMLElement&
add(HTMLElement *element); add(HTMLElement *element);
//@} //@}
// ============================================================ // ============================================================
/*! \name HTMLAttribute Management /*! \name HTMLAttribute Management
* Manage attributes embedded in this element * Manage attributes embedded in this element
*/ */
//@{ //@{
/*! /*!
* \brief Get the attributes associated with this element. * \brief Get the attributes associated with this element.
* *
* If this method returns 0, no attributes are embedded * If this method returns 0, no attributes are embedded
* \return The attribute list. * \return The attribute list.
*/ */
inline const HTMLAttributeList* inline const HTMLAttributeList*
getAttributes() const getAttributes() const
{ return fAttributes; } { return fAttributes; }
/*! /*!
* \brief Set the attributes associated with this element. * \brief Set the attributes associated with this element.
* *
* This is usually called by subclass constructors * This is usually called by subclass constructors
* \param attributes The HTMLAttributeList containing the HTMLAttributes * \param attributes The HTMLAttributeList containing the HTMLAttribute
* belonging to this element. s
*/ * belonging to this element.
void */
setAttributes(const HTMLAttributeList& attributes); void
setAttributes(const HTMLAttributeList& attributes);
/*! /*!
* \brief Set an HTMLAttribute on this HTMLElement * \brief Set an HTMLAttribute on this HTMLElement
* *
* *
* \param name The name of the HTMLAttribute to set * \param name The name of the HTMLAttribute to set
* \return A reference to \c this * \return A reference to \c this
*/ */
HTMLElement& HTMLElement&
set(const STDNS string& name); set(const std::string& name);
/*! /*!
* \brief Set an HTMLAttribute on this HTMLElement * \brief Set an HTMLAttribute on this HTMLElement
* *
* *
* \param name The name of the HTMLAttribute * \param name The name of the HTMLAttribute
* \param value The value of the HTMLAttribute * \param value The value of the HTMLAttribute
* \return A reference to \c this * \return A reference to \c this
*/ */
HTMLElement& HTMLElement&
set(const STDNS string& name, set(const std::string& name,
const STDNS string& value); const std::string& value);
//@} //@}
// ============================================================ // ============================================================
/*! \name Boolean element methods /*! \name Boolean element methods
* Methods specific to boolean elements * Methods specific to boolean elements
*/ */
//@{ //@{
/*! /*!
* \brief Swap the state of the boolean element * \brief Swap the state of the boolean element
* *
* A state of \c true means the element is active * A state of \c true means the element is active
*/ */
virtual void virtual void
swapState() const swapState() const
{} {}
/*! /*!
* \brief Get the state of this boolean element * \brief Get the state of this boolean element
* *
* *
* \return \c true if the element is active, \c false otherwise * \return \c true if the element is active, \c false otherwise
*/ */
virtual bool virtual bool
getState() const getState() const
{ return false; } { return false; }
//@} //@}
/*! /*!
* \brief Render this HTMLElement to an ostream * \brief Render this HTMLElement to an ostream
* *
* This is used for output * This is used for output
* \param out The ostream to which to write * \param out The ostream to which to write
*/ */
virtual void virtual void
render(STDNS ostream& out) const; render(std::ostream& out) const;
protected: protected:
/*! /*!
* \brief Subclass constructor * \brief Subclass constructor
* *
* This allows the subclasses to fully specify all properties * This allows the subclasses to fully specify all properties
* \param attributes A pointer to an HTMLAttributeList containing the * \param attributes A pointer to an HTMLAttributeList containing the
* HTMLAttributes for this HTMLElement, if any * HTMLAttributes for this HTMLElement, if any
* \param embedded A pointer to the embedded HTMLElement, if any * \param embedded A pointer to the embedded HTMLElement, if any
* \param data A pointer to the data, if any * \param data A pointer to the data, if any
* \param type The type of element * \param type The type of element
*/ */
HTMLElement(const HTMLAttributeList *attributes, HTMLElement(const HTMLAttributeList *attributes,
const HTMLElement *embedded, const HTMLElement *embedded,
const STDNS string *data, const std::string *data,
EElementType type); EElementType type);
/*! /*!
* \brief For subclasses only * \brief For subclasses only
* *
* Returns \c true if data was specified in the constructor. * Returns \c true if data was specified in the constructor.
* \return \c true if data was specified in the constructor, \false other * \return \c true if data was specified in the constructor, \c false o
wise therwise
*/ */
inline bool inline bool
dataSpecified() const dataSpecified() const
{ return fDataSpecified; } { return fDataSpecified; }
private: private:
HTMLElement() {} HTMLElement() {}
HTMLAttributeList *fAttributes; HTMLAttributeList *fAttributes;
HTMLElementList *fEmbedded; HTMLElementList *fEmbedded;
STDNS string fData; std::string fData;
EElementType fType; EElementType fType;
bool fDataSpecified; bool fDataSpecified;
}; };
CGICC_END_NAMESPACE } // namespace cgicc
#endif /* ! _HTMLELEMENT_H_ */ #endif /* ! _HTMLELEMENT_H_ */
 End of changes. 51 change blocks. 
293 lines changed or deleted 296 lines changed or added


 HTMLElementList.h   HTMLElementList.h 
/* -*-c++-*- */ /* -*-c++-*- */
/* /*
* $Id: HTMLElementList.h,v 1.3 2002/03/06 02:49:55 sbooth Exp $ * $Id: HTMLElementList.h,v 1.5 2003/07/13 14:20:35 sbooth Exp $
* *
* Copyright (C) 1996 - 2002 Stephen F. Booth * Copyright (C) 1996 - 2003 Stephen F. Booth
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either * License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version. * version 2.1 of the License, or (at your option) any later version.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details. * Lesser General Public License for more details.
skipping to change at line 43 skipping to change at line 43
*/ */
#include <string> #include <string>
#include <vector> #include <vector>
#include "cgicc/CgiDefs.h" #include "cgicc/CgiDefs.h"
#include "cgicc/MStreamable.h" #include "cgicc/MStreamable.h"
#include "cgicc/HTMLAttribute.h" #include "cgicc/HTMLAttribute.h"
#include "cgicc/HTMLElement.h" #include "cgicc/HTMLElement.h"
CGICC_BEGIN_NAMESPACE namespace cgicc {
// ============================================================ // ============================================================
// Class HTMLElementList // Class HTMLElementList
// ============================================================ // ============================================================
#ifdef WIN32 #ifdef WIN32
template class CGICC_API STDNS vector<HTMLElement*>; template class CGICC_API std::vector<HTMLElement*>;
#endif #endif
/*! \class HTMLElementList HTMLElementList.h cgicc/HTMLElementList.h /*! \class HTMLElementList HTMLElementList.h cgicc/HTMLElementList.h
* \brief An expandable list of HTMLElement objects * \brief An expandable list of HTMLElement objects
* *
* An HTMLElementList represents any number of HTMLElement objects. * An HTMLElementList represents any number of HTMLElement objects.
* To add HTMLElement objects to the list, use the add() methods: * To add HTMLElement objects to the list, use the add() methods:
* \code * \code
* cgicc::HTMLElementList list; * cgicc::HTMLElementList list;
* list.add(br()); * list.add(br());
* \endcode * \endcode
* \see HTMLAttribute * \see HTMLAttribute
* \see HTMLElement * \see HTMLElement
*/ */
class CGICC_API HTMLElementList class CGICC_API HTMLElementList
{ {
public: public:
// ============================================================ // ============================================================
/*! \name Constructors and Destructor */ /*! \name Constructors and Destructor */
//@{ //@{
/*! /*!
* \brief Create an empty HTMLElementList. * \brief Create an empty HTMLElementList.
* *
* HTMLElementLists are most often created with the add() functions * HTMLElementLists are most often created with the add() functions
*/ */
HTMLElementList(); HTMLElementList();
/*! /*!
* \brief Create a new HTMLElementList, specifying the first element. * \brief Create a new HTMLElementList, specifying the first element.
* *
* The first element in the list is set to \c head * The first element in the list is set to \c head
* \param head The first element of the list * \param head The first element of the list
*/ */
HTMLElementList(const HTMLElement& head); HTMLElementList(const HTMLElement& head);
/*! /*!
* \brief Copy constructor. * \brief Copy constructor.
* *
* Sets the elements in this list to those of \c list * Sets the elements in this list to those of \c list
* \param list The HTMLElementList to copy. * \param list The HTMLElementList to copy.
*/ */
HTMLElementList(const HTMLElementList& list); HTMLElementList(const HTMLElementList& list);
/*! /*!
* \brief Destructor * \brief Destructor
* *
* Deletes this HTMLElementList object * Deletes this HTMLElementList object
*/ */
~HTMLElementList(); ~HTMLElementList();
//@} //@}
// ============================================================ // ============================================================
/*! \name Overloaded Operators */ /*! \name Overloaded Operators */
//@{ //@{
/*! /*!
* \brief Assignment operator * \brief Assignment operator
* *
* Sets the elements in this list to those of \c list * Sets the elements in this list to those of \c list
* \param list The HTMLElementList to copy * \param list The HTMLElementList to copy
* \return A reference to \c this * \return A reference to \c this
*/ */
HTMLElementList& HTMLElementList&
operator= (const HTMLElementList& list); operator= (const HTMLElementList& list);
//@} //@}
// ============================================================ // ============================================================
/*! \name List Management /*! \name List Management
* Manage the elements in the list * Manage the elements in the list
*/ */
//@{ //@{
/*! /*!
* \brief Add an HTMLElement to the list. * \brief Add an HTMLElement to the list.
* *
* \param element The HTMLElement to add. * \param element The HTMLElement to add.
* \return A reference to \c this * \return A reference to \c this
*/ */
HTMLElementList& HTMLElementList&
add(const HTMLElement& element); add(const HTMLElement& element);
/*! /*!
* \brief Add an HTMLElement to the list. * \brief Add an HTMLElement to the list.
* *
* \param element The HTMLElement to add. * \param element The HTMLElement to add.
* \return A reference to the \c this * \return A reference to the \c this
*/ */
HTMLElementList& HTMLElementList&
add(HTMLElement *element); add(HTMLElement *element);
//@} //@}
/*! Utility Methods */ /*! Utility Methods */
//@{ //@{
/*! /*!
* \brief Render this HTMLElementList * \brief Render this HTMLElementList
* *
* \param out The ostream to which to write * \param out The ostream to which to write
*/ */
void void
render(STDNS ostream& out) const; render(std::ostream& out) const;
//@} //@}
private: private:
STDNS vector<HTMLElement*> fElements; std::vector<HTMLElement*> fElements;
// elements must be stored as pointers, otherwise polymorphism does not w // elements must be stored as pointers, otherwise polymorphism doesn't
ork work
}; };
CGICC_END_NAMESPACE } // namespace cgicc
#endif /* ! _HTMLELEMENTLIST_H_ */ #endif /* ! _HTMLELEMENTLIST_H_ */
 End of changes. 23 change blocks. 
103 lines changed or deleted 103 lines changed or added


 HTTPContentHeader.h   HTTPContentHeader.h 
/* -*-c++-*- */ /* -*-c++-*- */
/* /*
* $Id: HTTPContentHeader.h,v 1.2 2002/03/06 02:49:55 sbooth Exp $ * $Id: HTTPContentHeader.h,v 1.4 2003/07/13 14:20:35 sbooth Exp $
* *
* Copyright (C) 1996 - 2002 Stephen F. Booth * Copyright (C) 1996 - 2003 Stephen F. Booth
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either * License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version. * version 2.1 of the License, or (at your option) any later version.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details. * Lesser General Public License for more details.
skipping to change at line 38 skipping to change at line 38
/*! \file HTTPContentHeader.h /*! \file HTTPContentHeader.h
* \brief Class for sending data of a specific MIME type * \brief Class for sending data of a specific MIME type
* *
*/ */
#include <string> #include <string>
#include "cgicc/HTTPHeader.h" #include "cgicc/HTTPHeader.h"
CGICC_BEGIN_NAMESPACE namespace cgicc {
// ============================================================ // ============================================================
// Class HTTPContentHeader // Class HTTPContentHeader
// ============================================================ // ============================================================
/*! \class HTTPContentHeader HTTPContentHeader.h cgicc/HTTPContentHeader.h /*! \class HTTPContentHeader HTTPContentHeader.h cgicc/HTTPContentHeader.
* \brief HTTP header for data of a specified MIME type. h
* * \brief HTTP header for data of a specified MIME type.
*/ *
class CGICC_API HTTPContentHeader : public HTTPHeader */
{ class CGICC_API HTTPContentHeader : public HTTPHeader
public: {
public:
/*! \name Constructor and Destructor */ /*! \name Constructor and Destructor */
//@{ //@{
/*! /*!
* \brief Create a new MIME type header. * \brief Create a new MIME type header.
* \param mimeType The MIME type of the data which will be sent. * \param mimeType The MIME type of the data which will be sent.
*/ */
HTTPContentHeader(const STDNS string& mimeType); HTTPContentHeader(const std::string& mimeType);
/*! /*!
* \brief Destructor * \brief Destructor
* *
*/ */
virtual ~HTTPContentHeader(); virtual ~HTTPContentHeader();
//@} //@}
/*! \name Inherited Methods */ /*! \name Inherited Methods */
//@{ //@{
virtual void virtual void
render(STDNS ostream& out) const; render(std::ostream& out) const;
//@} //@}
private: private:
HTTPContentHeader(); HTTPContentHeader();
}; };
CGICC_END_NAMESPACE } // namespace cgicc
#endif /* ! _HTTPCONTENTHEADER_H_ */ #endif /* ! _HTTPCONTENTHEADER_H_ */
 End of changes. 10 change blocks. 
35 lines changed or deleted 36 lines changed or added


 HTTPCookie.h   HTTPCookie.h 
/* -*-c++-*- */ /* -*-c++-*- */
/* /*
* $Id: HTTPCookie.h,v 1.3 2002/03/09 18:34:18 sbooth Exp $ * $Id: HTTPCookie.h,v 1.5 2003/07/13 14:20:35 sbooth Exp $
* *
* Copyright (C) 1996 - 2002 Stephen F. Booth * Copyright (C) 1996 - 2003 Stephen F. Booth
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either * License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version. * version 2.1 of the License, or (at your option) any later version.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details. * Lesser General Public License for more details.
skipping to change at line 38 skipping to change at line 38
/*! \file HTTPCookie.h /*! \file HTTPCookie.h
* \brief An HTTP Cookie * \brief An HTTP Cookie
*/ */
#include <string> #include <string>
#include "cgicc/MStreamable.h" #include "cgicc/MStreamable.h"
#include "cgicc/CgiDefs.h" #include "cgicc/CgiDefs.h"
CGICC_BEGIN_NAMESPACE namespace cgicc {
// ============================================================
// Class HTTPCookie
// ============================================================
/*! \class HTTPCookie HTTPCookie.h cgicc/HTTPCookie.h
* \brief An HTTP cookie
*
* An HTTP cookie is a way to maintain state between stateless HTTP
* requests. HTTP cookies consist of name/value pairs, with optional
* comments, domains, and expiration dates. Usually, you will add one
or more HTTPCookie objects to the HTTP headers your script is
* returning. For example, to set a cookie called \c count to \c 1 in
* a normal HTML document:
* \code
* out << HTTPHTMLHeader().setCookie(HTTPCookie("count","1"));
* \endcode
*/
class CGICC_API HTTPCookie : public MStreamable
{
public:
/*! \name Constructors and Destructor */
//@{
/*! // ============================================================
* \brief Default Constructor // Class HTTPCookie
// ============================================================
/*! \class HTTPCookie HTTPCookie.h cgicc/HTTPCookie.h
* \brief An HTTP cookie
* *
* Create a new, empty HTTPCookie. * An HTTP cookie is a way to maintain state between stateless HTTP
* requests. HTTP cookies consist of name/value pairs, with optional
* comments, domains, and expiration dates. Usually, you will add one
or more HTTPCookie objects to the HTTP headers your script is
* returning. For example, to set a cookie called \c count to \c 1 in
* a normal HTML document:
* \code
* out << HTTPHTMLHeader().setCookie(HTTPCookie("count","1"));
* \endcode
*/ */
HTTPCookie(); class CGICC_API HTTPCookie : public MStreamable
{
public:
/*! /*! \name Constructors and Destructor */
* \brief Create a new HTTPCookie //@{
*
* This is the most commonly-used constructor.
* \param name The name of the cookie.
* \param value The value of the cookie.
*/
HTTPCookie(const STDNS string& name,
const STDNS string& value);
/*! /*!
* \brief Create a new fully-spefified HTTPCookie * \brief Default Constructor
* *
* * Create a new, empty HTTPCookie.
* \param name The name of the cookie. */
* \param value The value of the cookie. HTTPCookie();
* \param comment Any comment associated with the cookie.
* \param domain The domain for which this cookie is valid- an empty stri
ng
* will use the hostname of the server which generated the cookie respons
e.
* If specified, the domain <em>must</em> start with a period('.').
* \param maxAge A number of seconds defining the lifetime of this cookie
.
* A value of \c 0 indicates the cookie expires immediately.
* \param path The subset of URLS in a domain for which the cookie is
* valid, for example \c /
* @param secure Specifies whether this is a secure cookie.
*/
HTTPCookie(const STDNS string& name,
const STDNS string& value,
const STDNS string& comment,
const STDNS string& domain,
unsigned long maxAge,
const STDNS string& path,
bool secure);
/*! /*!
* \brief Copy constructor * \brief Create a new HTTPCookie
* *
* Set the name, value, comment, domain, age and path of this cookie * This is the most commonly-used constructor.
* to those of \c cookie * \param name The name of the cookie.
* \param cookie The HTTPCookie to copy. * \param value The value of the cookie.
*/ */
HTTPCookie(const HTTPCookie& cookie); HTTPCookie(const std::string& name,
const std::string& value);
/*! /*!
* \brief Destructor * \brief Create a new fully-spefified HTTPCookie
* *
* Delete this HTTPCookie *
*/ * \param name The name of the cookie.
virtual ~HTTPCookie(); * \param value The value of the cookie.
//@} * \param comment Any comment associated with the cookie.
* \param domain The domain for which this cookie is valid- an empty st
ring
* will use the hostname of the server which generated the cookie respo
nse.
* If specified, the domain <em>must</em> start with a period('.').
* \param maxAge A number of seconds defining the lifetime of this cook
ie.
* A value of \c 0 indicates the cookie expires immediately.
* \param path The subset of URLS in a domain for which the cookie is
* valid, for example \c /
* @param secure Specifies whether this is a secure cookie.
*/
HTTPCookie(const std::string& name,
const std::string& value,
const std::string& comment,
const std::string& domain,
unsigned long maxAge,
const std::string& path,
bool secure);
// ============================================================ /*!
* \brief Copy constructor
*
* Set the name, value, comment, domain, age and path of this cookie
* to those of \c cookie
* \param cookie The HTTPCookie to copy.
*/
HTTPCookie(const HTTPCookie& cookie);
/*! \name Overloaded Operators */ /*!
//@{ * \brief Destructor
*
* Delete this HTTPCookie
*/
virtual ~HTTPCookie();
//@}
/*! // ============================================================
* \brief Compare two HTTPCookies for equality.
*
* Two HTTPCookie objects are equal if their names, values,
* comments, domains, ages, and paths match.
* \param cookie The HTTPCookie to compare to this one
* \return true if the two HTTPCookies are equal, false otherwise.
*/
bool
operator== (const HTTPCookie& cookie) const;
/*! /*! \name Overloaded Operators */
* \brief Compare two HTTPCookies for inequality. //@{
*
* Two HTTPCookie objects are equal if their names, values, /*!
* comments, domains, ages, and paths match. * \brief Compare two HTTPCookies for equality.
* \param cookie The HTTPCookie to compare to this one *
* \return false if the two HTTPCookies are equal, true otherwise. * Two HTTPCookie objects are equal if their names, values,
*/ * comments, domains, ages, and paths match.
inline bool * \param cookie The HTTPCookie to compare to this one
operator != (const HTTPCookie& cookie) const * \return true if the two HTTPCookies are equal, false otherwise.
{ return ! operator==(cookie); } */
bool
operator== (const HTTPCookie& cookie) const;
/*!
* \brief Compare two HTTPCookies for inequality.
*
* Two HTTPCookie objects are equal if their names, values,
* comments, domains, ages, and paths match.
* \param cookie The HTTPCookie to compare to this one
* \return false if the two HTTPCookies are equal, true otherwise.
*/
inline bool
operator != (const HTTPCookie& cookie) const
{ return ! operator==(cookie); }
#ifdef WIN32 #ifdef WIN32
/* Dummy operator for MSVC++ */ /* Dummy operator for MSVC++ */
inline bool inline bool
operator< (const HTTPCookie& cookie) const operator< (const HTTPCookie& cookie) const
{ return false; } { return false; }
#endif #endif
//@} //@}
// ============================================================ // ============================================================
/*! \name Accessor Methods */ /*! \name Accessor Methods */
//@{ //@{
/*! /*!
* \brief Get the name of this cookie. * \brief Get the name of this cookie.
* *
* \return The name of this cookie. * \return The name of this cookie.
*/ */
inline STDNS string inline std::string
getName() const getName() const
{ return fName; } { return fName; }
/*! /*!
* \brief Get the value of this cookie. * \brief Get the value of this cookie.
* *
* \return The value of this cookie. * \return The value of this cookie.
*/ */
inline STDNS string inline std::string
getValue() const getValue() const
{ return fValue; } { return fValue; }
/*! /*!
* \brief Get the comment of this cookie. * \brief Get the comment of this cookie.
* *
* \return The comment of this cookie. * \return The comment of this cookie.
*/ */
inline STDNS string inline std::string
getComment() const getComment() const
{ return fComment; } { return fComment; }
/*! /*!
* \brief Get the domain for which this cookie is valid. * \brief Get the domain for which this cookie is valid.
* *
* An empty string indicates the hostname of the server which * An empty string indicates the hostname of the server which
* generated the cookie response. * generated the cookie response.
* \return The domain of this cookie, or "" if none. * \return The domain of this cookie, or "" if none.
*/ */
inline STDNS string inline std::string
getDomain() const getDomain() const
{ return fDomain; } { return fDomain; }
/*! /*!
* \brief Get the lifetime of this cookie, in seconds. * \brief Get the lifetime of this cookie, in seconds.
* *
* \return The lifetime of this cookie, or 0 if none. * \return The lifetime of this cookie, or 0 if none.
*/ */
inline unsigned long inline unsigned long
getMaxAge() const getMaxAge() const
{ return fMaxAge; } { return fMaxAge; }
/*! /*!
* \brief Get the path of this cookie. * \brief Get the path of this cookie.
* *
* This is the subset of URLS in a domain for which the cookie is * This is the subset of URLS in a domain for which the cookie is
* valid, for example \c / * valid, for example \c /
* \return The path of this cookie, or "" if none. * \return The path of this cookie, or "" if none.
*/ */
inline STDNS string inline std::string
getPath() const getPath() const
{ return fPath; } { return fPath; }
/*! /*!
* \brief Determine if this is a secure cookie. * \brief Determine if this is a secure cookie.
* *
* \return True if this cookie is secure, false if not. * \return True if this cookie is secure, false if not.
*/ */
inline bool inline bool
isSecure() const isSecure() const
{ return fSecure; } { return fSecure; }
//@} //@}
// ============================================================ // ============================================================
/*! \name Mutator Methods */ /*! \name Mutator Methods */
//@{ //@{
/*! /*!
* \brief Set the name of this cookie. * \brief Set the name of this cookie.
* *
* \param name The name of this cookie. * \param name The name of this cookie.
*/ */
inline void inline void
setName(const STDNS string& name) setName(const std::string& name)
{ fName = name; } { fName = name; }
/*! /*!
* \brief Set the value of this cookie. * \brief Set the value of this cookie.
* *
* \param value The value of this cookie. * \param value The value of this cookie.
*/ */
inline void inline void
setValue(const STDNS string& value) setValue(const std::string& value)
{ fValue = value; } { fValue = value; }
/*! /*!
* \brief Set the comment of this cookie. * \brief Set the comment of this cookie.
* *
* \param comment The comment of this cookie. * \param comment The comment of this cookie.
*/ */
inline void inline void
setComment(const STDNS string& comment) setComment(const std::string& comment)
{ fComment = comment; } { fComment = comment; }
/*! /*!
* \brief Set the domain of this cookie. * \brief Set the domain of this cookie.
* *
* An empty string indicates the hostname of the server which * An empty string indicates the hostname of the server which
* generated the cookie response. If specified, the domain * generated the cookie response. If specified, the domain
* <em>must</em> start with a period('.'). * <em>must</em> start with a period('.').
* \param domain The domain of this cookie. * \param domain The domain of this cookie.
*/ */
inline void inline void
setDomain(const STDNS string& domain) setDomain(const std::string& domain)
{ fDomain = domain; } { fDomain = domain; }
/*! /*!
* \brief Set the lifetime of this cookie, in seconds. * \brief Set the lifetime of this cookie, in seconds.
* *
* A value of \c 0 indicated the cookie expires immediately * A value of \c 0 indicated the cookie expires immediately
* \param maxAge The lifetime of this cookie, in seconds. * \param maxAge The lifetime of this cookie, in seconds.
*/ */
inline void inline void
setMaxAge(unsigned long maxAge) setMaxAge(unsigned long maxAge)
{ fMaxAge = maxAge; } { fMaxAge = maxAge; }
/*! /*!
* \brief Set the path of this cookie. * \brief Set the path of this cookie.
* *
* This is the subset of URLS in a domain for which the cookie is * This is the subset of URLS in a domain for which the cookie is
* valid, for example \c / * valid, for example \c /
* \param path The path of this cookie. * \param path The path of this cookie.
*/ */
inline void inline void
setPath(const STDNS string& path) setPath(const std::string& path)
{ fPath = path; } { fPath = path; }
/*! /*!
* \brief Mark this cookie as secure or unsecure. * \brief Mark this cookie as secure or unsecure.
* *
* \param secure Whether this is a secure cookie. * \param secure Whether this is a secure cookie.
*/ */
inline void inline void
setSecure(bool secure) setSecure(bool secure)
{ fSecure = secure; } { fSecure = secure; }
//@} //@}
// ============================================================ // ============================================================
/*! \name Inherited Methods */ /*! \name Inherited Methods */
//@{ //@{
virtual void virtual void
render(STDNS ostream& out) const; render(std::ostream& out) const;
//@} //@}
private: private:
STDNS string fName; std::string fName;
STDNS string fValue; std::string fValue;
STDNS string fComment; std::string fComment;
STDNS string fDomain; std::string fDomain;
unsigned long fMaxAge; unsigned long fMaxAge;
STDNS string fPath; std::string fPath;
bool fSecure; bool fSecure;
}; };
CGICC_END_NAMESPACE } // namespace cgicc
#endif /* ! _HTTPCOOKIE_H_ */ #endif /* ! _HTTPCOOKIE_H_ */
 End of changes. 40 change blocks. 
241 lines changed or deleted 241 lines changed or added


 HTTPHTMLHeader.h   HTTPHTMLHeader.h 
/* -*-c++-*- */ /* -*-c++-*- */
/* /*
* $Id: HTTPHTMLHeader.h,v 1.2 2002/03/06 02:49:55 sbooth Exp $ * $Id: HTTPHTMLHeader.h,v 1.4 2003/07/13 14:20:35 sbooth Exp $
* *
* Copyright (C) 1996 - 2002 Stephen F. Booth * Copyright (C) 1996 - 2003 Stephen F. Booth
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either * License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version. * version 2.1 of the License, or (at your option) any later version.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details. * Lesser General Public License for more details.
skipping to change at line 34 skipping to change at line 34
#ifdef __GNUG__ #ifdef __GNUG__
# pragma interface # pragma interface
#endif #endif
/*! \file HTTPHTMLHeader.h /*! \file HTTPHTMLHeader.h
* \brief Shortcut to HTTPContentHeader for \c text/html * \brief Shortcut to HTTPContentHeader for \c text/html
* *
*/ */
#include <string>
#include "cgicc/HTTPContentHeader.h" #include "cgicc/HTTPContentHeader.h"
CGICC_BEGIN_NAMESPACE namespace cgicc {
// ============================================================
// Class HTTPHTMLHeader
// ============================================================
/*! \class HTTPHTMLHeader HTTPHTMLHeader.h cgicc/HTTPHTMLHeader.h
* \brief Shortcut to HTTPContentHeader for \c text/html
*
*/
class CGICC_API HTTPHTMLHeader : public HTTPContentHeader
{
public:
/*! \name Constructor and Destructor */
//@{
/*! // ============================================================
* \brief Create a new \c text/html header // Class HTTPHTMLHeader
// ============================================================
/*! \class HTTPHTMLHeader HTTPHTMLHeader.h cgicc/HTTPHTMLHeader.h
* \brief Shortcut to HTTPContentHeader for \c text/html
* *
*/ */
HTTPHTMLHeader(); class CGICC_API HTTPHTMLHeader : public HTTPContentHeader
{
public:
/*! /*! \name Constructor and Destructor */
* \brief Destructor //@{
*
*/
virtual ~HTTPHTMLHeader();
//@}
};
CGICC_END_NAMESPACE /*!
* \brief Create a new \c text/html header
*
*/
HTTPHTMLHeader();
/*!
* \brief Destructor
*
*/
virtual ~HTTPHTMLHeader();
//@}
};
} // namespace cgicc
#endif /* ! _HTTPHTMLHEADER_H_ */ #endif /* ! _HTTPHTMLHEADER_H_ */
 End of changes. 8 change blocks. 
30 lines changed or deleted 28 lines changed or added


 HTTPHeader.h   HTTPHeader.h 
/* -*-c++-*- */ /* -*-c++-*- */
/* /*
* $Id: HTTPHeader.h,v 1.4 2002/03/06 02:49:55 sbooth Exp $ * $Id: HTTPHeader.h,v 1.6 2003/07/13 14:20:35 sbooth Exp $
* *
* Copyright (C) 1996 - 2002 Stephen F. Booth * Copyright (C) 1996 - 2003 Stephen F. Booth
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either * License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version. * version 2.1 of the License, or (at your option) any later version.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details. * Lesser General Public License for more details.
skipping to change at line 40 skipping to change at line 40
* \brief Abstract base class for simple HTTP headers * \brief Abstract base class for simple HTTP headers
* *
*/ */
#include <string> #include <string>
#include <vector> #include <vector>
#include "cgicc/MStreamable.h" #include "cgicc/MStreamable.h"
#include "cgicc/HTTPCookie.h" #include "cgicc/HTTPCookie.h"
CGICC_BEGIN_NAMESPACE namespace cgicc {
// ============================================================ // ============================================================
// Class HTTPHeader // Class HTTPHeader
// ============================================================ // ============================================================
/*! \class HTTPHeader HTTPHeader.h cgicc/HTTPHeader.h /*! \class HTTPHeader HTTPHeader.h cgicc/HTTPHeader.h
* \brief Abstract base class for all simple HTTP response headers. * \brief Abstract base class for all simple HTTP response headers.
* *
*/ */
class CGICC_API HTTPHeader : public MStreamable class CGICC_API HTTPHeader : public MStreamable
{ {
public: public:
/*! \name Constructors and Destructor */ /*! \name Constructors and Destructor */
//@{ //@{
/*! /*!
* \brief Constructor. * \brief Constructor.
* \param data The header data. * \param data The header data.
*/ */
HTTPHeader(const STDNS string& data); HTTPHeader(const std::string& data);
/*! /*!
* \brief Copy constructor. * \brief Copy constructor.
* \param header The HTTPHeader to copy. * \param header The HTTPHeader to copy.
*/ */
HTTPHeader(const HTTPHeader& header); HTTPHeader(const HTTPHeader& header);
/*! /*!
* \brief Destructor * \brief Destructor
* *
*/ */
virtual ~HTTPHeader(); virtual ~HTTPHeader();
//@} //@}
// ============================================================ // ============================================================
/*! \name Cookie Management */ /*! \name Cookie Management */
//@{ //@{
/*! /*!
* \brief Set a cookie to go out with this HTTPResponseHeader * \brief Set a cookie to go out with this HTTPResponseHeader
* \param cookie The HTTPCookie to set * \param cookie The HTTPCookie to set
*/ */
inline HTTPHeader& inline HTTPHeader&
setCookie(const HTTPCookie& cookie) setCookie(const HTTPCookie& cookie)
{ fCookies.push_back(cookie); return *this; } { fCookies.push_back(cookie); return *this; }
/*! /*!
* \brief Get a list of all cookies associated with this header * \brief Get a list of all cookies associated with this header
* \return All the cookies associated with this header * \return All the cookies associated with this header
*/ */
inline const STDNS vector<HTTPCookie>& inline const std::vector<HTTPCookie>&
getCookies() const getCookies() const
{ return fCookies; } { return fCookies; }
//@} //@}
// ============================================================ // ============================================================
/*! \name Accessor Method */ /*! \name Accessor Method */
//@{ //@{
/*! /*!
* Get the data contained in this HTTP header. * Get the data contained in this HTTP header.
* @return The data contained in this header. * @return The data contained in this header.
*/ */
inline STDNS string inline std::string
getData() const getData() const
{ return fData; } { return fData; }
//@} //@}
// ============================================================ // ============================================================
/*! \name Subclass Methods */ /*! \name Subclass Methods */
//@{ //@{
/*! /*!
* \brief Write this HTTPHeader to a stream. * \brief Write this HTTPHeader to a stream.
* *
* Subclasses must implement this function. * Subclasses must implement this function.
* \param out The ostream to which to write. * \param out The ostream to which to write.
*/ */
virtual void virtual void
render(STDNS ostream& out) const = 0; render(std::ostream& out) const = 0;
//@} //@}
private: private:
HTTPHeader(); HTTPHeader();
STDNS string fData; std::string fData;
STDNS vector<HTTPCookie> fCookies; std::vector<HTTPCookie> fCookies;
}; };
CGICC_END_NAMESPACE } // namespace cgicc
#endif /* ! _HTTPHEADER_H_ */ #endif /* ! _HTTPHEADER_H_ */
 End of changes. 23 change blocks. 
77 lines changed or deleted 77 lines changed or added


 HTTPPlainHeader.h   HTTPPlainHeader.h 
/* -*-c++-*- */ /* -*-c++-*- */
/* /*
* $Id: HTTPPlainHeader.h,v 1.2 2002/03/06 02:49:55 sbooth Exp $ * $Id: HTTPPlainHeader.h,v 1.4 2003/07/13 14:20:35 sbooth Exp $
* *
* Copyright (C) 1996 - 2002 Stephen F. Booth * Copyright (C) 1996 - 2003 Stephen F. Booth
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either * License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version. * version 2.1 of the License, or (at your option) any later version.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details. * Lesser General Public License for more details.
skipping to change at line 34 skipping to change at line 34
#ifdef __GNUG__ #ifdef __GNUG__
# pragma interface # pragma interface
#endif #endif
/*! \file HTTPPlainHeader.h /*! \file HTTPPlainHeader.h
* \brief Shortcut to HTTPContentHeader for \c text/plain * \brief Shortcut to HTTPContentHeader for \c text/plain
* *
*/ */
#include <string>
#include "cgicc/HTTPContentHeader.h" #include "cgicc/HTTPContentHeader.h"
CGICC_BEGIN_NAMESPACE namespace cgicc {
// ============================================================ // ============================================================
// Class HTTPPlainHeader // Class HTTPPlainHeader
// ============================================================ // ============================================================
/*! \class HTTPPlainHeader HTTPPlainHeader.h cgicc/HTTPPlainHeader.h /*! \class HTTPPlainHeader HTTPPlainHeader.h cgicc/HTTPPlainHeader.h
* \brief Shortcut to HTTPContentHeader for \c text/html * \brief Shortcut to HTTPContentHeader for \c text/html
* *
*/ */
class CGICC_API HTTPPlainHeader : public HTTPContentHeader class CGICC_API HTTPPlainHeader : public HTTPContentHeader
{ {
public: public:
/*! \brief Create a new \c text/plain header */ /*! \brief Create a new \c text/plain header */
HTTPPlainHeader(); HTTPPlainHeader();
/*! \brief Destructor */ /*! \brief Destructor */
virtual ~HTTPPlainHeader(); virtual ~HTTPPlainHeader();
}; };
CGICC_END_NAMESPACE } // namespace cgicc
#endif /* ! _HTTPPLAINHEADER_H_ */ #endif /* ! _HTTPPLAINHEADER_H_ */
 End of changes. 7 change blocks. 
21 lines changed or deleted 19 lines changed or added


 HTTPRedirectHeader.h   HTTPRedirectHeader.h 
/* -*-c++-*- */ /* -*-c++-*- */
/* /*
* $Id: HTTPRedirectHeader.h,v 1.2 2002/03/06 02:49:55 sbooth Exp $ * $Id: HTTPRedirectHeader.h,v 1.4 2003/07/13 14:20:35 sbooth Exp $
* *
* Copyright (C) 1996 - 2002 Stephen F. Booth * Copyright (C) 1996 - 2003 Stephen F. Booth
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either * License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version. * version 2.1 of the License, or (at your option) any later version.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details. * Lesser General Public License for more details.
skipping to change at line 38 skipping to change at line 38
/*! \file HTTPRedirectHeader.h /*! \file HTTPRedirectHeader.h
* \brief Class for redirecting the client to a different URI * \brief Class for redirecting the client to a different URI
* *
*/ */
#include <string> #include <string>
#include "cgicc/HTTPHeader.h" #include "cgicc/HTTPHeader.h"
CGICC_BEGIN_NAMESPACE namespace cgicc {
// ============================================================ // ============================================================
// Class HTTPRedirectHeader // Class HTTPRedirectHeader
// ============================================================ // ============================================================
/*! \class HTTPRedirectHeader HTTPRedirectHeader.h cgicc/HTTPRedirectHeader /*! \class HTTPRedirectHeader HTTPRedirectHeader.h cgicc/HTTPRedirectHead
.h er.h
* \brief Class for redirecting the client to a different URI * \brief Class for redirecting the client to a different URI
* *
*/ */
class CGICC_API HTTPRedirectHeader : public HTTPHeader class CGICC_API HTTPRedirectHeader : public HTTPHeader
{ {
public: public:
/*! \name Constructor and Destructor */ /*! \name Constructor and Destructor */
//@{ //@{
/*! /*!
* \brief Create a new redirection header. * \brief Create a new redirection header.
* \param url The redirection URL. * \param url The redirection URL.
*/ */
HTTPRedirectHeader(const STDNS string& url); HTTPRedirectHeader(const std::string& url);
/*! /*!
* \brief Destructor * \brief Destructor
* *
*/ */
virtual ~HTTPRedirectHeader(); virtual ~HTTPRedirectHeader();
//@} //@}
// ============================================================ // ============================================================
/*! \name Inherited Methods */ /*! \name Inherited Methods */
//@{ //@{
virtual void virtual void
render(STDNS ostream& out) const; render(std::ostream& out) const;
//@} //@}
private: private:
HTTPRedirectHeader(); HTTPRedirectHeader();
}; };
CGICC_END_NAMESPACE } // namespace cgicc
#endif /* ! _HTTPREDIRECTHEADER_H_ */ #endif /* ! _HTTPREDIRECTHEADER_H_ */
 End of changes. 12 change blocks. 
37 lines changed or deleted 37 lines changed or added


 HTTPResponseHeader.h   HTTPResponseHeader.h 
/* -*-c++-*- */ /* -*-c++-*- */
/* /*
* $Id: HTTPResponseHeader.h,v 1.3 2002/03/06 02:49:55 sbooth Exp $ * $Id: HTTPResponseHeader.h,v 1.6 2003/07/17 05:16:03 sbooth Exp $
* *
* Copyright (C) 1996 - 2002 Stephen F. Booth * Copyright (C) 1996 - 2003 Stephen F. Booth
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either * License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version. * version 2.1 of the License, or (at your option) any later version.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details. * Lesser General Public License for more details.
skipping to change at line 42 skipping to change at line 42
* This is an class usually only used with Non-Parsed Header (NPH) * This is an class usually only used with Non-Parsed Header (NPH)
* applications * applications
*/ */
#include <string> #include <string>
#include <vector> #include <vector>
#include "cgicc/MStreamable.h" #include "cgicc/MStreamable.h"
#include "cgicc/HTTPCookie.h" #include "cgicc/HTTPCookie.h"
CGICC_BEGIN_NAMESPACE namespace cgicc {
// ============================================================ // ============================================================
// Class HTTPResponseHeader // Class HTTPResponseHeader
// ============================================================ // ============================================================
/*! \class HTTPResponseHeader HTTPResponseHeader.h cgicc/HTTPResponseHeader /*! \class HTTPResponseHeader HTTPResponseHeader.h cgicc/HTTPResponseHead
.h er.h
* \brief Generic HTTP response header * \brief Generic HTTP response header
* *
* This class represents an HTTP response header as defined in * This class represents an HTTP response header as defined in
* section 6 of RFC 2616 (see http://www.w3.org) * section 6 of RFC 2616 (see http://www.w3.org)
* *
* All HTTP/1.1 reponses consist of an initial status line containing * All HTTP/1.1 reponses consist of an initial status line containing
* the HTTP version, a 3-digit status code, and a human-readable reason * the HTTP version, a 3-digit status code, and a human-readable reason
* phrase explaining the status code. * phrase explaining the status code.
* *
* The first digit of the Status-Code defines the class of * The first digit of the Status-Code defines the class of
* response. The last two digits do not have any categorization * response. The last two digits do not have any categorization
* role. There are 5 values for the first digit: * role. There are 5 values for the first digit:
* <ul> * <ul>
* <li>1xx: Informational - Request received, continuing process</li> * <li>1xx: Informational - Request received, continuing process</li>
* <li>2xx: Success - The action was successfully received, * <li>2xx: Success - The action was successfully received,
understood, and accepted</li> understood, and accepted</li>
* <li>3xx: Redirection - Further action must be taken in order to * <li>3xx: Redirection - Further action must be taken in order to
* complete the request</li> * complete the request</li>
* <li>4xx: Client Error - The request contains bad syntax or cannot * <li>4xx: Client Error - The request contains bad syntax or cannot
* be fulfilled</li> * be fulfilled</li>
* <li>5xx: Server Error - The server failed to fulfill an apparently * <li>5xx: Server Error - The server failed to fulfill an apparently
* valid request</li></ul> * valid request</li></ul>
*/ */
class CGICC_API HTTPResponseHeader : public MStreamable class CGICC_API HTTPResponseHeader : public MStreamable
{ {
public: public:
/*! \name Constructor and Destructor */ /*! \name Constructor and Destructor */
//@{ //@{
/*! /*!
* \brief Create a new HTTP response header * \brief Create a new HTTP response header
* \param http_version The HTTP version string, usually \c HTTP/1.1 * \param http_version The HTTP version string, usually \c HTTP/1.1
* \param status_code The 3-digit HTTP status code * \param status_code The 3-digit HTTP status code
* \param reason_phrase A short textual description of the status code * \param reason_phrase A short textual description of the status code
*/ */
HTTPResponseHeader(const STDNS string& http_version, HTTPResponseHeader(const std::string& http_version,
int status_code, int status_code,
const STDNS string& reason_phrase); const std::string& reason_phrase);
/*! /*!
* \brief Delete this HTTPResponseHeader * \brief Delete this HTTPResponseHeader
* *
*/ */
virtual ~HTTPResponseHeader(); virtual ~HTTPResponseHeader();
//@} //@}
// ============================================================ // ============================================================
/*! \name Additional Header Management */ /*! \name Additional Header Management */
//@{ //@{
/*! /*!
* \brief Add a general, response, or entity header to this one * \brief Add a general, response, or entity header to this one
* *
* \param header The text of the header to add * \param header The text of the header to add
* \return A reference to this * \return A reference to this
*/ */
HTTPResponseHeader& HTTPResponseHeader&
addHeader(const STDNS string& header); addHeader(const std::string& header);
/*! /*!
* \brief Add a general, response, or entity header to this one * \brief Add a general, response, or entity header to this one
* *
* \param header The text of the header to add * \param name The name of the header element to add
* \return A reference to this * \param value The value of the header element
*/ * \return A reference to this
HTTPResponseHeader& */
addHeader(const STDNS string& name, HTTPResponseHeader&
const STDNS string& value); addHeader(const std::string& name,
const std::string& value);
/*! /*!
* \brief Get a list of all additional headers * \brief Get a list of all additional headers
* *
* \return A list of all additional headers * \return A list of all additional headers
*/ */
inline const STDNS vector<STDNS string>& inline const std::vector<std::string>&
getHeaders() const getHeaders() const
{ return fHeaders; } { return fHeaders; }
//@} //@}
/*! \name Cookie Management */ /*! \name Cookie Management */
//@{ //@{
/*! /*!
* \brief Set a cookie to go out with this HTTPResponseHeader * \brief Set a cookie to go out with this HTTPResponseHeader
* \param cookie The HTTPCookie to set * \param cookie The HTTPCookie to set
*/ */
HTTPResponseHeader& HTTPResponseHeader&
setCookie(const HTTPCookie& cookie); setCookie(const HTTPCookie& cookie);
/*! /*!
* \brief Get a list of all cookies associated with this header * \brief Get a list of all cookies associated with this header
* \return All the cookies associated with this header * \return All the cookies associated with this header
*/ */
inline const STDNS vector<HTTPCookie>& inline const std::vector<HTTPCookie>&
getCookies() const getCookies() const
{ return fCookies; } { return fCookies; }
//@} //@}
// ============================================================ // ============================================================
/*! \name Accessor methods /*! \name Accessor methods
* Retrieve information on the header * Retrieve information on the header
*/ */
//@{ //@{
/*! /*!
* \brief Get the HTTP version * \brief Get the HTTP version
* *
* The HTTP version is a string of the form \c HTTP/1.1 * The HTTP version is a string of the form \c HTTP/1.1
* \return The HTTP version * \return The HTTP version
*/ */
inline const STDNS string& inline const std::string&
getHTTPVersion() const getHTTPVersion() const
{ return fHTTPVersion; } { return fHTTPVersion; }
/*! /*!
* \brief Get the 3-digit status code * \brief Get the 3-digit status code
* *
* The 3-digit status code indicates the disposition of the response. * The 3-digit status code indicates the disposition of the response.
* \return The 3-digit status code * \return The 3-digit status code
*/ */
inline int inline int
getStatusCode() const getStatusCode() const
{ return fStatusCode; } { return fStatusCode; }
/*! /*!
* \brief Get the reason phrase associated with the stats code * \brief Get the reason phrase associated with the stats code
* *
* The reason phrase is a human-readable interpretation of the status cod * The reason phrase is a human-readable interpretation of the status c
e ode
* \return The reason phrase * \return The reason phrase
*/ */
inline STDNS string inline std::string
getReasonPhrase() const getReasonPhrase() const
{ return fReasonPhrase; } { return fReasonPhrase; }
//@} //@}
// ============================================================ // ============================================================
/*! \name Mutator methods /*! \name Mutator methods
* Set information on the header * Set information on the header
*/ */
//@{ //@{
/*! /*!
* \brief Set the HTTP version * \brief Set the HTTP version
* *
* The HTTP version is a string of the form \c HTTP/1.1 * The HTTP version is a string of the form \c HTTP/1.1
* \param http_version The HTTP version string, usually \c HTTP/1.1 * \param http_version The HTTP version string, usually \c HTTP/1.1
* \return A reference to this * \return A reference to this
*/ */
inline HTTPResponseHeader& inline HTTPResponseHeader&
getHTTPVersion(const STDNS string& http_version) getHTTPVersion(const std::string& http_version)
{ fHTTPVersion = http_version; return *this; } { fHTTPVersion = http_version; return *this; }
/*! /*!
* \brief Get the 3-digit status code * \brief Get the 3-digit status code
* *
* The 3-digit status code indicates the disposition of the response. * The 3-digit status code indicates the disposition of the response.
* \param status_code The 3-digit HTTP status code * \param status_code The 3-digit HTTP status code
* \return A reference to this * \return A reference to this
*/ */
inline HTTPResponseHeader& inline HTTPResponseHeader&
getStatusCode(int status_code) getStatusCode(int status_code)
{ fStatusCode = status_code; return *this; } { fStatusCode = status_code; return *this; }
/*! /*!
* \brief Get the reason phrase associated with the stats code * \brief Get the reason phrase associated with the stats code
* *
* The reason phrase is a human-readable interpretation of the status cod * The reason phrase is a human-readable interpretation of the status c
e ode
* \param reason_phrase A short textual description of the status code * \param reason_phrase A short textual description of the status code
* \return A reference to this * \return A reference to this
*/ */
inline HTTPResponseHeader& inline HTTPResponseHeader&
getReasonPhrase(const STDNS string& reason_phrase) getReasonPhrase(const std::string& reason_phrase)
{ fReasonPhrase = reason_phrase; return *this; } { fReasonPhrase = reason_phrase; return *this; }
//@} //@}
// ============================================================ // ============================================================
/*! \name Inherited Methods */ /*! \name Inherited Methods */
//@{ //@{
virtual void virtual void
render(STDNS ostream& out) const; render(std::ostream& out) const;
//@} //@}
private: private:
HTTPResponseHeader(); HTTPResponseHeader();
STDNS string fHTTPVersion; std::string fHTTPVersion;
int fStatusCode; int fStatusCode;
STDNS string fReasonPhrase; std::string fReasonPhrase;
STDNS vector<STDNS string> fHeaders; std::vector<std::string> fHeaders;
STDNS vector<HTTPCookie> fCookies; std::vector<HTTPCookie> fCookies;
}; };
CGICC_END_NAMESPACE } // namespace cgicc
#endif /* ! _HTTPRESPONSEHEADER_H_ */ #endif /* ! _HTTPRESPONSEHEADER_H_ */
 End of changes. 30 change blocks. 
182 lines changed or deleted 183 lines changed or added


 HTTPStatusHeader.h   HTTPStatusHeader.h 
/* -*-c++-*- */ /* -*-c++-*- */
/* /*
* $Id: HTTPStatusHeader.h,v 1.2 2002/03/06 02:49:55 sbooth Exp $ * $Id: HTTPStatusHeader.h,v 1.4 2003/07/13 14:20:35 sbooth Exp $
* *
* Copyright (C) 1996 - 2002 Stephen F. Booth * Copyright (C) 1996 - 2003 Stephen F. Booth
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either * License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version. * version 2.1 of the License, or (at your option) any later version.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details. * Lesser General Public License for more details.
skipping to change at line 38 skipping to change at line 38
/*! \file HTTPStatusHeader.h /*! \file HTTPStatusHeader.h
* \brief HTTP header to set a specific request status * \brief HTTP header to set a specific request status
* *
*/ */
#include <string> #include <string>
#include "cgicc/HTTPHeader.h" #include "cgicc/HTTPHeader.h"
CGICC_BEGIN_NAMESPACE namespace cgicc {
// ============================================================
// Class HTTPStatusHeader
// ============================================================
/*! \class HTTPStatusHeader HTTPStatusHeader.h cgicc/HTTPStatusHeader.h // ============================================================
* \brief HTTP header to set a specific request status // Class HTTPStatusHeader
* // ============================================================
*/
class CGICC_API HTTPStatusHeader : public HTTPHeader
{
public: