inlib
1.2.0
|
Public Types | |
typedef std::list< param< K, V > > | list_t |
typedef list_t::iterator | it_t |
typedef list_t::const_iterator | const_it_t |
Public Member Functions | |
params (const K &a_key_not_found, V a_value_not_found) | |
virtual | ~params () |
params (const params &a_from) | |
params & | operator= (const params &a_from) |
void | add (int a_ategory, const K &a_key, const std::string &a_label, const V &a_value, const V &a_default, const V &a_alternative) |
void | remove (const K &a_key) |
void | set_value (const K &a_key, V a_value) |
void | set_all_to_default () |
void | set_category_to_default (int a_ategory) |
void | set_to_default (const K &a_key) |
std::string | label (const K &a_key) const |
bool | category (const K &a_key, int &a_ategory) const |
bool | touched (const K &a_key, bool &a_touched) const |
V | value (const K &a_key) const |
V | default_value (const K &a_key) const |
const K & | key (V a_value) const |
const K & | key_boolean (V a_value) const |
bool | is_key (const K &a_key) const |
const list_t & | list () const |
const K & | key_not_found () const |
V | value_not_found () const |
std::vector< K > | keys () const |
Protected Attributes | |
K | m_key_not_found |
V | m_value_not_found |
list_t | m_list |
typedef list_t::const_iterator inlib::params< K, V >::const_it_t |
typedef list_t::iterator inlib::params< K, V >::it_t |
typedef std::list< param<K,V> > inlib::params< K, V >::list_t |
inlib::params< K, V >::params | ( | const K & | a_key_not_found, |
V | a_value_not_found | ||
) | [inline] |
Definition at line 82 of file params.
:m_key_not_found(a_key_not_found),m_value_not_found(a_value_not_found){}
virtual inlib::params< K, V >::~params | ( | ) | [inline, virtual] |
inlib::params< K, V >::params | ( | const params< K, V > & | a_from | ) | [inline] |
Definition at line 86 of file params.
:m_key_not_found(a_from.m_key_not_found) ,m_value_not_found(a_from.m_value_not_found) ,m_list(a_from.m_list) {}
void inlib::params< K, V >::add | ( | int | a_ategory, |
const K & | a_key, | ||
const std::string & | a_label, | ||
const V & | a_value, | ||
const V & | a_default, | ||
const V & | a_alternative | ||
) | [inline] |
bool inlib::params< K, V >::category | ( | const K & | a_key, |
int & | a_ategory | ||
) | const [inline] |
Definition at line 162 of file params.
{ const_it_t it; for(it=m_list.begin();it!=m_list.end();++it) { if(a_key==(*it).m_key) { a_ategory = (*it).m_category; return true; } } return false; }
V inlib::params< K, V >::default_value | ( | const K & | a_key | ) | const [inline] |
Definition at line 195 of file params.
{ const_it_t it; for(it=m_list.begin();it!=m_list.end();++it) { if(a_key==(*it).m_key) { return (*it).m_default; } } return m_value_not_found; }
bool inlib::params< K, V >::is_key | ( | const K & | a_key | ) | const [inline] |
Definition at line 226 of file params.
{ const_it_t it; for(it=m_list.begin();it!=m_list.end();++it) { if(a_key==(*it).m_key) { return true; } } return false; }
const K& inlib::params< K, V >::key | ( | V | a_value | ) | const [inline] |
Definition at line 205 of file params.
{ const_it_t it; for(it=m_list.begin();it!=m_list.end();++it) { if(a_value==(*it).m_value) { //Need operator==(V,V) return (*it).m_key; } } return m_key_not_found; }
const K& inlib::params< K, V >::key_boolean | ( | V | a_value | ) | const [inline] |
Definition at line 215 of file params.
{ const_it_t it; for(it=m_list.begin();it!=m_list.end();++it) { if( (a_value==(*it).m_default) || (a_value==(*it).m_alternative) ) { //Need operator==(V,V) return (*it).m_key; } } return m_key_not_found; }
const K& inlib::params< K, V >::key_not_found | ( | ) | const [inline] |
Definition at line 238 of file params.
{ return m_key_not_found;}
std::vector<K> inlib::params< K, V >::keys | ( | ) | const [inline] |
Definition at line 242 of file params.
{ std::vector<K> ks; const_it_t it; for(it=m_list.begin();it!=m_list.end();++it) { ks.push_back((*it).m_key); } return ks; }
std::string inlib::params< K, V >::label | ( | const K & | a_key | ) | const [inline] |
Definition at line 152 of file params.
{ const_it_t it; for(it=m_list.begin();it!=m_list.end();++it) { if(a_key==(*it).m_key) { return (*it).m_label; } } return ""; }
const list_t& inlib::params< K, V >::list | ( | ) | const [inline] |
params& inlib::params< K, V >::operator= | ( | const params< K, V > & | a_from | ) | [inline] |
Definition at line 92 of file params.
{ m_key_not_found = a_from.m_key_not_found; m_value_not_found = a_from.m_value_not_found; m_list = a_from.m_list; return *this; }
void inlib::params< K, V >::remove | ( | const K & | a_key | ) | [inline] |
void inlib::params< K, V >::set_all_to_default | ( | ) | [inline] |
void inlib::params< K, V >::set_category_to_default | ( | int | a_ategory | ) | [inline] |
void inlib::params< K, V >::set_to_default | ( | const K & | a_key | ) | [inline] |
void inlib::params< K, V >::set_value | ( | const K & | a_key, |
V | a_value | ||
) | [inline] |
bool inlib::params< K, V >::touched | ( | const K & | a_key, |
bool & | a_touched | ||
) | const [inline] |
Definition at line 173 of file params.
{ const_it_t it; for(it=m_list.begin();it!=m_list.end();++it) { if(a_key==(*it).m_key) { a_touched = (*it).m_touched; return true; } } a_touched = false; return false; }
V inlib::params< K, V >::value | ( | const K & | a_key | ) | const [inline] |
Definition at line 185 of file params.
{ const_it_t it; for(it=m_list.begin();it!=m_list.end();++it) { if(a_key==(*it).m_key) { return (*it).m_value; } } return m_value_not_found; }
V inlib::params< K, V >::value_not_found | ( | ) | const [inline] |
Definition at line 240 of file params.
{ return m_value_not_found;}
K inlib::params< K, V >::m_key_not_found [protected] |
list_t inlib::params< K, V >::m_list [protected] |
V inlib::params< K, V >::m_value_not_found [protected] |