00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00043 #ifndef Cookie_h_
00044 #define Cookie_h_ 1
00045
00046 #include <string>
00047 #include <time.h>
00048 #include <boost/date_time/posix_time/posix_time_types.hpp>
00049
00050 namespace ClearSilver
00051 {
00052
00062 class Cookie
00063 {
00064
00065 public:
00066
00101 class Authority
00102 {
00103 public:
00105
00107 Authority ();
00109 explicit Authority (const char*);
00111 explicit Authority (const std::string&);
00113 Authority (const Authority&);
00115 ~Authority () throw();
00116
00118 Authority& operator = (const Authority&);
00119
00121 void swap (Authority&) throw();
00122
00123
00125
00127 bool empty () const;
00128
00129
00131 std::string operator () () const;
00132
00133 private:
00134 std::string authority_;
00135 };
00136
00137 public:
00138
00162 class Path
00163 {
00164 private:
00165 std::string path_;
00166
00167 public:
00169
00171 Path ();
00173 explicit Path (const char*);
00175 explicit Path (const std::string&);
00177 Path (const Path&);
00179 ~Path () throw();
00180
00182 Path& operator = (const Path&);
00183
00185 void swap (Path&) throw();
00186
00187
00189
00191 bool empty () const;
00192
00193
00195 std::string operator () () const;
00196 };
00197
00198 public:
00199
00230 class Expires
00231 {
00232 private:
00233 std::string expires_;
00234
00235 public:
00237
00239 Expires ();
00251 explicit Expires (const char*);
00263 explicit Expires (const std::string&);
00265 explicit Expires (time_t);
00267 explicit Expires (struct tm);
00282 explicit Expires (const boost::posix_time::ptime&);
00284 Expires (const Expires&);
00286 ~Expires () throw();
00287
00289 Expires& operator = (const Expires&);
00290
00292 void swap (Expires&) throw();
00293
00294
00296
00298 operator bool () const;
00300 bool empty () const;
00301
00302
00304 std::string operator () () const;
00305 };
00306
00307 public:
00308
00339 class Credentials
00340 {
00341 private:
00342 Authority authority_;
00343 Path path_;
00344 Expires expires_;
00345 bool persist_;
00346 bool secure_;
00347
00348 public:
00350
00352 Credentials ();
00354 explicit Credentials (const Authority&);
00356 explicit Credentials (const Path&);
00358 explicit Credentials (const Expires&);
00360 explicit Credentials (const Authority&, const Path&);
00362 explicit Credentials (const Authority&, const Path&, const Expires&);
00364 Credentials (const Credentials&);
00366 ~Credentials () throw();
00367
00369 Credentials& operator = (const Credentials&);
00370
00372 void swap (Credentials&) throw();
00373
00374
00376
00378 Authority authority () const;
00380 Authority& authority ();
00382 Path path () const;
00384 Path& path ();
00386 Expires expires () const;
00388 Expires& expires ();
00390 bool persist () const;
00392 bool secure () const;
00394 bool& secure ();
00395
00396 };
00397
00398 private:
00399 std::string name_;
00400 std::string value_;
00401 Credentials credentials_;
00402
00403 public:
00405
00406
00407 Cookie ();
00409 explicit Cookie (const char* name);
00411 explicit Cookie (const char* name, const Credentials&);
00413 explicit Cookie (const char* name, const char* value);
00415 explicit Cookie (const char* name, const char* value, const Credentials&);
00417 explicit Cookie (const std::string& name);
00419 explicit Cookie (const std::string& name, const Credentials&);
00421 explicit Cookie (const std::string& name, const std::string& value);
00423 explicit Cookie (const std::string& name, const std::string& value,
00424 const Credentials&);
00426 Cookie (const Cookie&);
00428 ~Cookie () throw();
00429
00431 Cookie& operator = (const Cookie&);
00432
00434 void swap (Cookie&) throw();
00435
00436
00438
00440 std::string name () const;
00442 std::string value () const;
00444 Credentials credentials () const;
00446 Credentials& credentials ();
00447
00448 };
00449
00450 };
00451
00452 #endif