fastdo  0.6.16
http_Cookies.hpp
浏览该文件的文档.
1 #ifndef __HTTP_COOKIES_HPP__
2 #define __HTTP_COOKIES_HPP__
3 
4 namespace http
5 {
6 
9 {
10 public:
11  Cookies() { }
12 
16  void set(
17  winux::String name,
18  winux::String value = "",
19  winux::int64 expires = -1,
20  winux::String domain = "",
21  winux::String path = "",
22  bool secure = false,
23  bool httpOnly = false
24  );
25 
26  http::Cookie const & get( winux::String const & name ) const { return _cookies.at(name); }
27 
29  void clear() { _cookies.clear(); }
30 
32  void loadCookies( winux::AnsiString const & cookiesStr );
33 
35  void commitTo( http::Header * header );
36 
40  winux::Mixed dump() const;
41 
45  bool has( winux::String const & name ) const { return _cookies.find(name) != _cookies.end(); }
46 
52  http::Cookie & operator [] ( winux::String const & name );
53 
55  http::Cookie const & operator [] ( winux::String const & name ) const { return _cookies.at(name); }
56 
57 private:
58  std::map< winux::String, http::Cookie > _cookies;
59 };
60 
61 } // namespace http
62 
63 
64 #endif // __HTTP_COOKIES_HPP__
XString< char > AnsiString
Definition: utilities.hpp:257
__int64 int64
Definition: utilities.hpp:232
代表HTTP头部
Definition: http_Header.hpp:10
#define HTTPWRAPPER_DLL
Definition: http_base.hpp:24
XString< tchar > String
Definition: utilities.hpp:261
HTTP协议的相关简单类封装
Definition: http_base.hpp:32
bool has(winux::String const &name) const
检测是否有该cookie
混合体,能表示多种类型的值
Definition: utilities.hpp:1440
提供操作Cookies相关的功能
Definition: http_Cookies.hpp:8
void clear()
清空内部的映射表