| IOLink 1.11.0

Loading...
Searching...
No Matches
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 explicit 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
A class used to pass HTTP headers as input of factories methods.
Definition HTTPHeaders.h:16
iolink::HTTPHeaders::size
size_t size() const
Return the number of entries in this headers set.
iolink::HTTPHeaders::HTTPHeaders
HTTPHeaders(std::initializer_list< Entry > init)
Initialize headers from an initializer list.
iolink::HTTPHeaders::HTTPHeaders
HTTPHeaders(const Entry *values, size_t count)
Initialize the headers from an array of entries.
iolink::HTTPHeaders::operator[]
Entry operator[](size_t i) const
Return the element at the given index.
Definition HTTPHeaders.h:66
iolink::HTTPHeaders::HTTPHeaders
HTTPHeaders()
Create an empty set of headers.
iolink::HTTPHeaders::at
Entry at(size_t i) const
Return the element at the given index.
iolink::HTTPHeaders::add
void add(const std::string &name, const std::string &value)
Add a new entry in the hedaer set by giving its name and value.
Definition HTTPHeaders.h:76
iolink::HTTPHeaders::add
void add(const Entry &entry)
Add a new entry in the header set.
iolink
All IOLink symbols are enclosed in this namespace.
Definition ArrayX.h:8
iolink::HTTPHeaders::Entry
An entry of the HTTP header set.
Definition HTTPHeaders.h:22