20
20
namespace network {
21
21
namespace http {
22
22
namespace v2 {
23
+ /* *
24
+ * \ingroup http_client
25
+ * \class response network/http/v2/client/response.hpp
26
+ * \brief A class that encapsulates an HTTP response.
27
+ */
23
28
class response {
24
29
25
30
public:
26
31
32
+ /* *
33
+ * \typedef string_type
34
+ * \brief The responses string_type.
35
+ */
27
36
typedef std::string string_type;
37
+
38
+ /* *
39
+ * \typedef headers_type
40
+ * \brief
41
+ */
28
42
typedef std::vector<std::pair<string_type, string_type>> headers_type;
43
+
44
+ /* *
45
+ * \typedef headers_iterator
46
+ */
29
47
typedef headers_type::iterator headers_iterator;
48
+
49
+ /* *
50
+ * \typedef const_headers_iterator
51
+ */
30
52
typedef headers_type::const_iterator const_headers_iterator;
31
53
54
+ /* *
55
+ * \brief Constructor.
56
+ */
32
57
response () { }
33
58
59
+ /* *
60
+ * \brief Copy constructor.
61
+ * \param other The other response object.
62
+ */
34
63
response (const response &other)
35
64
: status_(other.status_)
36
65
, version_(other.version_)
@@ -39,6 +68,10 @@ namespace network {
39
68
40
69
}
41
70
71
+ /* *
72
+ * \brief Move constructor.
73
+ * \param other The other response object.
74
+ */
42
75
response (response &&other) noexcept
43
76
: status_(std::move(other.status_))
44
77
, version_(std::move(other.version_))
@@ -47,26 +80,45 @@ namespace network {
47
80
48
81
}
49
82
83
+ /* *
84
+ * \brief Assignment operator.
85
+ * \param other The other response object.
86
+ */
50
87
response &operator = (response other) {
51
88
other.swap (*this );
52
89
return *this ;
53
90
}
54
91
92
+ /* *
93
+ * \brief Swap function.
94
+ * \param other The other response object.
95
+ */
55
96
void swap (response &other) noexcept {
56
97
std::swap (status_, other.status_ );
57
98
std::swap (version_, other.version_ );
58
99
std::swap (status_message_, other.status_message_ );
59
100
std::swap (headers_, other.headers_ );
60
101
}
61
102
103
+ /* *
104
+ * \brief Returns the HTTP response status.
105
+ * \returns The status code.
106
+ */
62
107
std::uint16_t status () const {
63
108
return status_;
64
109
}
65
110
111
+ /* *
112
+ * \brief Returns the HTTP response status message.
113
+ * \returns The status message.
114
+ */
66
115
string_type status_message () const {
67
116
return status_message_;
68
117
}
69
118
119
+ /* *
120
+ * \brief
121
+ */
70
122
boost::iterator_range<const_headers_iterator> headers () const {
71
123
return boost::make_iterator_range (std::begin (headers_), std::end (headers_));
72
124
}
@@ -81,6 +133,10 @@ namespace network {
81
133
// append_body
82
134
// get_body
83
135
136
+ /* *
137
+ * \brief Returns the HTTP version.
138
+ * \returns The HTTP version.
139
+ */
84
140
string_type version () const {
85
141
return version_;
86
142
}
0 commit comments