E-MailRelay
|
A multimap-like container for command-line options and their values. More...
#include <goptionmap.h>
Public Types | |
using | Map = std::multimap< std::string, OptionValue > |
using | value_type = Map::value_type |
using | iterator = Map::iterator |
using | const_iterator = Map::const_iterator |
Public Member Functions | |
void | insert (const Map::value_type &) |
Inserts the key/value pair into the map. More... | |
void | replace (const std::string &key, const std::string &value) |
Replaces all matching values with a single value. More... | |
void | increment (const std::string &key) |
Increments the repeat count for the given entry. More... | |
const_iterator | begin () const |
Returns the begin iterator. More... | |
const_iterator | cbegin () const |
Returns the begin iterator. More... | |
const_iterator | end () const |
Returns the off-the-end iterator. More... | |
const_iterator | cend () const |
Returns the off-the-end iterator. More... | |
const_iterator | find (const std::string &) const |
Finds the map entry with the given key. More... | |
void | clear () |
Clears the map. More... | |
bool | contains (const std::string &) const |
Returns true if the map contains the given key, but ignoring 'off' option-values. More... | |
bool | contains (const char *) const |
Overload taking a c-string. More... | |
std::size_t | count (const std::string &key) const |
Returns the total repeat count for all matching entries. More... | |
std::string | value (const std::string &key, const std::string &default_=std::string()) const |
Returns the matching value, with concatentation into a comma-separated list if multivalued. More... | |
std::string | value (const char *key, const char *default_=nullptr) const |
Overload taking c-strings. More... | |
A multimap-like container for command-line options and their values.
The values are G::OptionValue objects, so they can be valued with a string value or unvalued with an on/off status, and they can have a repeat-count. Normally populated by G::OptionParser.
Definition at line 41 of file goptionmap.h.
using G::OptionMap::const_iterator = Map::const_iterator |
Definition at line 47 of file goptionmap.h.
using G::OptionMap::iterator = Map::iterator |
Definition at line 46 of file goptionmap.h.
using G::OptionMap::Map = std::multimap<std::string,OptionValue> |
Definition at line 44 of file goptionmap.h.
using G::OptionMap::value_type = Map::value_type |
Definition at line 45 of file goptionmap.h.
G::OptionMap::const_iterator G::OptionMap::begin | ( | ) | const |
Returns the begin iterator.
Definition at line 44 of file goptionmap.cpp.
G::OptionMap::const_iterator G::OptionMap::cbegin | ( | ) | const |
Returns the begin iterator.
Definition at line 49 of file goptionmap.cpp.
G::OptionMap::const_iterator G::OptionMap::cend | ( | ) | const |
Returns the off-the-end iterator.
Definition at line 59 of file goptionmap.cpp.
void G::OptionMap::clear | ( | ) |
Clears the map.
Definition at line 69 of file goptionmap.cpp.
bool G::OptionMap::contains | ( | const char * | key | ) | const |
Overload taking a c-string.
Definition at line 74 of file goptionmap.cpp.
bool G::OptionMap::contains | ( | const std::string & | key | ) | const |
Returns true if the map contains the given key, but ignoring 'off' option-values.
Definition at line 79 of file goptionmap.cpp.
std::size_t G::OptionMap::count | ( | const std::string & | key | ) | const |
Returns the total repeat count for all matching entries.
Definition at line 91 of file goptionmap.cpp.
G::OptionMap::const_iterator G::OptionMap::end | ( | ) | const |
Returns the off-the-end iterator.
Definition at line 54 of file goptionmap.cpp.
G::OptionMap::const_iterator G::OptionMap::find | ( | const std::string & | key | ) | const |
Finds the map entry with the given key.
Definition at line 64 of file goptionmap.cpp.
void G::OptionMap::increment | ( | const std::string & | key | ) |
Increments the repeat count for the given entry.
Definition at line 37 of file goptionmap.cpp.
void G::OptionMap::insert | ( | const Map::value_type & | value | ) |
Inserts the key/value pair into the map.
The ordering of values in the map with the same key is in the order of insert()ion.
Definition at line 24 of file goptionmap.cpp.
void G::OptionMap::replace | ( | const std::string & | key, |
const std::string & | value | ||
) |
Replaces all matching values with a single value.
Definition at line 29 of file goptionmap.cpp.
std::string G::OptionMap::value | ( | const char * | key, |
const char * | default_ = nullptr |
||
) | const |
Overload taking c-strings.
Definition at line 100 of file goptionmap.cpp.
std::string G::OptionMap::value | ( | const std::string & | key, |
const std::string & | default_ = std::string() |
||
) | const |
Returns the matching value, with concatentation into a comma-separated list if multivalued.
If there are any on/off option-values matching the key then a single value is returned corresponding to the first one, being G::Str::positive() if 'on' or the supplied default if 'off'.
Definition at line 105 of file goptionmap.cpp.