2020namespace network {
2121namespace http {
2222namespace 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+ */
2328class response {
2429
2530public:
2631
32+ /* *
33+ * \typedef string_type
34+ * \brief The responses string_type.
35+ */
2736typedef std::string string_type;
37+
38+ /* *
39+ * \typedef headers_type
40+ * \brief
41+ */
2842typedef std::vector<std::pair<string_type, string_type>> headers_type;
43+
44+ /* *
45+ * \typedef headers_iterator
46+ */
2947typedef headers_type::iterator headers_iterator;
48+
49+ /* *
50+ * \typedef const_headers_iterator
51+ */
3052typedef headers_type::const_iterator const_headers_iterator;
3153
54+ /* *
55+ * \brief Constructor.
56+ */
3257response () { }
3358
59+ /* *
60+ * \brief Copy constructor.
61+ * \param other The other response object.
62+ */
3463response (const response &other)
3564 : status_(other.status_)
3665 , version_(other.version_)
@@ -39,6 +68,10 @@ namespace network {
3968
4069}
4170
71+ /* *
72+ * \brief Move constructor.
73+ * \param other The other response object.
74+ */
4275response (response &&other)noexcept
4376 : status_(std::move(other.status_))
4477 , version_(std::move(other.version_))
@@ -47,26 +80,45 @@ namespace network {
4780
4881}
4982
83+ /* *
84+ * \brief Assignment operator.
85+ * \param other The other response object.
86+ */
5087response &operator = (response other) {
5188 other.swap (*this );
5289return *this ;
5390}
5491
92+ /* *
93+ * \brief Swap function.
94+ * \param other The other response object.
95+ */
5596void swap (response &other)noexcept {
5697std::swap (status_, other.status_ );
5798std::swap (version_, other.version_ );
5899std::swap (status_message_, other.status_message_ );
59100std::swap (headers_, other.headers_ );
60101}
61102
103+ /* *
104+ * \brief Returns the HTTP response status.
105+ * \returns The status code.
106+ */
62107std::uint16_t status ()const {
63108return status_;
64109}
65110
111+ /* *
112+ * \brief Returns the HTTP response status message.
113+ * \returns The status message.
114+ */
66115string_typestatus_message ()const {
67116return status_message_;
68117}
69118
119+ /* *
120+ * \brief
121+ */
70122boost::iterator_range<const_headers_iterator>headers ()const {
71123return boost::make_iterator_range (std::begin (headers_),std::end (headers_));
72124}
@@ -81,6 +133,10 @@ namespace network {
81133// append_body
82134// get_body
83135
136+ /* *
137+ * \brief Returns the HTTP version.
138+ * \returns The HTTP version.
139+ */
84140string_typeversion ()const {
85141return version_;
86142}