DCL 3.7.4
Loading...
Searching...
No Matches
HttpHeader.h
Go to the documentation of this file.
1#ifndef __DCL_HTTP_HEADER_H__
2#define __DCL_HTTP_HEADER_H__ 20050509
3
4#ifndef __DCL_INCLUDED_TIME_H
5#include <dcl/_time.h>
6#endif
7
8#ifndef __DCL_STRING_H__
9 #include <dcl/String.h>
10#endif
11
12#if __DCL_HAVE_THIS_FILE__
13 #undef __THIS_FILE__
14 static const char_t* __pszHttpHeader_h__ = __T("dcl/HttpHeader.h");
15 #define __THIS_FILE__ __pszHttpHeader_h__
16#endif
17
18__DCL_BEGIN_NAMESPACE
19
21{
22protected:
23 String __name;
24 String __content;
25public:
26 HttpHeader();
27 HttpHeader(const HttpHeader& src);
28 HttpHeader(const wchar_t* _name, const wchar_t* _content = NULL);
29 const String& name() const;
30 const String& content() const;
31 String toString() const;
32};
33
35{
36public:
37 // http://www.faqs.org/rfcs/rfc2109.html
38#ifdef RFC2109
39 HttpSetCookie(const wchar_t* _name,
40 const wchar_t* _value = NULL,
41 const wchar_t* _comment = NULL,
42 const wchar_t* _domain = NULL,
43 int _maxAge = 0, // 초 단위
44 const wchar_t* _path = NULL,
45 bool _secure = false,
46 int nVersion = 0
47 );
48#endif // RFC2109
49 // php style
50 HttpSetCookie(const wchar_t* _name,
51 const wchar_t* _value = NULL,
52 time_t _expires = 0,
53 const wchar_t* _path = NULL,
54 const wchar_t* _domain = NULL,
55 bool _secure = false
56 );
57};
58
59// http://www.faqs.org/rfcs/rfc2965.html
61{
62
63};
64
66{
67public:
68 HttpExpires(time_t _expires);
69};
70
72{
73}
74
76{
77 __name = src.__name;
78 __content = src.__content;
79}
80
82 const wchar_t* _name,
83 const wchar_t* _content /* = NULL */
84 )
85{
86 __DCL_ASSERT(_name != NULL);
87 __DCL_ASSERT(*_name != L'\0');
88 __name = _name;
89 if (_content != NULL)
90 __content = _content;
91}
92
93inline const String& HttpHeader::name() const
94{
95 return __name;
96}
97
98inline const String& HttpHeader::content() const
99{
100 return __content;
101}
102
103inline bool operator == (const HttpHeader& x, const HttpHeader& y)
104{
105 return (x.name() == y.name()) && (x.content() == y.content());
106}
107
108__DCL_END_NAMESPACE
109
110#if __DCL_HAVE_THIS_FILE__
111 #undef __THIS_FILE__
112 #define __THIS_FILE__ __T(__FILE__)
113#endif
114
115#endif // __DCL_HTTP_HEADER_H__
#define NULL
Definition Config.h:312
#define DCLCAPI
Definition Config.h:95
wchar_t char_t
Definition Config.h:247
bool operator==(const HttpHeader &x, const HttpHeader &y)
Definition HttpHeader.h:103
#define __DCL_ASSERT(expr)
Definition Object.h:394
#define __T(str)
Definition Object.h:60
HttpExpires(time_t _expires)
String __content
Definition HttpHeader.h:24
const String & content() const
Definition HttpHeader.h:98
String toString() const
String __name
Definition HttpHeader.h:23
const String & name() const
Definition HttpHeader.h:93