Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
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
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
00153 inline bool
00154 operator< (const HTTPCookie& cookie) const
00155 { return false; }
00156 #endif
00157
00158
00159
00160
00163
00168 inline void
00169 remove()
00170 { fRemoved = true; }
00171
00177 inline void
00178 setRemoved(bool removed)
00179 { fRemoved = removed; }
00185 inline bool
00186 isRemoved() const
00187 { return fRemoved; }
00200 HTTPCookie(const std::string& name,
00201 const std::string& domain,
00202 const std::string& path,
00203 bool secure);
00204
00210 inline std::string
00211 getName() const
00212 { return fName; }
00213
00219 inline std::string
00220 getValue() const
00221 { return fValue; }
00222
00228 inline std::string
00229 getComment() const
00230 { return fComment; }
00231
00239 inline std::string
00240 getDomain() const
00241 { return fDomain; }
00242
00248 inline unsigned long
00249 getMaxAge() const
00250 { return fMaxAge; }
00251
00259 inline std::string
00260 getPath() const
00261 { return fPath; }
00262
00268 inline bool
00269 isSecure() const
00270 { return fSecure; }
00272
00273
00274
00277
00283 inline void
00284 setName(const std::string& name)
00285 { fName = name; }
00286
00292 inline void
00293 setValue(const std::string& value)
00294 { fValue = value; }
00295
00301 inline void
00302 setComment(const std::string& comment)
00303 { fComment = comment; }
00304
00313 inline void
00314 setDomain(const std::string& domain)
00315 { fDomain = domain; }
00316
00323 inline void
00324 setMaxAge(unsigned long maxAge)
00325 { fMaxAge = maxAge; }
00326
00334 inline void
00335 setPath(const std::string& path)
00336 { fPath = path; }
00337
00343 inline void
00344 setSecure(bool secure)
00345 { fSecure = secure; }
00347
00348
00349
00352 virtual void
00353 render(std::ostream& out) const;
00355
00356 private:
00357 std::string fName;
00358 std::string fValue;
00359 std::string fComment;
00360 std::string fDomain;
00361 unsigned long fMaxAge;
00362 std::string fPath;
00363 bool fSecure;
00364 bool fRemoved;
00365 };
00366
00367 }
00368
00369 #endif