IOLink  IOL_v1.1.0_release
HTTPHeaders.h
1 #pragma once
2 
3 #include <array>
4 #include <initializer_list>
5 #include <string>
6 
7 #include <iolink/IOLinkAPI.h>
8 
9 namespace iolink
10 {
11 
15 class IOLINK_API HTTPHeaders
16 {
17 public:
21  struct Entry
22  {
23  std::string name;
24  std::string value;
25  };
26 
30  HTTPHeaders();
31 
38  HTTPHeaders(const Entry* values, size_t count);
39 
43  HTTPHeaders(std::initializer_list<Entry> init);
44 
45  HTTPHeaders(const HTTPHeaders& other);
46  HTTPHeaders& operator=(const HTTPHeaders& other);
47 
48  HTTPHeaders(HTTPHeaders&& other) noexcept;
49  HTTPHeaders& operator=(HTTPHeaders&& other) noexcept;
50 
51  ~HTTPHeaders();
52 
56  size_t size() const;
57 
61  Entry at(size_t i) const;
62 
66  inline Entry operator[](size_t i) const { return at(i); }
67 
71  void add(const Entry& entry);
72 
76  inline void add(const std::string& name, const std::string& value) { add(Entry{name, value}); }
77 
78 private:
79  class Private;
80  Private* m_private;
81 };
82 
83 } // namespace iolink
iolink::HTTPHeaders::Entry
An entry of the HTTP header set.
Definition: HTTPHeaders.h:21