DCL 4.0
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#ifdef __DCL_DEBUG
13static const char_t* __pszHttpHeader_h__ = __T("dcl/HttpHeader.h");
14#undef __THIS_FILE__
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
81inline HttpHeader::HttpHeader(const wchar_t* _name, const wchar_t* _content /* = NULL */)
82{
83 __DCL_ASSERT(_name != NULL);
84 __DCL_ASSERT(*_name != L'\0');
85
86 __name = _name;
87
88 if (_content != NULL)
89 __content = _content;
90}
91
92inline const String& HttpHeader::name() const
93{
94 return __name;
95}
96
97inline const String& HttpHeader::content() const
98{
99 return __content;
100}
101
102inline bool operator == (const HttpHeader& x, const HttpHeader& y)
103{
104 return (x.name() == y.name()) && (x.content() == y.content());
105}
106
107__DCL_END_NAMESPACE
108
109#ifdef __DCL_DEBUG
110#undef __THIS_FILE__
111#define __THIS_FILE__ __T(__FILE__)
112#endif
113
114#endif // __DCL_HTTP_HEADER_H__
#define NULL
Definition Config.h:340
#define DCLCAPI
Definition Config.h:100
wchar_t char_t
Definition Config.h:275
bool operator==(const HttpHeader &x, const HttpHeader &y)
Definition HttpHeader.h:102
#define __DCL_ASSERT(expr)
Definition Object.h:371
#define __T(str)
Definition Object.h:44
HttpExpires(time_t _expires)
String __content
Definition HttpHeader.h:24
const String & content() const
Definition HttpHeader.h:97
String toString() const
String __name
Definition HttpHeader.h:23
const String & name() const
Definition HttpHeader.h:92