NVCollection
NVCollection
#include <icy/collection.h>Subclassed by:
FormWriter,Message
A storage container for a name value collections. This collection can store multiple entries for each name, and it's getters are case-insensitive.
Public Methods
| Return | Name | Description |
|---|---|---|
NVCollection inline | ||
NVCollection inline | ||
NVCollection inline | ||
NVCollection & | operator= | Assigns the name-value pairs of another NVCollection to this one. |
const std::string & | operator[] const | Returns the value of the (first) name-value pair with the given name. |
void | set | Sets the value of the (first) name-value pair with the given name. |
void | add | Adds a new name-value pair with the given name and value. |
void | add | Adds a new name-value pair using move semantics. |
const std::string & | get const | Returns the value of the first name-value pair with the given name. |
const std::string & | get const | Returns the value of the first name-value pair with the given name. If no value with the given name has been found, the defaultValue is returned. |
bool | has const | Returns true if there is at least one name-value pair with the given name. |
ConstIterator | find const | Returns an iterator pointing to the first name-value pair with the given name. |
ConstIterator | begin const | Returns an iterator pointing to the begin of the name-value pair collection. |
ConstIterator | end const | Returns an iterator pointing to the end of the name-value pair collection. |
bool | empty const | Returns true iff the header does not have any content. |
int | size const | Returns the number of name-value pairs in the collection. |
void | erase | Removes all name-value pairs with the given name. |
void | clear | Removes all name-value pairs and their values. |
NVCollection
inline
inline NVCollection()NVCollection
inline
inline NVCollection(const NVCollection & nvc)NVCollection
inline
inline NVCollection(NVCollection && nvc) noexceptoperator=
NVCollection & operator=(const NVCollection & nvc)Assigns the name-value pairs of another NVCollection to this one.
operator[]
const
const std::string & operator[](std::string_view name) constReturns the value of the (first) name-value pair with the given name.
Throws a NotFoundException if the name-value pair does not exist.
set
void set(const std::string & name, const std::string & value)Sets the value of the (first) name-value pair with the given name.
add
void add(const std::string & name, const std::string & value)Adds a new name-value pair with the given name and value.
add
void add(std::string && name, std::string && value)Adds a new name-value pair using move semantics.
get
const
const std::string & get(std::string_view name) constReturns the value of the first name-value pair with the given name.
Throws a NotFoundException if the name-value pair does not exist.
get
const
const std::string & get(std::string_view name, const std::string & defaultValue) constReturns the value of the first name-value pair with the given name. If no value with the given name has been found, the defaultValue is returned.
has
const
bool has(std::string_view name) constReturns true if there is at least one name-value pair with the given name.
find
const
ConstIterator find(std::string_view name) constReturns an iterator pointing to the first name-value pair with the given name.
begin
const
ConstIterator begin() constReturns an iterator pointing to the begin of the name-value pair collection.
end
const
ConstIterator end() constReturns an iterator pointing to the end of the name-value pair collection.
empty
const
bool empty() constReturns true iff the header does not have any content.
size
const
int size() constReturns the number of name-value pairs in the collection.
erase
void erase(std::string_view name)Removes all name-value pairs with the given name.
clear
void clear()Removes all name-value pairs and their values.
Public Types
| Name | Description |
|---|---|
Map | |
Iterator | |
ConstIterator |
Map
std::vector< std::pair< std::string, std::string > > Map()Iterator
Map::iterator Iterator()ConstIterator
Map::const_iterator ConstIterator()Private Attributes
| Return | Name | Description |
|---|---|---|
Map | _map |
_map
Map _map