Odil
A C++11 library for the DICOM standard
Message.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 _d7a272d7_9beb_43c1_a5a1_fce4c0245c80
10 #define _d7a272d7_9beb_43c1_a5a1_fce4c0245c80
11 
12 #include <istream>
13 #include <map>
14 #include <ostream>
15 #include <string>
16 
17 #include "odil/odil.h"
18 
19 namespace odil
20 {
21 
22 namespace webservices
23 {
24 
26 class ODIL_API Message
27 {
28 public:
30  typedef std::map<std::string, std::string> Headers;
31 
37  Message(Headers const & headers={}, std::string const & body="");
38 
39  Message(Message const &) = default;
40  Message(Message &&) = default;
41  Message & operator=(Message const &) = default;
42  Message & operator=(Message &&) = default;
43  virtual ~Message() = default;
44 
46  Headers const & get_headers() const;
47 
49  void set_headers(Headers const & headers);
50 
57  bool has_header(std::string const & name) const;
58 
66  std::string const & get_header(std::string const & name) const;
67 
69  void set_header(std::string const & name, std::string const & value);
70 
72  std::string const & get_body() const;
73 
75  void set_body(std::string const & body);
76 
77 private:
78  Headers _headers;
79  std::string _body;
80 
81  Headers::const_iterator _find_header(std::string const & name) const;
82 };
83 
86 std::istream &
87 operator>>(std::istream & stream, Message & message);
88 
91 std::ostream &
92 operator<<(std::ostream & stream, Message const & message);
93 
94 }
95 
96 }
97 
98 #endif // _d7a272d7_9beb_43c1_a5a1_fce4c0245c80
odil::webservices::operator<<
std::ostream & operator<<(std::ostream &stream, HTTPRequest const &request)
Output an HTTP request to a stream.
odil
Definition: Association.h:23
ODIL_API
#define ODIL_API
Definition: odil.h:27
odil.h
odil::webservices::Message::Headers
std::map< std::string, std::string > Headers
Associative container for headers.
Definition: Message.h:44
odil::webservices::Message
RFC 5322 Message (i.e. headers with body).
Definition: Message.h:35
odil::webservices::operator>>
std::istream & operator>>(std::istream &stream, HTTPRequest &request)
Input an HTTP request from a stream.