Public Types | Static Public Member Functions | List of all members
SmartMapTools Class Reference

A base class for smart maps providing methods for importing and exporting values, among others. More...

#include <SmartMapTools.h>

Inheritance diagram for SmartMapTools:
Inheritance graph
[legend]
Collaboration diagram for SmartMapTools:
Collaboration graph
[legend]

Public Types

typedef std::list< std::string > keylist_t
 

Static Public Member Functions

template<class M , class V , bool STRICT = true>
static void setValue (M &dst, const std::string &key, const V &value)
 Utility for "guessing" key order. Derived classes will redefine this e.g. for ordered maps. More...
 
template<class M , class V >
static void setValue (M &dst, const std::string &key, const V &value, bool STRICT)
 
template<class M , class V >
static void updateValue (M &dst, const std::string &key, const V &value)
 Set value only if key exists. More...
 
template<class M , class S , bool STRICT = true>
static void setValues (M &dst, const std::map< std::string, S > &srcMap)
 
template<class M , class S , bool STRICT = true>
static void setCastableValues (M &dst, const std::map< std::string, S > &srcMap)
 
template<class M , class S >
static void updateValues (M &dst, const std::map< std::string, S > &src)
 
template<class M , class S >
static void updateCastableValues (M &dst, const std::map< std::string, S > &src)
 
template<class M , bool STRICT = true>
static void setValues (M &dst, const std::list< std::string > &values, char equalSign='=')
 Assign values from list, accepting strict "<key>=<value>" format, no positional arguments. More...
 
template<class M , bool STRICT = true>
static void setValues (M &dst, const std::initializer_list< Variable::init_pair_t > &l)
 
template<class M >
static void updateValues (M &dst, const std::list< std::string > &values, char equals='=')
 Assign values from list, accepting strict "<key>=<value>" format, no positional arguments. More...
 
template<class M , bool STRICT = true>
static void setValues (M &dst, const std::list< std::string > &keys, const std::list< std::string > &entries, char assignmentSymbol='=')
 Assign values from list, accepting keyword arguments <key>=,<key2>=<value2> and positional arguments ,<value2>... . More...
 
template<class M >
static void updateValues (M &dst, const std::list< std::string > &keys, const std::list< std::string > &entries, char equals='=')
 
template<class M , bool STRICT = true>
static void setValues (M &dst, const std::string &values, char split=',', char equals='=')
 Assign values from string, assuming strict "<key>=<value>" format, no positional arguments. More...
 
template<class M >
static void updateValues (M &dst, const std::string &values, char split=',', char equals='=')
 
template<class M , bool STRICT = true>
static void setValues (M &dst, const std::list< std::string > &keys, const std::string &values, char split=',', char equals='=')
 Assign values from string, accepting keyword arguments <key>=,<key2>=<value2> and positional arguments ,<value2>... . More...
 
template<class M >
static void updateValues (M &dst, const std::list< std::string > &keys, const std::string &values, char split=',', char equals='=')
 
template<class M , class V , bool STRICT = true>
static void setValues (M &dst, const std::list< std::string > &keys, std::initializer_list< V > values)
 Assign values from string, accepting keyword arguments <key>=,<key2>=<value2> and positional arguments ,<value2>... . More...
 
template<class M , class V >
static void setValues (M &dst, std::initializer_list< V > values)
 
- Static Public Member Functions inherited from MapTools
template<class M >
static const M::mapped_type & get (const M &m, const typename M::key_type &key)
 If the key is found, the value is returned as a reference. More...
 
template<class M , class F >
static void get (const M &m, const typename M::key_type &key, F &value)
 If the key is found, the value is assigned. More...
 

Detailed Description

A base class for smart maps providing methods for importing and exporting values, among others.

Member Function Documentation

◆ setValue()

static void setValue ( M &  dst,
const std::string &  key,
const V &  value 
)
inlinestatic

Utility for "guessing" key order. Derived classes will redefine this e.g. for ordered maps.

Set value of an element. If not STRICT, set only if key exists ie update.

Template Parameters
M- map type
S- source element type

◆ setValues() [1/7]

