Container that maps case-insensitive header name into header value.
Allows storing up to 24576 name->value pairs, after that an attempt to insert a new pair will throw.
Has an anti-hashdos collisions resolution built-in, and the capacity limit might be lowered in case of an attack being detected.
Iterators/pointers invalidation loosely matches that of std::vector:
- if an insertion took place, iterators/pointers are invalidated;
- successful erase invalidates the iterator being erased and
begin
(it's implemented via swap and pop_back idiom, and begin
is actually an rbegin
of underlying vector).
Definition at line 38 of file header_map.hpp.
|
| HeaderMap () |
| Default constructor.
|
|
| HeaderMap (std::initializer_list< std::pair< std::string_view, std::string_view > > headers) |
|
| HeaderMap (std::size_t capacity) |
|
template<typename InputIt > |
| HeaderMap (InputIt first, InputIt last) |
|
| ~HeaderMap () |
| Destructor.
|
|
| HeaderMap (const HeaderMap &other) |
| Copy constructor.
|
|
| HeaderMap (HeaderMap &&other) noexcept |
| Move constructor.
|
|
HeaderMap & | operator= (const HeaderMap &other) |
| Copy assignment operator.
|
|
HeaderMap & | operator= (HeaderMap &&other) noexcept |
| Move assignment operator.
|
|
void | reserve (std::size_t capacity) |
| Non-binding call to reserve capacity elements for internal storage.
|
|
std::size_t | size () const noexcept |
| Returns the amount of name-value-pairs being stored.
|
|
bool | empty () const noexcept |
| Return true if no name-value-pairs are being stored, false otherwise.
|
|
void | clear () |
|
std::size_t | count (std::string_view key) const noexcept |
| Returns 1 if the key exists, 0 otherwise.
|
|
std::size_t | count (const PredefinedHeader &key) const noexcept |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
|
template<std::size_t Size> |
std::size_t | count (const char(&)[Size]) const noexcept |
|
bool | contains (std::string_view key) const noexcept |
| Returns true if the key exists, false otherwise.
|
|
bool | contains (const PredefinedHeader &key) const noexcept |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
|
template<std::size_t Size> |
bool | contains (const char(&)[Size]) const noexcept |
|
std::string & | operator[] (std::string &&key) |
|
std::string & | operator[] (std::string_view key) |
|
std::string & | operator[] (const PredefinedHeader &key) |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
|
template<std::size_t Size> |
std::string & | operator[] (const char(&)[Size]) |
|
Iterator | find (std::string_view key) noexcept |
|
ConstIterator | find (std::string_view key) const noexcept |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
|
Iterator | find (const PredefinedHeader &key) noexcept |
|
ConstIterator | find (const PredefinedHeader &key) const noexcept |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
|
template<std::size_t Size> |
Iterator | find (const char(&)[Size]) noexcept |
|
template<std::size_t Size> |
ConstIterator | find (const char(&)[Size]) const noexcept |
|
template<typename... Args> |
void | emplace (std::string_view key, Args &&... args) |
|
template<typename... Args> |
void | emplace (std::string key, Args &&... args) |
|
template<typename... Args> |
void | try_emplace (std::string key, Args &&... args) |
|
template<typename InputIt > |
void | insert (InputIt first, InputIt last) |
|
void | insert (const std::pair< std::string, std::string > &kvp) |
|
void | insert (std::pair< std::string, std::string > &&kvp) |
|
void | insert_or_assign (std::string key, std::string value) |
|
void | insert_or_assign (const PredefinedHeader &key, std::string value) |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
|
void | InsertOrAppend (std::string key, std::string value) |
|
void | InsertOrAppend (const PredefinedHeader &key, std::string value) |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
|
Iterator | erase (Iterator it) |
|
Iterator | erase (ConstIterator it) |
|
Iterator | erase (std::string_view key) |
|
Iterator | erase (const PredefinedHeader &key) |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
|
template<std::size_t Size> |
Iterator | erase (const char(&)[Size]) |
|
std::string & | at (std::string_view key) |
|
std::string & | at (const PredefinedHeader &key) |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
|
const std::string & | at (std::string_view key) const |
|
const std::string & | at (const PredefinedHeader &key) const |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
|
template<std::size_t Size> |
std::string & | at (const char(&)[Size]) |
|
template<std::size_t Size> |
const std::string & | at (const char(&)[Size]) const |
|
Iterator | begin () noexcept |
| Returns an iterator to the first name-value-pair being stored.
|
|
ConstIterator | begin () const noexcept |
| Returns an iterator to the first name-value-pair being stored.
|
|
ConstIterator | cbegin () const noexcept |
| Returns an iterator to the first name-value-pair being stored.
|
|
Iterator | end () noexcept |
| Returns an iterator to the end (valid but not dereferenceable).
|
|
ConstIterator | end () const noexcept |
| Returns an iterator to the end (valid but not dereferenceable).
|
|
ConstIterator | cend () const noexcept |
| Returns an iterator to the end (valid but not dereferenceable).
|
|
bool | operator== (const HeaderMap &other) const noexcept |
|
void | OutputInHttpFormat (HeadersString &buffer) const |
|