Odil
A C++11 library for the DICOM standard
HTTPResponse.h
Go to the documentation of this file.
1 /*************************************************************************
2  * odil - Copyright (C) Universite de Strasbourg
3  * Distributed under the terms of the CeCILL-B license, as published by
4  * the CEA-CNRS-INRIA. Refer to the LICENSE file or to
5  * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
6  * for details.
7  ************************************************************************/
8 
9 #ifndef _c08db816_ac02_484c_8e9a_ab816c5198c7
10 #define _c08db816_ac02_484c_8e9a_ab816c5198c7
11 
12 #include <string>
13 
14 #include "odil/odil.h"
16 
17 namespace odil
18 {
19 
20 namespace webservices
21 {
22 
25 {
26 public:
34  std::string const & http_version="",
35  unsigned int status=0, std::string const & reason="",
36  Headers const & headers={}, std::string const & body="");
37 
38  HTTPResponse(HTTPResponse const &) = default;
39  HTTPResponse(HTTPResponse &&) = default;
40  HTTPResponse & operator=(HTTPResponse const &) = default;
42  virtual ~HTTPResponse() = default;
43 
45  std::string const & get_http_version() const;
46 
48  void set_http_version(std::string const & http_version);
49 
51  unsigned int get_status() const;
52 
54  void set_status(unsigned int status);
55 
57  std::string const & get_reason() const;
58 
60  void set_reason(std::string const & target);
61 
62 private:
63  std::string _http_version;
64  unsigned int _status;
65  std::string _reason;
66 };
67 
70 std::istream &
71 operator>>(std::istream & stream, HTTPResponse & Response);
72 
75 std::ostream &
76 operator<<(std::ostream & stream, HTTPResponse const & Response);
77 
78 }
79 
80 }
81 
82 #endif // _c08db816_ac02_484c_8e9a_ab816c5198c7
odil::webservices::HTTPResponse::HTTPResponse
HTTPResponse(HTTPResponse &&)=default
odil::webservices::HTTPResponse::get_http_version
std::string const & get_http_version() const
Return the HTTP version.
odil::webservices::HTTPResponse::set_reason
void set_reason(std::string const &target)
Set the reason.
odil::webservices::operator<<
std::ostream & operator<<(std::ostream &stream, HTTPRequest const &request)
Output an HTTP request to a stream.
odil::webservices::HTTPResponse::HTTPResponse
HTTPResponse(std::string const &http_version="", unsigned int status=0, std::string const &reason="", Headers const &headers={}, std::string const &body="")
Constructor.
odil
Definition: Association.h:25
ODIL_API
#define ODIL_API
Definition: odil.h:28
odil::webservices::HTTPResponse::get_status
unsigned int get_status() const
Return the status.
odil::webservices::HTTPResponse
HTTP Response.
Definition: HTTPResponse.h:25
odil::webservices::HTTPResponse::set_http_version
void set_http_version(std::string const &http_version)
Set the HTTP version.
odil::webservices::HTTPResponse::operator=
HTTPResponse & operator=(HTTPResponse &&)=default
odil::webservices::HTTPResponse::~HTTPResponse
virtual ~HTTPResponse()=default
odil.h
odil::webservices::HTTPResponse::HTTPResponse
HTTPResponse(HTTPResponse const &)=default
Message.h
odil::webservices::Message::Headers
std::map< std::string, std::string > Headers
Associative container for headers.
Definition: Message.h:30
odil::webservices::HTTPResponse::get_reason
std::string const & get_reason() const
Return the reason.
odil::webservices::Message
RFC 5322 Message (i.e. headers with body).
Definition: Message.h:27
odil::webservices::HTTPResponse::operator=
HTTPResponse & operator=(HTTPResponse const &)=default
odil::webservices::operator>>
std::istream & operator>>(std::istream &stream, HTTPRequest &request)
Input an HTTP request from a stream.
odil::webservices::HTTPResponse::set_status
void set_status(unsigned int status)
Set the status.