static void setValues ( M &  dst,
const std::list< std::string > &  keys,
const std::list< std::string > &  entries,
char  assignmentSymbol = '=' 
)
inlinestatic

Assign values from list, accepting keyword arguments <key>=,<key2>=<value2> and positional arguments ,<value2>... .

Template Parameters
M- map type
STRICT- assign always; create a new entry if key does not exist

\params keys - ordered key list of writable entries of destination map

◆ setValues() [2/7]

static void setValues ( M &  dst,
const std::list< std::string > &  keys,
const std::string &  values,
char  split = ',',
char  equals = '=' 
)
inlinestatic

Assign values from string, accepting keyword arguments <key>=,<key2>=<value2> and positional arguments ,<value2>... .

Template Parameters
M- map type
STRICT- assign always; create a new entry if key does not exist

\params keys - ordered key list of writable entries of destination map

◆ setValues() [3/7]

static void setValues ( M &  dst,
const std::list< std::string > &  keys,
std::initializer_list< V >  values 
)
inlinestatic

Assign values from string, accepting keyword arguments <key>=,<key2>=<value2> and positional arguments ,<value2>... .

Template Parameters
M- map type
V- value type
STRICT- assign always; create a new entry if key does not exist

\params keys - ordered key list of the already existing entries

◆ setValues() [4/7]

static void setValues ( M &  dst,
const std::list< std::string > &  values,
char  equalSign = '=' 
)
inlinestatic

Assign values from list, accepting strict "<key>=<value>" format, no positional arguments.

Template Parameters
M- map type
S- source type
T- destination type

◆ setValues() [5/7]

static void setValues ( M &  dst,
const std::map< std::string, S > &  srcMap 
)
inlinestatic
Template Parameters
S- source map type

◆ setValues() [6/7]

static void setValues ( M &  dst,
const std::string &  values,
char  split = ',',
char  equals = '=' 
)
inlinestatic

Assign values from string, assuming strict "<key>=<value>" format, no positional arguments.

Template Parameters
S- source type
T- destination type
M- map type
STRICT- assign always; create a new entry if key does not exist

\params keys - ordered key list of writable entries of destination map

◆ setValues() [7/7]

static void setValues ( M &  dst,
std::initializer_list< V >  values 
)
inlinestatic
Template Parameters
M- map type
V- value type

\params keys - ordered key list of writable entries of destination map

◆ updateCastableValues()

static void updateCastableValues ( M &  dst,
const std::map< std::string, S > &  src 
)
inlinestatic
Template Parameters
M- map type
S- source type

◆ updateValue()

static void updateValue ( M &  dst,
const std::string &  key,
const V &  value 
)
inlinestatic

Set value only if key exists.

Template Parameters
M- map type
V- value type

◆ updateValues() [1/5]

static void updateValues ( M &  dst,
const std::list< std::string > &  keys,
const std::list< std::string > &  entries,
char  equals = '=' 
)
inlinestatic
Template Parameters
M- map type
STRICT- assign always; create a new entry if key does not exist

\params keys - ordered key list of writable entries of destination map

◆ updateValues() [2/5]

static void updateValues ( M &  dst,
const std::list< std::string > &  keys,
const std::string &  values,
char  split = ',',
char  equals = '=' 
)
inlinestatic
Template Parameters
M- map type
V- value type
STRICT- assign always; create a new entry if key does not exist

\params keys - ordered key list of writable entries of destination map

◆ updateValues() [3/5]

static void updateValues ( M &  dst,
const std::list< std::string > &  values,
char  equals = '=' 
)
inlinestatic

Assign values from list, accepting strict "<key>=<value>" format, no positional arguments.

Template Parameters
M- map type
S- source type
T- destination type

◆ updateValues() [4/5]

static void updateValues ( M &  dst,
const std::map< std::string, S > &  src 
)
inlinestatic
Template Parameters
M- map type
S- source type

◆ updateValues() [5/5]

static void updateValues ( M &  dst,
const std::string &  values,
char  split = ',',
char  equals = '=' 
)
inlinestatic
Template Parameters
M- map type
STRICT- assign always; create a new entry if key does not exist

\params keys - ordered key list of writable entries of destination map


The documentation for this class was generated from the following file: