@@ -54,7 +54,7 @@ class acceptable_types {
54
54
public:
55
55
explicit acceptable_types (const std::string &accept_header);
56
56
bool is_acceptable (mime::type) const ;
57
- // note: returns mime::unspecified_type if none were acceptable
57
+ // note: returns mime::type:: unspecified_type if none were acceptable
58
58
mime::type most_acceptable_of (const std::vector<mime::type> &available) const ;
59
59
60
60
private:
@@ -121,10 +121,10 @@ struct http_accept_grammar
121
121
};
122
122
/*
123
123
= lit("* / *") [_val = mime::any_type]
124
- | lit("text/xml") [_val = mime::application_xml]
125
- | lit("application/xml") [_val = mime::application_xml]
124
+ | lit("text/xml") [_val = mime::type:: application_xml]
125
+ | lit("application/xml") [_val = mime::type:: application_xml]
126
126
#if HAVE_YAJL
127
- | lit("application/json")[_val = mime::application_json]
127
+ | lit("application/json")[_val = mime::type:: application_json]
128
128
#endif
129
129
;
130
130
*/
@@ -144,7 +144,7 @@ acceptable_types::acceptable_types(const std::string &accept_header) {
144
144
for (media_range range : ranges) {
145
145
// figure out the mime::type from the string.
146
146
mime::type mime_type = mime::parse_from (range.mime_type );
147
- if (mime_type == mime::unspecified_type) {
147
+ if (mime_type == mime::type:: unspecified_type) {
148
148
// if it's unknown then skip this type...
149
149
continue ;
150
150
}
@@ -174,7 +174,7 @@ bool acceptable_types::is_acceptable(mime::type mt) const {
174
174
}
175
175
176
176
mime::type acceptable_types::most_acceptable_of (const std::vector<mime::type> &available) const {
177
- mime::type best = mime::unspecified_type;
177
+ mime::type best = mime::type:: unspecified_type;
178
178
float score = std::numeric_limits<float >::min ();
179
179
for (mime::type type : available) {
180
180
auto itr = mapping.find (type);
@@ -188,7 +188,7 @@ mime::type acceptable_types::most_acceptable_of(const std::vector<mime::type> &a
188
188
189
189
// also check the full wildcard.
190
190
if (!available.empty ()) {
191
- auto itr = mapping.find (mime::any_type);
191
+ auto itr = mapping.find (mime::type:: any_type);
192
192
if ((itr != mapping.end ()) && (itr->second > score)) {
193
193
best = available.front ();
194
194
}
@@ -230,7 +230,7 @@ mime::type choose_best_mime_type(const request &req, const responder& hptr) {
230
230
mime::type best_type = hptr.resource_type ();
231
231
// check if the handler is capable of supporting an acceptable set of mime
232
232
// types.
233
- if (best_type != mime::unspecified_type) {
233
+ if (best_type != mime::type:: unspecified_type) {
234
234
// check that this doesn't conflict with anything in the Accept header.
235
235
if (!hptr.is_available (best_type))
236
236
throw http::not_acceptable (fmt::format (" Acceptable formats for {} are: {}" ,
@@ -243,11 +243,11 @@ mime::type choose_best_mime_type(const request &req, const responder& hptr) {
243
243
} else {
244
244
best_type = types.most_acceptable_of (types_available);
245
245
// if none were acceptable then...
246
- if (best_type == mime::unspecified_type) {
246
+ if (best_type == mime::type:: unspecified_type) {
247
247
throw http::not_acceptable (fmt::format (" Acceptable formats for {} are: {}" ,
248
248
get_request_path (req),
249
249
mime_types_to_string (types_available)));
250
- } else if (best_type == mime::any_type) {
250
+ } else if (best_type == mime::type:: any_type) {
251
251
// choose the first of the available types if nothing is preferred.
252
252
best_type = *(hptr.types_available ().begin ());
253
253
}
@@ -260,14 +260,14 @@ mime::type choose_best_mime_type(const request &req, const responder& hptr) {
260
260
std::unique_ptr<output_formatter> create_formatter (mime::type best_type, output_buffer& out) {
261
261
262
262
switch (best_type) {
263
- case mime::application_xml:
263
+ case mime::type:: application_xml:
264
264
return std::make_unique<xml_formatter>(std::make_unique<xml_writer>(out, true ));
265
265
266
266
#if HAVE_YAJL
267
- case mime::application_json:
267
+ case mime::type:: application_json:
268
268
return std::make_unique<json_formatter>(std::make_unique<json_writer>(out, false ));
269
269
#endif
270
- case mime::text_plain:
270
+ case mime::type:: text_plain:
271
271
return std::make_unique<text_formatter>(std::make_unique<text_writer>(out, true ));
272
272
273
273
default :
0 commit comments