Base module

NVCollection

A storage container for a name value collections.

#include <icy/collection.h>

class NVCollection

Defined in src/base/include/icy/collection.h:187

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 noexcept
~NVCollection virtual inline
NVCollection &operator=Assigns the name-value pairs of another NVCollection to this one.
NVCollection &operator= noexcept
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()

Defined in src/base/include/icy/collection.h:194


NVCollection

inline

inline NVCollection(const NVCollection & nvc)

Defined in src/base/include/icy/collection.h:198


NVCollection

inline noexcept

inline NVCollection(NVCollection && nvc) noexcept

Defined in src/base/include/icy/collection.h:203


~NVCollection

virtual inline

virtual inline ~NVCollection()

Defined in src/base/include/icy/collection.h:208


operator=

NVCollection & operator=(const NVCollection & nvc)

Defined in src/base/include/icy/collection.h:213

Assigns the name-value pairs of another NVCollection to this one.


operator=

noexcept

NVCollection & operator=(NVCollection && nvc) noexcept

Defined in src/base/include/icy/collection.h:214


operator[]

const

const std::string & operator[](std::string_view name) const

Defined in src/base/include/icy/collection.h:219

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)

Defined in src/base/include/icy/collection.h:222

Sets the value of the (first) name-value pair with the given name.


add

void add(const std::string & name, const std::string & value)

Defined in src/base/include/icy/collection.h:225

Adds a new name-value pair with the given name and value.


add

void add(std::string && name, std::string && value)

Defined in src/base/include/icy/collection.h:228

Adds a new name-value pair using move semantics.


get

const

const std::string & get(std::string_view name) const

Defined in src/base/include/icy/collection.h:233

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

Defined in src/base/include/icy/collection.h:238

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

Defined in src/base/include/icy/collection.h:242

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


find

const

ConstIterator find(std::string_view name) const

Defined in src/base/include/icy/collection.h:246

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


begin

const

ConstIterator begin() const

Defined in src/base/include/icy/collection.h:250

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


end

const

ConstIterator end() const

Defined in src/base/include/icy/collection.h:254

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


empty

const

bool empty() const

Defined in src/base/include/icy/collection.h:257

Returns true iff the header does not have any content.


size

const

int size() const

Defined in src/base/include/icy/collection.h:261

Returns the number of name-value pairs in the collection.


erase

void erase(std::string_view name)

Defined in src/base/include/icy/collection.h:264

Removes all name-value pairs with the given name.


clear

void clear()

Defined in src/base/include/icy/collection.h:267

Removes all name-value pairs and their values.

Public Types

NameDescription
Map
Iterator
ConstIterator

Map

using Map = std::vector< std::pair< std::string, std::string > >

Defined in src/base/include/icy/collection.h:190


Iterator

using Iterator = Map::iterator

Defined in src/base/include/icy/collection.h:191


ConstIterator

using ConstIterator = Map::const_iterator

Defined in src/base/include/icy/collection.h:192

Private Attributes

ReturnNameDescription
Map_map

_map

Map _map

Type: Map

Defined in src/base/include/icy/collection.h:270