annotate Core/Enumerations.cpp @ 825:d8f5de5b9517 templating

partials
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 28 May 2014 17:54:59 +0200
parents ecedd89055db
children a811bdf8b8eb
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
477
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 * Orthanc - A Lightweight, RESTful DICOM Store
689
2d0a347e8cfc switch to 2014
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 562
diff changeset
3 * Copyright (C) 2012-2014 Medical Physics Department, CHU of Liege,
477
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4 * Belgium
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6 * This program is free software: you can redistribute it and/or
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 * modify it under the terms of the GNU General Public License as
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 * published by the Free Software Foundation, either version 3 of the
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 * License, or (at your option) any later version.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 * In addition, as a special exception, the copyright holders of this
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 * program give permission to link the code of its release with the
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 * OpenSSL project's "OpenSSL" library (or with modified versions of it
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 * that use the same license as the "OpenSSL" library), and distribute
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 * the linked executables. You must obey the GNU General Public License
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 * in all respects for all of the code used other than "OpenSSL". If you
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 * modify file(s) with this exception, you may extend this exception to
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 * your version of the file(s), but you are not obligated to do so. If
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 * you do not wish to do so, delete this exception statement from your
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20 * version. If you delete this exception statement from all source files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21 * in the program, then also delete it here.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23 * This program is distributed in the hope that it will be useful, but
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24 * WITHOUT ANY WARRANTY; without even the implied warranty of
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26 * General Public License for more details.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27 *
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28 * You should have received a copy of the GNU General Public License
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29 * along with this program. If not, see <http://www.gnu.org/licenses/>.
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33 #include "Enumerations.h"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
34
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35 #include "OrthancException.h"
562
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
36 #include "Toolbox.h"
477
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38 namespace Orthanc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40 const char* EnumerationToString(HttpMethod method)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42 switch (method)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
44 case HttpMethod_Get:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45 return "GET";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
46
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47 case HttpMethod_Post:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
48 return "POST";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
49
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
50 case HttpMethod_Delete:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
51 return "DELETE";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
52
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
53 case HttpMethod_Put:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
54 return "PUT";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
55
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
56 default:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
57 return "?";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
58 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
59 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
60
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
61
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
62 const char* EnumerationToString(HttpStatus status)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
63 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
64 switch (status)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
65 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
66 case HttpStatus_100_Continue:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
67 return "Continue";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
68
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
69 case HttpStatus_101_SwitchingProtocols:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
70 return "Switching Protocols";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
71
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
72 case HttpStatus_102_Processing:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
73 return "Processing";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
74
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
75 case HttpStatus_200_Ok:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
76 return "OK";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
77
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
78 case HttpStatus_201_Created:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
79 return "Created";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
80
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
81 case HttpStatus_202_Accepted:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
82 return "Accepted";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
83
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
84 case HttpStatus_203_NonAuthoritativeInformation:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
85 return "Non-Authoritative Information";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
86
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
87 case HttpStatus_204_NoContent:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
88 return "No Content";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
89
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
90 case HttpStatus_205_ResetContent:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
91 return "Reset Content";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
92
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
93 case HttpStatus_206_PartialContent:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
94 return "Partial Content";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
95
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
96 case HttpStatus_207_MultiStatus:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
97 return "Multi-Status";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
98
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
99 case HttpStatus_208_AlreadyReported:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
100 return "Already Reported";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
101
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
102 case HttpStatus_226_IMUsed:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
103 return "IM Used";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
104
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
105 case HttpStatus_300_MultipleChoices:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
106 return "Multiple Choices";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
107
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
108 case HttpStatus_301_MovedPermanently:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
109 return "Moved Permanently";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
110
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
111 case HttpStatus_302_Found:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
112 return "Found";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
113
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
114 case HttpStatus_303_SeeOther:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
115 return "See Other";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
116
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
117 case HttpStatus_304_NotModified:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
118 return "Not Modified";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
119
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
120 case HttpStatus_305_UseProxy:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
121 return "Use Proxy";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
122
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
123 case HttpStatus_307_TemporaryRedirect:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
124 return "Temporary Redirect";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
125
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
126 case HttpStatus_400_BadRequest:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
127 return "Bad Request";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
128
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
129 case HttpStatus_401_Unauthorized:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
130 return "Unauthorized";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
131
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
132 case HttpStatus_402_PaymentRequired:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
133 return "Payment Required";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
134
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
135 case HttpStatus_403_Forbidden:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
136 return "Forbidden";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
137
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
138 case HttpStatus_404_NotFound:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
139 return "Not Found";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
140
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
141 case HttpStatus_405_MethodNotAllowed:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
142 return "Method Not Allowed";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
143
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
144 case HttpStatus_406_NotAcceptable:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
145 return "Not Acceptable";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
146
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
147 case HttpStatus_407_ProxyAuthenticationRequired:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
148 return "Proxy Authentication Required";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
149
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
150 case HttpStatus_408_RequestTimeout:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
151 return "Request Timeout";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
152
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
153 case HttpStatus_409_Conflict:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
154 return "Conflict";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
155
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
156 case HttpStatus_410_Gone:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
157 return "Gone";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
158
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
159 case HttpStatus_411_LengthRequired:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
160 return "Length Required";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
161
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
162 case HttpStatus_412_PreconditionFailed:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
163 return "Precondition Failed";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
164
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
165 case HttpStatus_413_RequestEntityTooLarge:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
166 return "Request Entity Too Large";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
167
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
168 case HttpStatus_414_RequestUriTooLong:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
169 return "Request-URI Too Long";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
170
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
171 case HttpStatus_415_UnsupportedMediaType:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
172 return "Unsupported Media Type";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
173
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
174 case HttpStatus_416_RequestedRangeNotSatisfiable:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
175 return "Requested Range Not Satisfiable";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
176
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
177 case HttpStatus_417_ExpectationFailed:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
178 return "Expectation Failed";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
179
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
180 case HttpStatus_422_UnprocessableEntity:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
181 return "Unprocessable Entity";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
182
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
183 case HttpStatus_423_Locked:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
184 return "Locked";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
185
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
186 case HttpStatus_424_FailedDependency:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
187 return "Failed Dependency";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
188
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
189 case HttpStatus_426_UpgradeRequired:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
190 return "Upgrade Required";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
191
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
192 case HttpStatus_500_InternalServerError:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
193 return "Internal Server Error";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
194
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
195 case HttpStatus_501_NotImplemented:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
196 return "Not Implemented";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
197
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
198 case HttpStatus_502_BadGateway:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
199 return "Bad Gateway";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
200
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
201 case HttpStatus_503_ServiceUnavailable:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
202 return "Service Unavailable";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
203
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
204 case HttpStatus_504_GatewayTimeout:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
205 return "Gateway Timeout";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
206
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
207 case HttpStatus_505_HttpVersionNotSupported:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
208 return "HTTP Version Not Supported";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
209
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
210 case HttpStatus_506_VariantAlsoNegotiates:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
211 return "Variant Also Negotiates";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
212
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
213 case HttpStatus_507_InsufficientStorage:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
214 return "Insufficient Storage";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
215
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
216 case HttpStatus_509_BandwidthLimitExceeded:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
217 return "Bandwidth Limit Exceeded";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
218
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
219 case HttpStatus_510_NotExtended:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
220 return "Not Extended";
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
221
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
222 default:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
223 throw OrthancException(ErrorCode_ParameterOutOfRange);
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
224 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
225 }
562
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
226
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
227
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
228 const char* EnumerationToString(ResourceType type)
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
229 {
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
230 switch (type)
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
231 {
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
232 case ResourceType_Patient:
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
233 return "Patient";
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
234
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
235 case ResourceType_Study:
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
236 return "Study";
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
237
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
238 case ResourceType_Series:
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
239 return "Series";
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
240
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
241 case ResourceType_Instance:
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
242 return "Instance";
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
243
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
244 default:
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
245 throw OrthancException(ErrorCode_ParameterOutOfRange);
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
246 }
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
247 }
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
248
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
249
800
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
250 const char* EnumerationToString(ImageFormat format)
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
251 {
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
252 switch (format)
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
253 {
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
254 case ImageFormat_Png:
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
255 return "Png";
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
256
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
257 default:
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
258 throw OrthancException(ErrorCode_ParameterOutOfRange);
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
259 }
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
260 }
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
261
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
262
562
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
263 ResourceType StringToResourceType(const char* type)
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
264 {
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
265 std::string s(type);
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
266 Toolbox::ToUpperCase(s);
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
267
697
dd1ce9a2844c access to attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 689
diff changeset
268 if (s == "PATIENT" || s == "PATIENTS")
562
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
269 {
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
270 return ResourceType_Patient;
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
271 }
697
dd1ce9a2844c access to attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 689
diff changeset
272 else if (s == "STUDY" || s == "STUDIES")
562
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
273 {
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
274 return ResourceType_Study;
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
275 }
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
276 else if (s == "SERIES")
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
277 {
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
278 return ResourceType_Series;
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
279 }
697
dd1ce9a2844c access to attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 689
diff changeset
280 else if (s == "INSTANCE" || s == "IMAGE" ||
dd1ce9a2844c access to attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 689
diff changeset
281 s == "INSTANCES" || s == "IMAGES")
562
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
282 {
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
283 return ResourceType_Instance;
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
284 }
800
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
285
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
286 throw OrthancException(ErrorCode_ParameterOutOfRange);
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
287 }
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
288
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
289
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
290 ImageFormat StringToImageFormat(const char* format)
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
291 {
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
292 std::string s(format);
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
293 Toolbox::ToUpperCase(s);
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
294
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
295 if (s == "PNG")
562
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
296 {
800
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
297 return ImageFormat_Png;
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
298 }
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
299
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
300 throw OrthancException(ErrorCode_ParameterOutOfRange);
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
301 }
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
302
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
303
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
304 unsigned int GetBytesPerPixel(PixelFormat format)
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
305 {
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
306 switch (format)
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
307 {
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
308 case PixelFormat_Grayscale8:
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
309 return 1;
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
310
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
311 case PixelFormat_Grayscale16:
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
312 case PixelFormat_SignedGrayscale16:
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
313 return 2;
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
314
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
315 case PixelFormat_RGB24:
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
316 return 3;
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
317
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
318 case PixelFormat_RGBA32:
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
319 return 4;
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
320
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
321 default:
ecedd89055db generation of DICOM images from PNG files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 697
diff changeset
322 throw OrthancException(ErrorCode_ParameterOutOfRange);
562
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
323 }
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 477
diff changeset
324 }
477
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
325 }