|
1 | | -// Copyright (C) 2013 by Glyn Matthews |
| 1 | +// Copyright (C) 2013, 2014 by Glyn Matthews |
2 | 2 | // Distributed under the Boost Software License, Version 1.0. |
3 | 3 | // (See accompanying file LICENSE_1_0.txt or copy at |
4 | 4 | // http://www.boost.org/LICENSE_1_0.txt) |
|
9 | 9 |
|
10 | 10 | namespacenetwork { |
11 | 11 | namespacehttp { |
12 | | -namespacev2 { |
13 | | - |
| 12 | +inlinenamespacev2 { |
14 | 13 | classclient_category_impl :publicstd::error_category { |
15 | 14 |
|
16 | | -public: |
17 | | - |
18 | | -client_category_impl() =default; |
| 15 | +public: |
| 16 | +client_category_impl() =default; |
19 | 17 |
|
20 | | -virtual~client_category_impl()noexcept; |
| 18 | +virtual~client_category_impl()noexceptoverride; |
21 | 19 |
|
22 | | -virtualconstchar *name()constnoexcept; |
23 | | - |
24 | | -virtual std::stringmessage(int ev)const; |
| 20 | +virtualconstchar *name()constnoexceptoverride; |
25 | 21 |
|
| 22 | +virtual std::stringmessage(int ev)constoverride; |
26 | 23 | }; |
27 | 24 |
|
28 | | -client_category_impl::~client_category_impl()noexcept { |
29 | | - |
30 | | - } |
| 25 | +client_category_impl::~client_category_impl()noexcept {} |
31 | 26 |
|
32 | 27 | constchar *client_category_impl::name()constnoexcept { |
33 | | -staticconstchar name[] ="client_error"; |
34 | | -return name; |
| 28 | +staticconstchar name[] ="client_error"; |
| 29 | +return name; |
35 | 30 | } |
36 | 31 |
|
37 | 32 | std::stringclient_category_impl::message(int ev)const { |
38 | | -switch (client_error(ev)) { |
39 | | - |
40 | | -case client_error::invalid_request: |
41 | | -return"Invalid HTTP request."; |
42 | | -case client_error::invalid_response: |
43 | | -return"Invalid HTTP response."; |
44 | | -default: |
45 | | -break; |
46 | | -} |
47 | | -return"Unknown client error."; |
| 33 | +switch (client_error(ev)) { |
| 34 | + |
| 35 | +case client_error::invalid_request: |
| 36 | +return"Invalid HTTP request."; |
| 37 | +case client_error::invalid_response: |
| 38 | +return"Invalid HTTP response."; |
| 39 | +default: |
| 40 | +break; |
| 41 | +} |
| 42 | +return"Unknown client error."; |
48 | 43 | } |
49 | 44 |
|
50 | 45 | const std::error_category &client_category() { |
51 | | -static client_category_impl client_category; |
52 | | -return client_category; |
| 46 | +static client_category_impl client_category; |
| 47 | +return client_category; |
53 | 48 | } |
54 | 49 |
|
55 | 50 | std::error_codemake_error_code(client_error e) { |
56 | | -returnstd::error_code(static_cast<int>(e),client_category()); |
| 51 | +returnstd::error_code(static_cast<int>(e),client_category()); |
57 | 52 | } |
58 | 53 |
|
59 | 54 | invalid_url::invalid_url() |
60 | | - : std::invalid_argument("Requires HTTP or HTTPS URL.") { |
61 | | - |
62 | | - } |
| 55 | + : std::invalid_argument("Requires HTTP or HTTPS URL.") {} |
63 | 56 |
|
64 | | -invalid_url::~invalid_url()noexcept { |
65 | | - |
66 | | - } |
| 57 | +invalid_url::~invalid_url()noexcept {} |
67 | 58 |
|
68 | 59 | client_exception::client_exception(client_error error) |
69 | | -: std::system_error(make_error_code(error)) { |
70 | | - |
71 | | - } |
72 | | - |
73 | | -client_exception::~client_exception()noexcept { |
74 | | - |
75 | | - } |
| 60 | + : std::system_error(make_error_code(error)) {} |
76 | 61 |
|
77 | | - }// namespace v2 |
78 | | - }// namespace network |
79 | | -}// namespace network |
| 62 | +client_exception::~client_exception()noexcept {} |
| 63 | + }// namespace v2 |
| 64 | + }// namespace http |
| 65 | +}// namespace network |