Libosmium
2.20.0
Fast and flexible C++ library for working with OpenStreetMap data
|
#include <options.hpp>
Public Types | |
using | iterator = option_map::iterator |
using | const_iterator = option_map::const_iterator |
using | value_type = option_map::value_type |
Public Member Functions | |
Options ()=default | |
Options (const std::initializer_list< value_type > &values) | |
void | set (const std::string &key, const std::string &value) |
void | set (const std::string &key, const char *value) |
void | set (const std::string &key, bool value) |
void | set (const std::string &data) |
std::string | get (const std::string &key, const std::string &default_value="") const noexcept |
bool | is_true (const std::string &key) const noexcept |
bool | is_false (const std::string &key) const noexcept |
bool | is_not_false (const std::string &key) const noexcept |
bool | empty () const noexcept |
std::size_t | size () const noexcept |
iterator | begin () noexcept |
iterator | end () noexcept |
const_iterator | begin () const noexcept |
const_iterator | end () const noexcept |
const_iterator | cbegin () const noexcept |
const_iterator | cend () const noexcept |
Private Types | |
using | option_map = std::map< std::string, std::string > |
Private Attributes | |
option_map | m_options |
Stores key=value type options. This class can be used stand-alone or as a base class. Options are stored and retrieved by key using the different set() and get() methods.
Both keys and values are stored as strings. The values "true", "yes", "false", and "no" are interpreted as boolean values in some functions.
You can iterate over all set options. Dereferencing an iterator yields a std::pair of the key and value strings.
using osmium::util::Options::const_iterator = option_map::const_iterator |
using osmium::util::Options::iterator = option_map::iterator |
|
private |
using osmium::util::Options::value_type = option_map::value_type |
|
default |
Construct empty option set.
|
inline |
Construct option set from initializer list:
|
inlinenoexcept |
Returns an iterator to the beginning.
|
inlinenoexcept |
Returns an iterator to the beginning.
|
inlinenoexcept |
Returns an iterator to the beginning.
|
inlinenoexcept |
Returns a iterator to the end.
|
inlinenoexcept |
Is the set of options empty?
|
inlinenoexcept |
Returns an iterator to the end.
|
inlinenoexcept |
Returns an iterator to the end.
|
inlinenoexcept |
Get value of "key" option. If not set, the default_value (or empty string) is returned.
|
inlinenoexcept |
Is this option set to a false value ("false" or "no")? Will return false if the value is unset.
|
inlinenoexcept |
Is this option not set to a false value ("false" or "no")? Will return true if the value is unset.
|
inlinenoexcept |
Is this option set to a true value ("true" or "yes")? Will return false if the value is unset.
|
inline |
Set option from string in the form 'key=value'. If the string contains no equal sign, the whole string is the key and it will be set to "true".
|
inline |
Set option 'key' to 'value'.
|
inline |
Set option 'key' to 'value'.
|
inline |
Set option 'key' to 'value'.
|
inlinenoexcept |
The number of options set.
|
private |