HTTPCookie.h

Go to the documentation of this file.
00001 /* -*-mode:c++; c-file-style: "gnu";-*- */
00002 /*
00003  *  $Id: HTTPCookie_8h-source.html,v 1.3 2008/01/19 21:53:41 sebdiaz Exp $
00004  *
00005  *  Copyright (C) 1996 - 2004 Stephen F. Booth <sbooth@gnu.org>
00006  *                       2007 Sebastien DIAZ <sebastien.diaz@gmail.com>
00007  *  Part of the GNU cgicc library, http://www.gnu.org/software/cgicc
00008  *
00009  *  This library is free software; you can redistribute it and/or
00010  *  modify it under the terms of the GNU Lesser General Public
00011  *  License as published by the Free Software Foundation; either
00012  *  version 3 of the License, or (at your option) any later version.
00013  *
00014  *  This library is distributed in the hope that it will be useful,
00015  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00017  *  Lesser General Public License for more details.
00018  *
00019  *  You should have received a copy of the GNU Lesser General Public
00020  *  License along with this library; if not, write to the Free Software
00021  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA 
00022  */
00023 
00024 #ifndef _HTTPCOOKIE_H_
00025 #define _HTTPCOOKIE_H_ 1
00026 
00027 #ifdef __GNUG__
00028 #  pragma interface
00029 #endif
00030 
00035 #include <string>
00036 
00037 #include "cgicc/MStreamable.h"
00038 #include "cgicc/CgiDefs.h"
00039 
00040 namespace cgicc {
00041   
00042   // ============================================================
00043   // Class HTTPCookie
00044   // ============================================================
00058   class CGICC_API HTTPCookie : public MStreamable 
00059   {
00060   public:
00061     
00064     
00070     HTTPCookie();
00071     
00079     HTTPCookie(const std::string& name, 
00080                const std::string& value);
00081     
00098     HTTPCookie(const std::string& name, 
00099                const std::string& value, 
00100                const std::string& comment, 
00101                const std::string& domain, 
00102                unsigned long maxAge, 
00103                const std::string& path,
00104                bool secure);
00105     
00113     HTTPCookie(const HTTPCookie& cookie);
00114     
00120     virtual ~HTTPCookie();
00122     
00123     // ============================================================
00124     
00127     
00136     bool 
00137     operator== (const HTTPCookie& cookie)       const;
00138     
00147     inline bool 
00148     operator != (const HTTPCookie& cookie)      const
00149     { return ! operator==(cookie); }
00150     
00151 #ifdef WIN32
00152     /* Dummy operator for MSVC++ */
00153     inline bool 
00154     operator< (const HTTPCookie& cookie)        const
00155     { return false; }
00156 #endif
00157 
00158     
00159     // ============================================================
00160     
00163     
00169     inline std::string 
00170     getName()                                   const
00171     { return fName; }
00172     
00178     inline std::string 
00179     getValue()                                  const
00180     { return fValue; }
00181     
00187     inline std::string 
00188     getComment()                                const
00189     { return fComment; }
00190     
00198     inline std::string 
00199     getDomain()                                 const
00200     { return fDomain; }
00201     
00207     inline unsigned long
00208     getMaxAge()                                 const
00209     { return fMaxAge; }
00210     
00218     inline std::string 
00219     getPath()                                   const
00220     { return fPath; }
00221     
00227     inline bool 
00228     isSecure()                                  const
00229     { return fSecure; }
00231     
00232     // ============================================================
00233     
00236     
00242     inline void 
00243     setName(const std::string& name)
00244     { fName = name; }
00245     
00251     inline void 
00252     setValue(const std::string& value)
00253     { fValue = value; }
00254     
00260     inline void 
00261     setComment(const std::string& comment)
00262     { fComment = comment; }
00263     
00272     inline void 
00273     setDomain(const std::string& domain)
00274     { fDomain = domain; }
00275     
00282     inline void 
00283     setMaxAge(unsigned long maxAge)
00284     { fMaxAge = maxAge; }
00285     
00293     inline void 
00294     setPath(const std::string& path)
00295     { fPath = path; }
00296     
00302     inline void 
00303     setSecure(bool secure)
00304     { fSecure = secure; }
00306     
00307     // ============================================================
00308     
00311     virtual void 
00312     render(std::ostream& out)                   const;
00314     
00315   private:
00316     std::string         fName;
00317     std::string         fValue;
00318     std::string         fComment;
00319     std::string         fDomain;
00320     unsigned long       fMaxAge;
00321     std::string         fPath;
00322     bool                fSecure;
00323   };
00324   
00325 } // namespace cgicc
00326 
00327 #endif /* ! _HTTPCOOKIE_H_ */

GNU cgicc - A C++ class library for writing CGI applications
Copyright © 1996 - 2004 Stephen F. Booth
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front Cover Texts, and with no Back-Cover Texts.
Documentation generated Sat Jan 19 21:15:58 2008 for cgicc by doxygen 1.5.1