Mercurial > hg > orthanc
comparison Core/Enumerations.cpp @ 477:6f8ae46ed90e
moves
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 15 Jul 2013 21:27:49 +0200 |
parents | |
children | f64e3838d6e1 |
comparison
equal
deleted
inserted
replaced
476:4aae0261515e | 477:6f8ae46ed90e |
---|---|
1 /** | |
2 * Orthanc - A Lightweight, RESTful DICOM Store | |
3 * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege, | |
4 * Belgium | |
5 * | |
6 * This program is free software: you can redistribute it and/or | |
7 * modify it under the terms of the GNU General Public License as | |
8 * published by the Free Software Foundation, either version 3 of the | |
9 * License, or (at your option) any later version. | |
10 * | |
11 * In addition, as a special exception, the copyright holders of this | |
12 * program give permission to link the code of its release with the | |
13 * OpenSSL project's "OpenSSL" library (or with modified versions of it | |
14 * that use the same license as the "OpenSSL" library), and distribute | |
15 * the linked executables. You must obey the GNU General Public License | |
16 * in all respects for all of the code used other than "OpenSSL". If you | |
17 * modify file(s) with this exception, you may extend this exception to | |
18 * your version of the file(s), but you are not obligated to do so. If | |
19 * you do not wish to do so, delete this exception statement from your | |
20 * version. If you delete this exception statement from all source files | |
21 * in the program, then also delete it here. | |
22 * | |
23 * This program is distributed in the hope that it will be useful, but | |
24 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
26 * General Public License for more details. | |
27 * | |
28 * You should have received a copy of the GNU General Public License | |
29 * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
30 **/ | |
31 | |
32 | |
33 #include "Enumerations.h" | |
34 | |
35 #include "OrthancException.h" | |
36 | |
37 namespace Orthanc | |
38 { | |
39 const char* EnumerationToString(HttpMethod method) | |
40 { | |
41 switch (method) | |
42 { | |
43 case HttpMethod_Get: | |
44 return "GET"; | |
45 | |
46 case HttpMethod_Post: | |
47 return "POST"; | |
48 | |
49 case HttpMethod_Delete: | |
50 return "DELETE"; | |
51 | |
52 case HttpMethod_Put: | |
53 return "PUT"; | |
54 | |
55 default: | |
56 return "?"; | |
57 } | |
58 } | |
59 | |
60 | |
61 const char* EnumerationToString(HttpStatus status) | |
62 { | |
63 switch (status) | |
64 { | |
65 case HttpStatus_100_Continue: | |
66 return "Continue"; | |
67 | |
68 case HttpStatus_101_SwitchingProtocols: | |
69 return "Switching Protocols"; | |
70 | |
71 case HttpStatus_102_Processing: | |
72 return "Processing"; | |
73 | |
74 case HttpStatus_200_Ok: | |
75 return "OK"; | |
76 | |
77 case HttpStatus_201_Created: | |
78 return "Created"; | |
79 | |
80 case HttpStatus_202_Accepted: | |
81 return "Accepted"; | |
82 | |
83 case HttpStatus_203_NonAuthoritativeInformation: | |
84 return "Non-Authoritative Information"; | |
85 | |
86 case HttpStatus_204_NoContent: | |
87 return "No Content"; | |
88 | |
89 case HttpStatus_205_ResetContent: | |
90 return "Reset Content"; | |
91 | |
92 case HttpStatus_206_PartialContent: | |
93 return "Partial Content"; | |
94 | |
95 case HttpStatus_207_MultiStatus: | |
96 return "Multi-Status"; | |
97 | |
98 case HttpStatus_208_AlreadyReported: | |
99 return "Already Reported"; | |
100 | |
101 case HttpStatus_226_IMUsed: | |
102 return "IM Used"; | |
103 | |
104 case HttpStatus_300_MultipleChoices: | |
105 return "Multiple Choices"; | |
106 | |
107 case HttpStatus_301_MovedPermanently: | |
108 return "Moved Permanently"; | |
109 | |
110 case HttpStatus_302_Found: | |
111 return "Found"; | |
112 | |
113 case HttpStatus_303_SeeOther: | |
114 return "See Other"; | |
115 | |
116 case HttpStatus_304_NotModified: | |
117 return "Not Modified"; | |
118 | |
119 case HttpStatus_305_UseProxy: | |
120 return "Use Proxy"; | |
121 | |
122 case HttpStatus_307_TemporaryRedirect: | |
123 return "Temporary Redirect"; | |
124 | |
125 case HttpStatus_400_BadRequest: | |
126 return "Bad Request"; | |
127 | |
128 case HttpStatus_401_Unauthorized: | |
129 return "Unauthorized"; | |
130 | |
131 case HttpStatus_402_PaymentRequired: | |
132 return "Payment Required"; | |
133 | |
134 case HttpStatus_403_Forbidden: | |
135 return "Forbidden"; | |
136 | |
137 case HttpStatus_404_NotFound: | |
138 return "Not Found"; | |
139 | |
140 case HttpStatus_405_MethodNotAllowed: | |
141 return "Method Not Allowed"; | |
142 | |
143 case HttpStatus_406_NotAcceptable: | |
144 return "Not Acceptable"; | |
145 | |
146 case HttpStatus_407_ProxyAuthenticationRequired: | |
147 return "Proxy Authentication Required"; | |
148 | |
149 case HttpStatus_408_RequestTimeout: | |
150 return "Request Timeout"; | |
151 | |
152 case HttpStatus_409_Conflict: | |
153 return "Conflict"; | |
154 | |
155 case HttpStatus_410_Gone: | |
156 return "Gone"; | |
157 | |
158 case HttpStatus_411_LengthRequired: | |
159 return "Length Required"; | |
160 | |
161 case HttpStatus_412_PreconditionFailed: | |
162 return "Precondition Failed"; | |
163 | |
164 case HttpStatus_413_RequestEntityTooLarge: | |
165 return "Request Entity Too Large"; | |
166 | |
167 case HttpStatus_414_RequestUriTooLong: | |
168 return "Request-URI Too Long"; | |
169 | |
170 case HttpStatus_415_UnsupportedMediaType: | |
171 return "Unsupported Media Type"; | |
172 | |
173 case HttpStatus_416_RequestedRangeNotSatisfiable: | |
174 return "Requested Range Not Satisfiable"; | |
175 | |
176 case HttpStatus_417_ExpectationFailed: | |
177 return "Expectation Failed"; | |
178 | |
179 case HttpStatus_422_UnprocessableEntity: | |
180 return "Unprocessable Entity"; | |
181 | |
182 case HttpStatus_423_Locked: | |
183 return "Locked"; | |
184 | |
185 case HttpStatus_424_FailedDependency: | |
186 return "Failed Dependency"; | |
187 | |
188 case HttpStatus_426_UpgradeRequired: | |
189 return "Upgrade Required"; | |
190 | |
191 case HttpStatus_500_InternalServerError: | |
192 return "Internal Server Error"; | |
193 | |
194 case HttpStatus_501_NotImplemented: | |
195 return "Not Implemented"; | |
196 | |
197 case HttpStatus_502_BadGateway: | |
198 return "Bad Gateway"; | |
199 | |
200 case HttpStatus_503_ServiceUnavailable: | |
201 return "Service Unavailable"; | |
202 | |
203 case HttpStatus_504_GatewayTimeout: | |
204 return "Gateway Timeout"; | |
205 | |
206 case HttpStatus_505_HttpVersionNotSupported: | |
207 return "HTTP Version Not Supported"; | |
208 | |
209 case HttpStatus_506_VariantAlsoNegotiates: | |
210 return "Variant Also Negotiates"; | |
211 | |
212 case HttpStatus_507_InsufficientStorage: | |
213 return "Insufficient Storage"; | |
214 | |
215 case HttpStatus_509_BandwidthLimitExceeded: | |
216 return "Bandwidth Limit Exceeded"; | |
217 | |
218 case HttpStatus_510_NotExtended: | |
219 return "Not Extended"; | |
220 | |
221 default: | |
222 throw OrthancException(ErrorCode_ParameterOutOfRange); | |
223 } | |
224 } | |
225 } |