00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
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 
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   
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