fastdo  0.6.16
http_Cookie.hpp
浏览该文件的文档.
1 #ifndef __HTTP_COOKIE_HPP__
2 #define __HTTP_COOKIE_HPP__
3 
4 namespace http
5 {
6 
9 {
10  class HTTPWRAPPER_DLL ExpiresVal
11  {
12  public:
13  bool empty() const { return _vStr.empty(); }
14  operator winux::String & () { return _vStr; }
15  operator winux::String const & () const { return _vStr; }
16 
17  void operator = ( winux::int64 v );
18  winux::String & operator = ( winux::String const & v ) { return _vStr = v; }
19  private:
20  winux::String _vStr;
21  };
22 public:
23  Cookie() : secure(false), httpOnly(false), wantSet(false) { }
24  Cookie(
25  winux::String name,
26  winux::String value = "",
27  winux::int64 expires = -1,
28  winux::String domain = "",
29  winux::String path = "",
30  bool secure = false,
31  bool httpOnly = false
32  );
33 
34  operator winux::String const & () const { return this->value; }
35 
36  // 设置值时将wantSet标志设真
37  winux::String & operator = ( winux::String const & v );
38  // 获得一个用于Set-Cookie的字符串,不包含"Set-Cookie:"串
39  winux::String toSetString() const;
40 
43  ExpiresVal expires;
46  bool secure;
47  bool httpOnly;
48 
49  bool wantSet; // 该Cookie是否要设置
50 };
51 
52 inline std::ostream & operator << ( std::ostream & o, Cookie const & cookie )
53 {
54  o << (winux::String)cookie;
55  return o;
56 }
57 
58 } // namespace http
59 
60 
61 #endif // __HTTP_COOKIE_HPP__
__int64 int64
Definition: utilities.hpp:232
#define HTTPWRAPPER_DLL
Definition: http_base.hpp:24
XString< tchar > String
Definition: utilities.hpp:261
std::ostream & operator<<(std::ostream &o, Cookie const &cookie)
Definition: http_Cookie.hpp:52
HTTP协议的相关简单类封装
Definition: http_base.hpp:32