HTTPCookie.h Source File

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

# HTTPCookie.h

Go to the documentation of this file.

    00001 /* -*-c++-*- */
    00002 /*
    00003  *  $Id: HTTPCookie.h,v 1.3 2002/03/09 18:34:18 sbooth Exp $
    00004  *
    00005  *  Copyright (C) 1996 - 2002 Stephen F. Booth
    00006  *
    00007  *  This library is free software; you can redistribute it and/or
    00008  *  modify it under the terms of the GNU Lesser General Public
    00009  *  License as published by the Free Software Foundation; either
    00010  *  version 2.1 of the License, or (at your option) any later version.
    00011  *
    00012  *  This library is distributed in the hope that it will be useful,
    00013  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
    00014  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00015  *  Lesser General Public License for more details.
    00016  *
    00017  *  You should have received a copy of the GNU Lesser General Public
    00018  *  License along with this library; if not, write to the Free Software
    00019  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    00020  */
    00021
    00022 #ifndef _HTTPCOOKIE_H_
    00023 #define _HTTPCOOKIE_H_ 1
    00024
    00025 #ifdef __GNUG__
    00026 #  pragma interface
    00027 #endif
    00028
    00033 #include <string>
    00034
    00035 #include "cgicc/MStreamable.h"
    00036 #include "cgicc/CgiDefs.h"
    00037
    00038 CGICC_BEGIN_NAMESPACE
    00039
    00040 // ============================================================
    00041 // Class HTTPCookie
    00042 // ============================================================
    00056 class CGICC_API HTTPCookie : public MStreamable
    00057 {
    00058 public:
    00059
    00062
    00068   HTTPCookie();
    00069
    00077   HTTPCookie(const STDNS string& name,
    00078              const STDNS string& value);
    00079
    00096   HTTPCookie(const STDNS string& name,
    00097              const STDNS string& value,
    00098              const STDNS string& comment,
    00099              const STDNS string& domain,
    00100              unsigned long maxAge,
    00101              const STDNS string& path,
    00102              bool secure);
    00103
    00111   HTTPCookie(const HTTPCookie& cookie);
    00112
    00118   virtual ~HTTPCookie();
    00120
    00121   // ============================================================
    00122
    00125
    00134   bool
    00135   operator== (const HTTPCookie& cookie)         const;
    00136
    00145   inline bool
    00146   operator != (const HTTPCookie& cookie)        const
    00147   { return ! operator==(cookie); }
    00148
    00149 #ifdef WIN32
    00150   /* Dummy operator for MSVC++ */
    00151   inline bool
    00152   operator< (const HTTPCookie& cookie)          const
    00153   { return false; }
    00154 #endif
    00155
    00156
    00157   // ============================================================
    00158
    00161
    00167   inline STDNS string
    00168   getName()                                     const
    00169     { return fName; }
    00170
    00176   inline STDNS string
    00177   getValue()                                    const
    00178     { return fValue; }
    00179
    00185   inline STDNS string
    00186   getComment()                                  const
    00187     { return fComment; }
    00188
    00196   inline STDNS string
    00197   getDomain()                                   const
    00198     { return fDomain; }
    00199
    00205   inline unsigned long
    00206   getMaxAge()                                   const
    00207     { return fMaxAge; }
    00208
    00216   inline STDNS string
    00217   getPath()                                     const
    00218     { return fPath; }
    00219
    00225   inline bool
    00226   isSecure()                                    const
    00227     { return fSecure; }
    00229
    00230   // ============================================================
    00231
    00234
    00240   inline void
    00241   setName(const STDNS string& name)
    00242     { fName = name; }
    00243
    00249   inline void
    00250   setValue(const STDNS string& value)
    00251     { fValue = value; }
    00252
    00258   inline void
    00259   setComment(const STDNS string& comment)
    00260     { fComment = comment; }
    00261
    00270   inline void
    00271   setDomain(const STDNS string& domain)
    00272     { fDomain = domain; }
    00273
    00280   inline void
    00281   setMaxAge(unsigned long maxAge)
    00282     { fMaxAge = maxAge; }
    00283
    00291   inline void
    00292   setPath(const STDNS string& path)
    00293     { fPath = path; }
    00294
    00300   inline void
    00301   setSecure(bool secure)
    00302     { fSecure = secure; }
    00304
    00305   // ============================================================
    00306
    00309   virtual void
    00310   render(STDNS ostream& out)                    const;
    00312
    00313 private:
    00314   STDNS string          fName;
    00315   STDNS string          fValue;
    00316   STDNS string          fComment;
    00317   STDNS string          fDomain;
    00318   unsigned long         fMaxAge;
    00319   STDNS string          fPath;
    00320   bool                  fSecure;
    00321 };
    00322
    00323 CGICC_END_NAMESPACE
    00324
    00325 #endif /* ! _HTTPCOOKIE_H_ */