author | Michael Krelin <hacker@klever.net> | 2007-03-17 00:15:49 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2007-03-17 00:15:49 (UTC) |
commit | 29f2fd81e0f4e62c54371b90469d64ec5e47bd8a (patch) (unidiff) | |
tree | 6c94ade0bd8a3ca92afead27939b586713e5e789 | |
parent | 88e7e2ac30d181e30a7c4fa36d0029990136efb6 (diff) | |
download | sitecing-master.zip sitecing-master.tar.gz sitecing-master.tar.bz2 |
-rw-r--r-- | include/sitecing/exception.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/include/sitecing/exception.h b/include/sitecing/exception.h index 857a8e6..ccc7edd 100644 --- a/include/sitecing/exception.h +++ b/include/sitecing/exception.h | |||
@@ -1,204 +1,207 @@ | |||
1 | #ifndef __SITECING_EXCEPTION_H | 1 | #ifndef __SITECING_EXCEPTION_H |
2 | #define __SITECING_EXCEPTION_H | 2 | #define __SITECING_EXCEPTION_H |
3 | 3 | ||
4 | #include <string> | ||
5 | |||
4 | /** | 6 | /** |
5 | * @file | 7 | * @file |
6 | * @brief The site-C-ing specific exceptions. | 8 | * @brief The site-C-ing specific exceptions. |
7 | */ | 9 | */ |
8 | 10 | ||
9 | /** | 11 | /** |
10 | * @brief The main site-C-ing namespace. | 12 | * @brief The main site-C-ing namespace. |
11 | */ | 13 | */ |
12 | namespace sitecing { | 14 | namespace sitecing { |
15 | using std::string; | ||
13 | 16 | ||
14 | // TODO: status specifics | 17 | // TODO: status specifics |
15 | 18 | ||
16 | /** | 19 | /** |
17 | * The http status to return. | 20 | * The http status to return. |
18 | */ | 21 | */ |
19 | class http_status { | 22 | class http_status { |
20 | public: | 23 | public: |
21 | /** | 24 | /** |
22 | * The status string. | 25 | * The status string. |
23 | */ | 26 | */ |
24 | string status; | 27 | string status; |
25 | /** | 28 | /** |
26 | * The message to follow the status string. | 29 | * The message to follow the status string. |
27 | */ | 30 | */ |
28 | string message; | 31 | string message; |
29 | 32 | ||
30 | /** | 33 | /** |
31 | * @param s HTTP status. | 34 | * @param s HTTP status. |
32 | * @param m HTTP status message. | 35 | * @param m HTTP status message. |
33 | */ | 36 | */ |
34 | http_status(const string& s,const string& m) | 37 | http_status(const string& s,const string& m) |
35 | : status(s), message(m) { } | 38 | : status(s), message(m) { } |
36 | virtual ~http_status() throw() { } | 39 | virtual ~http_status() throw() { } |
37 | }; | 40 | }; |
38 | 41 | ||
39 | // per RFC 2616 | 42 | // per RFC 2616 |
40 | 43 | ||
41 | /** | 44 | /** |
42 | * Informational. | 45 | * Informational. |
43 | */ | 46 | */ |
44 | class http_status_1xx : public http_status { | 47 | class http_status_1xx : public http_status { |
45 | public: | 48 | public: |
46 | /** | 49 | /** |
47 | * @param s HTTP status | 50 | * @param s HTTP status |
48 | * @param m HTTP status message | 51 | * @param m HTTP status message |
49 | */ | 52 | */ |
50 | explicit http_status_1xx(const string &s,const string& m) | 53 | explicit http_status_1xx(const string &s,const string& m) |
51 | : http_status(s,m) { } | 54 | : http_status(s,m) { } |
52 | }; | 55 | }; |
53 | /** | 56 | /** |
54 | * Continue. | 57 | * Continue. |
55 | */ | 58 | */ |
56 | class http_status_100 : public http_status_1xx { | 59 | class http_status_100 : public http_status_1xx { |
57 | public: | 60 | public: |
58 | /** | 61 | /** |
59 | * @param m HTTP status message | 62 | * @param m HTTP status message |
60 | */ | 63 | */ |
61 | explicit http_status_100(const string& m) | 64 | explicit http_status_100(const string& m) |
62 | : http_status_1xx("100",m) { } | 65 | : http_status_1xx("100",m) { } |
63 | explicit http_status_100() | 66 | explicit http_status_100() |
64 | : http_status_1xx("100","Continue") { } | 67 | : http_status_1xx("100","Continue") { } |
65 | }; | 68 | }; |
66 | /** | 69 | /** |
67 | * Switching protocols. | 70 | * Switching protocols. |
68 | */ | 71 | */ |
69 | class http_status_101 : public http_status_1xx { | 72 | class http_status_101 : public http_status_1xx { |
70 | public: | 73 | public: |
71 | /** | 74 | /** |
72 | * @param m HTTP status message | 75 | * @param m HTTP status message |
73 | */ | 76 | */ |
74 | explicit http_status_101(const string& m) | 77 | explicit http_status_101(const string& m) |
75 | : http_status_1xx("101",m) { } | 78 | : http_status_1xx("101",m) { } |
76 | explicit http_status_101() | 79 | explicit http_status_101() |
77 | : http_status_1xx("101","Switching protocols") { } | 80 | : http_status_1xx("101","Switching protocols") { } |
78 | }; | 81 | }; |
79 | 82 | ||
80 | /** | 83 | /** |
81 | * Successful. | 84 | * Successful. |
82 | */ | 85 | */ |
83 | class http_status_2xx : public http_status { | 86 | class http_status_2xx : public http_status { |
84 | public: | 87 | public: |
85 | /** | 88 | /** |
86 | * @param s HTTP status message | 89 | * @param s HTTP status message |
87 | * @param m HTTP status message | 90 | * @param m HTTP status message |
88 | */ | 91 | */ |
89 | explicit http_status_2xx(const string& s,const string& m) | 92 | explicit http_status_2xx(const string& s,const string& m) |
90 | : http_status(s,m) { } | 93 | : http_status(s,m) { } |
91 | }; | 94 | }; |
92 | /** | 95 | /** |
93 | * OK. | 96 | * OK. |
94 | */ | 97 | */ |
95 | class http_status_200 : public http_status_2xx { | 98 | class http_status_200 : public http_status_2xx { |
96 | public: | 99 | public: |
97 | /** | 100 | /** |
98 | * @param m HTTP status message | 101 | * @param m HTTP status message |
99 | */ | 102 | */ |
100 | explicit http_status_200(const string& m) | 103 | explicit http_status_200(const string& m) |
101 | : http_status_2xx("200",m) { } | 104 | : http_status_2xx("200",m) { } |
102 | explicit http_status_200() | 105 | explicit http_status_200() |
103 | : http_status_2xx("200","OK") { } | 106 | : http_status_2xx("200","OK") { } |
104 | }; | 107 | }; |
105 | /** | 108 | /** |
106 | * Created. | 109 | * Created. |
107 | */ | 110 | */ |
108 | class http_status_201 : public http_status_2xx { | 111 | class http_status_201 : public http_status_2xx { |
109 | public: | 112 | public: |
110 | /** | 113 | /** |
111 | * @param m HTTP status message | 114 | * @param m HTTP status message |
112 | */ | 115 | */ |
113 | explicit http_status_201(const string& m) | 116 | explicit http_status_201(const string& m) |
114 | : http_status_2xx("201",m) { } | 117 | : http_status_2xx("201",m) { } |
115 | explicit http_status_201() | 118 | explicit http_status_201() |
116 | : http_status_2xx("201","Created") { } | 119 | : http_status_2xx("201","Created") { } |
117 | }; | 120 | }; |
118 | /** | 121 | /** |
119 | * Accepted. | 122 | * Accepted. |
120 | */ | 123 | */ |
121 | class http_status_202 : public http_status_2xx { | 124 | class http_status_202 : public http_status_2xx { |
122 | public: | 125 | public: |
123 | /** | 126 | /** |
124 | * @param m HTTP status message | 127 | * @param m HTTP status message |
125 | */ | 128 | */ |
126 | explicit http_status_202(const string& m) | 129 | explicit http_status_202(const string& m) |
127 | : http_status_2xx("202",m) { } | 130 | : http_status_2xx("202",m) { } |
128 | explicit http_status_202() | 131 | explicit http_status_202() |
129 | : http_status_2xx("202","Accepted") { } | 132 | : http_status_2xx("202","Accepted") { } |
130 | }; | 133 | }; |
131 | /** | 134 | /** |
132 | * Non-authoritative infortmation. | 135 | * Non-authoritative infortmation. |
133 | */ | 136 | */ |
134 | class http_status_203 : public http_status_2xx { | 137 | class http_status_203 : public http_status_2xx { |
135 | public: | 138 | public: |
136 | /** | 139 | /** |
137 | * @param m HTTP status message | 140 | * @param m HTTP status message |
138 | */ | 141 | */ |
139 | explicit http_status_203(const string& m) | 142 | explicit http_status_203(const string& m) |
140 | : http_status_2xx("203",m) { } | 143 | : http_status_2xx("203",m) { } |
141 | explicit http_status_203() | 144 | explicit http_status_203() |
142 | : http_status_2xx("203","Non-authoritative information") { } | 145 | : http_status_2xx("203","Non-authoritative information") { } |
143 | }; | 146 | }; |
144 | /** | 147 | /** |
145 | * No content. | 148 | * No content. |
146 | */ | 149 | */ |
147 | class http_status_204 : public http_status_2xx { | 150 | class http_status_204 : public http_status_2xx { |
148 | public: | 151 | public: |
149 | /** | 152 | /** |
150 | * @param m HTTP status message | 153 | * @param m HTTP status message |
151 | */ | 154 | */ |
152 | explicit http_status_204(const string& m) | 155 | explicit http_status_204(const string& m) |
153 | : http_status_2xx("204",m) { } | 156 | : http_status_2xx("204",m) { } |
154 | explicit http_status_204() | 157 | explicit http_status_204() |
155 | : http_status_2xx("204","No content") { } | 158 | : http_status_2xx("204","No content") { } |
156 | }; | 159 | }; |
157 | /** | 160 | /** |
158 | * Reset content. | 161 | * Reset content. |
159 | */ | 162 | */ |
160 | class http_status_205 : public http_status_2xx { | 163 | class http_status_205 : public http_status_2xx { |
161 | public: | 164 | public: |
162 | /** | 165 | /** |
163 | * @param m HTTP status message | 166 | * @param m HTTP status message |
164 | */ | 167 | */ |
165 | explicit http_status_205(const string& m) | 168 | explicit http_status_205(const string& m) |
166 | : http_status_2xx("205",m) { } | 169 | : http_status_2xx("205",m) { } |
167 | explicit http_status_205() | 170 | explicit http_status_205() |
168 | : http_status_2xx("205","Reset content") { } | 171 | : http_status_2xx("205","Reset content") { } |
169 | }; | 172 | }; |
170 | /** | 173 | /** |
171 | * Partial content. | 174 | * Partial content. |
172 | */ | 175 | */ |
173 | class http_status_206 : public http_status_2xx { | 176 | class http_status_206 : public http_status_2xx { |
174 | public: | 177 | public: |
175 | /** | 178 | /** |
176 | * @param m HTTP status message | 179 | * @param m HTTP status message |
177 | */ | 180 | */ |
178 | explicit http_status_206(const string& m) | 181 | explicit http_status_206(const string& m) |
179 | : http_status_2xx("206",m) { } | 182 | : http_status_2xx("206",m) { } |
180 | explicit http_status_206() | 183 | explicit http_status_206() |
181 | : http_status_2xx("206","Partial content") { } | 184 | : http_status_2xx("206","Partial content") { } |
182 | }; | 185 | }; |
183 | 186 | ||
184 | /** | 187 | /** |
185 | * Redirection. | 188 | * Redirection. |
186 | */ | 189 | */ |
187 | class http_status_3xx : public http_status { | 190 | class http_status_3xx : public http_status { |
188 | public: | 191 | public: |
189 | /** | 192 | /** |
190 | * @param s HTTP status | 193 | * @param s HTTP status |
191 | * @param m HTTP status message | 194 | * @param m HTTP status message |
192 | */ | 195 | */ |
193 | explicit http_status_3xx(const string& s,const string& m) | 196 | explicit http_status_3xx(const string& s,const string& m) |
194 | : http_status(s,m) { } | 197 | : http_status(s,m) { } |
195 | }; | 198 | }; |
196 | /** | 199 | /** |
197 | * Multiple choices. | 200 | * Multiple choices. |
198 | */ | 201 | */ |
199 | class http_status_300 : public http_status_3xx { | 202 | class http_status_300 : public http_status_3xx { |
200 | public: | 203 | public: |
201 | /** | 204 | /** |
202 | * @param m HTTP status message | 205 | * @param m HTTP status message |
203 | */ | 206 | */ |
204 | explicit http_status_300(const string& m) | 207 | explicit http_status_300(const string& m) |