summaryrefslogtreecommitdiffabout
path: root/include/sitecing/exception.h
authorMichael Krelin <hacker@klever.net>2005-01-29 21:21:05 (UTC)
committer Michael Krelin <hacker@klever.net>2005-01-29 21:21:05 (UTC)
commitce1f37aae46ea95020d7b865f7a80e8abdfad0d8 (patch) (unidiff)
tree4964383ab8cd7e6d8ea821f1a615d1bbcf98dad8 /include/sitecing/exception.h
parent3c75c860fc1ad5b3f5185e23ec6f438dd2528958 (diff)
downloadsitecing-0.0.zip
sitecing-0.0.tar.gz
sitecing-0.0.tar.bz2
initial commit into repository0.0
Diffstat (limited to 'include/sitecing/exception.h') (more/less context) (ignore whitespace changes)
-rw-r--r--include/sitecing/exception.h542
1 files changed, 542 insertions, 0 deletions
diff --git a/include/sitecing/exception.h b/include/sitecing/exception.h
new file mode 100644
index 0000000..985fc6d
--- a/dev/null
+++ b/include/sitecing/exception.h
@@ -0,0 +1,542 @@
1#ifndef __SITECING_EXCEPTION_H
2#define __SITECING_EXCEPTION_H
3
4/**
5 * @file
6 * @brief The site-C-ing specific exceptions.
7 */
8
9/**
10 * @brief The main site-C-ing namespace.
11 */
12namespace sitecing {
13
14 // TODO: status specifics
15
16 /**
17 * The http status to return.
18 */
19 class http_status {
20 public:
21 /**
22 * The status string.
23 */
24 string status;
25 /**
26 * The message to follow the status string.
27 */
28 string message;
29
30 /**
31 * @param s HTTP status.
32 * @param m HTTP status message.
33 */
34 http_status(const string& s,const string& m)
35 : status(s), message(m) { }
36 virtual ~http_status() throw() { }
37 };
38
39 // per RFC 2616
40
41 /**
42 * Informational.
43 */
44 class http_status_1xx : public http_status {
45 public:
46 explicit http_status_1xx(const string &s,const string& m)
47 : http_status(s,m) { }
48 };
49 /**
50 * Continue.
51 */
52 class http_status_100 : public http_status_1xx {
53 public:
54 explicit http_status_100(const string& m)
55 : http_status_1xx("100",m) { }
56 explicit http_status_100()
57 : http_status_1xx("100","Continue") { }
58 };
59 /**
60 * Switching protocols.
61 */
62 class http_status_101 : public http_status_1xx {
63 public:
64 explicit http_status_101(const string& m)
65 : http_status_1xx("101",m) { }
66 explicit http_status_101()
67 : http_status_1xx("101","Switching protocols") { }
68 };
69
70 /**
71 * Successful.
72 */
73 class http_status_2xx : public http_status {
74 public:
75 explicit http_status_2xx(const string& s,const string& m)
76 : http_status(s,m) { }
77 };
78 /**
79 * OK.
80 */
81 class http_status_200 : public http_status_2xx {
82 public:
83 explicit http_status_200(const string& m)
84 : http_status_2xx("200",m) { }
85 explicit http_status_200()
86 : http_status_2xx("200","OK") { }
87 };
88 /**
89 * Created.
90 */
91 class http_status_201 : public http_status_2xx {
92 public:
93 explicit http_status_201(const string& m)
94 : http_status_2xx("201",m) { }
95 explicit http_status_201()
96 : http_status_2xx("201","Created") { }
97 };
98 /**
99 * Accepted.
100 */
101 class http_status_202 : public http_status_2xx {
102 public:
103 explicit http_status_202(const string& m)
104 : http_status_2xx("202",m) { }
105 explicit http_status_202()
106 : http_status_2xx("202","Accepted") { }
107 };
108 /**
109 * Non-authoritative infortmation.
110 */
111 class http_status_203 : public http_status_2xx {
112 public:
113 explicit http_status_203(const string& m)
114 : http_status_2xx("203",m) { }
115 explicit http_status_203()
116 : http_status_2xx("203","Non-authoritative information") { }
117 };
118 /**
119 * No content.
120 */
121 class http_status_204 : public http_status_2xx {
122 public:
123 explicit http_status_204(const string& m)
124 : http_status_2xx("204",m) { }
125 explicit http_status_204()
126 : http_status_2xx("204","No content") { }
127 };
128 /**
129 * Reset content.
130 */
131 class http_status_205 : public http_status_2xx {
132 public:
133 explicit http_status_205(const string& m)
134 : http_status_2xx("205",m) { }
135 explicit http_status_205()
136 : http_status_2xx("205","Reset content") { }
137 };
138 /**
139 * Partial content.
140 */
141 class http_status_206 : public http_status_2xx {
142 public:
143 explicit http_status_206(const string& m)
144 : http_status_2xx("206",m) { }
145 explicit http_status_206()
146 : http_status_2xx("206","Partial content") { }
147 };
148
149 /**
150 * Redirection.
151 */
152 class http_status_3xx : public http_status {
153 public:
154 explicit http_status_3xx(const string& s,const string& m)
155 : http_status(s,m) { }
156 };
157 /**
158 * Multiple choices.
159 */
160 class http_status_300 : public http_status_3xx {
161 public:
162 explicit http_status_300(const string& m)
163 : http_status_3xx("300",m) { }
164 explicit http_status_300()
165 : http_status_3xx("300","Multiple choices") { }
166 };
167 /**
168 * Moved permanently.
169 */
170 class http_status_301 : public http_status_3xx {
171 public:
172 explicit http_status_301(const string& m)
173 : http_status_3xx("301",m) { }
174 explicit http_status_301()
175 : http_status_3xx("301","Moved permanently") { }
176 };
177 /**
178 * Found.
179 */
180 class http_status_302 : public http_status_3xx {
181 public:
182 explicit http_status_302(const string& m)
183 : http_status_3xx("302",m) { }
184 explicit http_status_302()
185 : http_status_3xx("302","Found") { }
186 };
187 /**
188 * See other.
189 */
190 class http_status_303 : public http_status_3xx {
191 public:
192 explicit http_status_303(const string& m)
193 : http_status_3xx("303",m) { }
194 explicit http_status_303()
195 : http_status_3xx("303","See other") { }
196 };
197 /**
198 * Not modified.
199 */
200 class http_status_304 : public http_status_3xx {
201 public:
202 explicit http_status_304(const string& m)
203 : http_status_3xx("304",m) { }
204 explicit http_status_304()
205 : http_status_3xx("304","Not modified") { }
206 };
207 /**
208 * Use proxy.
209 */
210 class http_status_305 : public http_status_3xx {
211 public:
212 explicit http_status_305(const string& m)
213 : http_status_3xx("305",m) { }
214 explicit http_status_305()
215 : http_status_3xx("305","Use proxy") { }
216 };
217 // 306 is unused and reserved
218 /**
219 * Temporary redirect.
220 */
221 class http_status_307 : public http_status_3xx {
222 public:
223 explicit http_status_307(const string& m)
224 : http_status_3xx("307",m) { }
225 explicit http_status_307()
226 : http_status_3xx("307","Temporary redirect") { }
227 };
228
229 /**
230 * Error.
231 */
232 class http_status_4xx : public http_status {
233 public:
234 explicit http_status_4xx(const string& s,const string& m)
235 : http_status(s,m) { }
236 };
237 /**
238 * Bad request.
239 */
240 class http_status_400 : public http_status_4xx {
241 public:
242 explicit http_status_400(const string& m)
243 : http_status_4xx("400",m) { }
244 explicit http_status_400()
245 : http_status_4xx("400","Bad request") { }
246 };
247 /**
248 * Unauthorized.
249 */
250 class http_status_401 : public http_status_4xx {
251 public:
252 explicit http_status_401(const string& m)
253 : http_status_4xx("401",m) { }
254 explicit http_status_401()
255 : http_status_4xx("401","Unauthorized") { }
256 };
257 /**
258 * Payment required.
259 */
260 class http_status_402 : public http_status_4xx {
261 public:
262 explicit http_status_402(const string& m)
263 : http_status_4xx("402",m) { }
264 explicit http_status_402()
265 : http_status_4xx("402","Payment required") { }
266 };
267 /**
268 * Forbidden.
269 */
270 class http_status_403 : public http_status_4xx {
271 public:
272 explicit http_status_403(const string& m)
273 : http_status_4xx("403",m) { }
274 explicit http_status_403()
275 : http_status_4xx("403","Forbidden") { }
276 };
277 /**
278 * Not found.
279 */
280 class http_status_404 : public http_status_4xx {
281 public:
282 explicit http_status_404(const string& m)
283 : http_status_4xx("404",m) { }
284 explicit http_status_404()
285 : http_status_4xx("404","Not found") { }
286 };
287 /**
288 * Method not allowed.
289 */
290 class http_status_405 : public http_status_4xx {
291 public:
292 explicit http_status_405(const string& m)
293 : http_status_4xx("405",m) { }
294 explicit http_status_405()
295 : http_status_4xx("405","Method not allowed") { }
296 };
297 /**
298 * Not acceptable.
299 */
300 class http_status_406 : public http_status_4xx {
301 public:
302 explicit http_status_406(const string& m)
303 : http_status_4xx("406",m) { }
304 explicit http_status_406()
305 : http_status_4xx("406","Not acceptable") { }
306 };
307 /**
308 * Proxy authentication required.
309 */
310 class http_status_407 : public http_status_4xx {
311 public:
312 explicit http_status_407(const string& m)
313 : http_status_4xx("407",m) { }
314 explicit http_status_407()
315 : http_status_4xx("407","Proxy authentication required") { }
316 };
317 /**
318 * Request timeout.
319 */
320 class http_status_408 : public http_status_4xx {
321 public:
322 explicit http_status_408(const string& m)
323 : http_status_4xx("408",m) { }
324 explicit http_status_408()
325 : http_status_4xx("408","Request timeout") { }
326 };
327 /**
328 * Conflict.
329 */
330 class http_status_409 : public http_status_4xx {
331 public:
332 explicit http_status_409(const string& m)
333 : http_status_4xx("409",m) { }
334 explicit http_status_409()
335 : http_status_4xx("409","Conflict") { }
336 };
337 /**
338 * Gone.
339 */
340 class http_status_410 : public http_status_4xx {
341 public:
342 explicit http_status_410(const string& m)
343 : http_status_4xx("410",m) { }
344 explicit http_status_410()
345 : http_status_4xx("410","Gone") { }
346 };
347 /**
348 * Length required.
349 */
350 class http_status_411 : public http_status_4xx {
351 public:
352 explicit http_status_411(const string& m)
353 : http_status_4xx("411",m) { }
354 explicit http_status_411()
355 : http_status_4xx("411","Length required") { }
356 };
357 /**
358 * Precondition failed.
359 */
360 class http_status_412 : public http_status_4xx {
361 public:
362 explicit http_status_412(const string& m)
363 : http_status_4xx("412",m) { }
364 explicit http_status_412()
365 : http_status_4xx("412","Precondition failed") { }
366 };
367 /**
368 * Request entity too large.
369 */
370 class http_status_413 : public http_status_4xx {
371 public:
372 explicit http_status_413(const string& m)
373 : http_status_4xx("413",m) { }
374 explicit http_status_413()
375 : http_status_4xx("413","Request entity too large") { }
376 };
377 /**
378 * Request URI too long.
379 */
380 class http_status_414 : public http_status_4xx {
381 public:
382 explicit http_status_414(const string& m)
383 : http_status_4xx("414",m) { }
384 explicit http_status_414()
385 : http_status_4xx("414","Request URI too long") { }
386 };
387 /**
388 * Unsupported media type.
389 */
390 class http_status_415 : public http_status_4xx {
391 public:
392 explicit http_status_415(const string& m)
393 : http_status_4xx("415",m) { }
394 explicit http_status_415()
395 : http_status_4xx("415","Unsupported media type") { }
396 };
397 /**
398 * Requested range not satisfiable.
399 */
400 class http_status_416 : public http_status_4xx {
401 public:
402 explicit http_status_416(const string& m)
403 : http_status_4xx("416",m) { }
404 explicit http_status_416()
405 : http_status_4xx("416","Requested range not satisfiable") { }
406 };
407 /**
408 * Expectation failed.
409 */
410 class http_status_417 : public http_status_4xx {
411 public:
412 explicit http_status_417(const string& m)
413 : http_status_4xx("417",m) { }
414 explicit http_status_417()
415 : http_status_4xx("417","Expectation failed") { }
416 };
417
418 /**
419 * Server error.
420 */
421 class http_status_5xx : public http_status {
422 public:
423 explicit http_status_5xx(const string& s,const string& m)
424 : http_status(s,m) { }
425 };
426 /**
427 * Internal server error.
428 */
429 class http_status_500 : public http_status_5xx {
430 public:
431 explicit http_status_500(const string& m)
432 : http_status_5xx("500",m) { }
433 explicit http_status_500()
434 : http_status_5xx("500","Internal server error") { }
435 };
436 /**
437 * Not implemented.
438 */
439 class http_status_501 : public http_status_5xx {
440 public:
441 explicit http_status_501(const string& m)
442 : http_status_5xx("501",m) { }
443 explicit http_status_501()
444 : http_status_5xx("501","Not implemented") { }
445 };
446 /**
447 * Bad gateway.
448 */
449 class http_status_502 : public http_status_5xx {
450 public:
451 explicit http_status_502(const string& m)
452 : http_status_5xx("502",m) { }
453 explicit http_status_502()
454 : http_status_5xx("502","Bad gateway") { }
455 };
456 /**
457 * Service unavailable.
458 */
459 class http_status_503 : public http_status_5xx {
460 public:
461 explicit http_status_503(const string& m)
462 : http_status_5xx("503",m) { }
463 explicit http_status_503()
464 : http_status_5xx("503","Service unavailable") { }
465 };
466 /**
467 * Gateway timeout.
468 */
469 class http_status_504 : public http_status_5xx {
470 public:
471 explicit http_status_504(const string& m)
472 : http_status_5xx("504",m) { }
473 explicit http_status_504()
474 : http_status_5xx("504","Gateway timeout") { }
475 };
476 /**
477 * HTTP version not supported.
478 */
479 class http_status_505 : public http_status_5xx {
480 public:
481 explicit http_status_505(const string& m)
482 : http_status_5xx("505",m) { }
483 explicit http_status_505()
484 : http_status_5xx("505","HTTP version not supported") { }
485 };
486
487 // Aliases
488
489 typedef http_status_1xx http_status_informational;
490 typedef http_status_100 http_status_continue;
491 typedef http_status_101 http_status_switching_protocols;
492
493 typedef http_status_2xx http_status_sucessful;
494 typedef http_status_200 http_status_ok;
495 typedef http_status_201 http_status_created;
496 typedef http_status_202 http_status_accepted;
497 typedef http_status_203 http_status_non_authoritative_information;
498 typedef http_status_204 http_status_no_content;
499 typedef http_status_205 http_status_reset_content;
500 typedef http_status_206 http_status_partial_content;
501
502 typedef http_status_3xx http_status_redirection;
503 typedef http_status_300 http_status_multiple_choices;
504 typedef http_status_301 http_status_moved_permanently;
505 typedef http_status_302 http_status_found;
506 typedef http_status_303 http_status_see_other;
507 typedef http_status_304 http_status_not_modified;
508 typedef http_status_305 http_status_use_proxy;
509 // 306 is unused and reserved
510 typedef http_status_307 http_status_temporary_redirect;
511
512 typedef http_status_4xx http_status_client_error;
513 typedef http_status_400 http_status_bad_request;
514 typedef http_status_401 http_status_unauthorized;
515 typedef http_status_402 http_status_payment_required;
516 typedef http_status_403 http_status_forbidden;
517 typedef http_status_404 http_status_not_found;
518 typedef http_status_405 http_status_method_not_allowed;
519 typedef http_status_406 http_status_not_acceptable;
520 typedef http_status_407 http_status_proxy_authentication_required;
521 typedef http_status_408 http_status_request_timeout;
522 typedef http_status_409 http_status_conflict;
523 typedef http_status_410 http_status_gone;
524 typedef http_status_411 http_status_length_required;
525 typedef http_status_412 http_status_precondition_failed;
526 typedef http_status_413 http_status_request_entity_too_large;
527 typedef http_status_414 http_status_requrest_uri_too_long;
528 typedef http_status_415 http_status_unsupported_media_type;
529 typedef http_status_416 http_status_required_range_not_satisfiable;
530 typedef http_status_417 http_status_expectation_failed;
531
532 typedef http_status_5xx http_status_server_error;
533 typedef http_status_500 http_status_internal_server_error;
534 typedef http_status_501 http_status_not_implemented;
535 typedef http_status_502 http_status_bad_gateway;
536 typedef http_status_503 http_status_service_unavailable;
537 typedef http_status_504 http_status_gateway_timeout;
538 typedef http_status_505 http_status_http_version_not_supported;
539
540}
541
542#endif /* __SITECING_EXCEPTION_H */