proj home

Files   Classes   Functions   Hierarchy  

map_var< T > Class Template Reference

Helper class for commandline. Read in a variable. More...

#include <commandline.h>

Collaboration diagram for map_var< T >:

List of all members.

Public Member Functions

 map_var (T var_, map< string, string > &tbl_, stringc &key)
 An attempt is made to bind the variable named by key to a value passed in the _tbl as a string.
boolc foundGet () const
 Was the bind successful?
T operator() ()
 Get the variable reference.


Detailed Description

template<typename T>
class map_var< T >

Helper class for commandline. Read in a variable.

Definition at line 122 of file commandline.h.


Constructor & Destructor Documentation

template<typename T>
map_var< T >::map_var ( T  var_,
map< string, string > &  tbl_,
stringc key 
) [inline]

An attempt is made to bind the variable named by key to a value passed in the _tbl as a string.

Definition at line 134 of file commandline.h.

00135     : var(var_), tbl(tbl_)
00136   {
00137     map<string,string>::iterator pos = tbl.find(key);
00138     found = (pos!=tbl.end());
00139     if (found)
00140     {
00141       stringstream ss(tbl[key]);
00142       ss >> var;
00143     }
00144   }


Member Function Documentation

template<typename T>
boolc map_var< T >::foundGet (  )  const [inline]

Was the bind successful?

Definition at line 147 of file commandline.h.

Referenced by commandline::mapvar().

00147 { return found; }

template<typename T>
T map_var< T >::operator() (  )  [inline]

Get the variable reference.

Definition at line 149 of file commandline.h.

00149 { return var; }


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

Generated on Fri Mar 4 00:50:04 2011 for Chelton Evans Source by  doxygen 1.5.8