Base module

NVCollection

A storage container for a name value collections.

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

ReturnNameDescription
NVCollection inline
NVCollection inline
NVCollection inline
NVCollection &operator=Assigns the name-value pairs of another NVCollection to this one.
const std::string &operator[] constReturns the value of the (first) name-value pair with the given name.
voidsetSets the value of the (first) name-value pair with the given name.
voidaddAdds a new name-value pair with the given name and value.
voidaddAdds a new name-value pair using move semantics.
const std::string &get constReturns the value of the first name-value pair with the given name.
const std::string &get 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.
boolhas constReturns true if there is at least one name-value pair with the given name.
ConstIteratorfind constReturns an iterator pointing to the first name-value pair with the given name.
ConstIteratorbegin constReturns an iterator pointing to the begin of the name-value pair collection.
ConstIteratorend constReturns an iterator pointing to the end of the name-value pair collection.
boolempty constReturns true iff the header does not have any content.
intsize constReturns the number of name-value pairs in the collection.
voideraseRemoves all name-value pairs with the given name.
voidclearRemoves all name-value pairs and their values.

NVCollection

inline

inline NVCollection()

NVCollection

inline

inline NVCollection(const NVCollection & nvc)

NVCollection

inline

inline NVCollection(NVCollection && nvc) noexcept

operator=

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) const

Returns 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) const

Returns 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) 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.


has

const

bool has(std::string_view name) const

Returns true if there is at least one name-value pair with the given name.


find

const

ConstIterator find(std::string_view name) const

Returns an iterator pointing to the first name-value pair with the given name.


begin

const

ConstIterator begin() const

Returns an iterator pointing to the begin of the name-value pair collection.


end

const

ConstIterator end() const

Returns an iterator pointing to the end of the name-value pair collection.


empty

const

bool empty() const

Returns true iff the header does not have any content.


size

const

int size() const

Returns 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

NameDescription
Map
Iterator
ConstIterator

Map

std::vector< std::pair< std::string, std::string > > Map()

Iterator

Map::iterator Iterator()

ConstIterator

Map::const_iterator ConstIterator()

Private Attributes

ReturnNameDescription
Map_map

_map

Map _map