inlib  1.2.0
Public Types | Public Member Functions | Protected Attributes
inlib::params< K, V > Class Template Reference

List of all members.

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)
paramsoperator= (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
value (const K &a_key) const
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_tlist () const
const K & key_not_found () const
value_not_found () const
std::vector< K > keys () const

Protected Attributes

m_key_not_found
m_value_not_found
list_t m_list

Detailed Description

template<class K, class V>
class inlib::params< K, V >

Definition at line 76 of file params.


Member Typedef Documentation

template<class K , class V >
typedef list_t::const_iterator inlib::params< K, V >::const_it_t

Definition at line 80 of file params.

template<class K , class V >
typedef list_t::iterator inlib::params< K, V >::it_t

Definition at line 79 of file params.

template<class K , class V >
typedef std::list< param<K,V> > inlib::params< K, V >::list_t

Definition at line 78 of file params.


Constructor & Destructor Documentation

template<class K , class V >
inlib::params< K, V >::params ( const K &  a_key_not_found,
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){}
template<class K , class V >
virtual inlib::params< K, V >::~params ( ) [inline, virtual]

Definition at line 84 of file params.

{}
template<class K , class V >
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)
  {}

Member Function Documentation

template<class K , class V >
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]

Definition at line 99 of file params.

                                                                                                                             {
    m_list.push_back
      (param<K,V>(a_ategory,a_key,a_label,a_value,a_default,a_alternative));
  }
template<class K , class V >
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;
  }
template<class K , class V >
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;
  }
template<class K , class V >
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;
  }
template<class K , class V >
const K& inlib::params< K, V >::key ( 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;
  }
template<class K , class V >
const K& inlib::params< K, V >::key_boolean ( 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;
  }
template<class K , class V >
const K& inlib::params< K, V >::key_not_found ( ) const [inline]

Definition at line 238 of file params.

{ return m_key_not_found;}
template<class K , class V >
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;
  }
template<class K , class V >
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 "";
  }
template<class K , class V >
const list_t& inlib::params< K, V >::list ( ) const [inline]

Definition at line 236 of file params.

{ return m_list;}
template<class K , class V >
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;
  }
template<class K , class V >
void inlib::params< K, V >::remove ( const K &  a_key) [inline]

Definition at line 104 of file params.

                              {
    it_t it;
    for(it=m_list.begin();it!=m_list.end();++it) {
      if(a_key==(*it).m_key) {
        //m_list.remove(*it); //Need a operator==(param,param)
        m_list.erase(it);
        return;
      }
    } 
  }
template<class K , class V >
void inlib::params< K, V >::set_all_to_default ( ) [inline]

Definition at line 126 of file params.

                            {
    it_t it;
    for(it=m_list.begin();it!=m_list.end();++it) {
      (*it).m_value = (*it).m_default;
      (*it).m_touched = false;
    }
  }
template<class K , class V >
void inlib::params< K, V >::set_category_to_default ( int  a_ategory) [inline]

Definition at line 134 of file params.

                                              {
    it_t it;
    for(it=m_list.begin();it!=m_list.end();++it) {
      if((*it).m_category==a_ategory) {
        (*it).m_value = (*it).m_default;
      }
    }
  }
template<class K , class V >
void inlib::params< K, V >::set_to_default ( const K &  a_key) [inline]

Definition at line 143 of file params.

                                      {
    it_t it;
    for(it=m_list.begin();it!=m_list.end();++it) {
      if(a_key==(*it).m_key) {
        (*it).m_value = (*it).m_default;
      }
    }
  }
template<class K , class V >
void inlib::params< K, V >::set_value ( const K &  a_key,
a_value 
) [inline]

Definition at line 115 of file params.

                                           {
    it_t it;
    for(it=m_list.begin();it!=m_list.end();++it) {
      if(a_key==(*it).m_key) {
        (*it).m_value = a_value;
        (*it).m_touched = true;
        return;
      }
    } 
  }
template<class K , class V >
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;
  }
template<class K , class V >
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;
  }
template<class K , class V >
V inlib::params< K, V >::value_not_found ( ) const [inline]

Definition at line 240 of file params.

{ return m_value_not_found;}

Member Data Documentation

template<class K , class V >
K inlib::params< K, V >::m_key_not_found [protected]

Definition at line 252 of file params.

template<class K , class V >
list_t inlib::params< K, V >::m_list [protected]

Definition at line 254 of file params.

template<class K , class V >
V inlib::params< K, V >::m_value_not_found [protected]

Definition at line 253 of file params.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines