NLMISC::CVariable< std::string > Class Reference

#include <variable.h>


Public Member Functions

const char * c_str () const
 CVariable (const char *commandName, const char *commandHelp, const std::string &defaultValue, uint nbMeanValue=0, bool useConfigFile=false, void(*cc)(IVariable &var)=NULL)
virtual bool execute (const std::vector< std::string > &args, NLMISC::CLog &log, bool quiet, bool human)
virtual void fromString (const std::string &val, bool human=false)
const std::string & get () const
 operator const char * () const
 operator std::string () const
CVariable< std::string > & operator= (const std::string &val)
void set (const std::string &val)
virtual std::string toString (bool human=false) const

Private Attributes

std::string _Value


Member Function Documentation

const char* NLMISC::CVariable< std::string >::c_str  )  const [inline]
 

Definition at line 403 of file variable.h.

00404         {
00405                 return get().c_str();
00406         }

NLMISC::CVariable< std::string >::CVariable const char *  commandName,
const char *  commandHelp,
const std::string &  defaultValue,
uint  nbMeanValue = 0,
bool  useConfigFile = false,
void(*  cc)(IVariable &var) = NULL
[inline]
 

Definition at line 371 of file variable.h.

References NLMISC::CVariable< T >::set(), uint, and value.

00371                                                                                                                                                                                        :
00372                 IVariable (commandName, commandHelp, "[<value>]", useConfigFile, cc)
00373         {
00374                 set (defaultValue);
00375         }
          

virtual bool NLMISC::CVariable< std::string >::execute const std::vector< std::string > &  args,
NLMISC::CLog log,
bool  quiet,
bool  human
[inline, virtual]
 

Definition at line 425 of file variable.h.

References NLMISC::CLog::displayNL(), NLMISC::fromString(), and NLMISC::toString().

00426         {
00427                 if (args.size () > 1)
00428                         return false;
00429 
00430                 if (args.size () == 1)
00431                 {
00432                         // set the value
00433                         fromString (args[0], human);
00434                 }
00435 
00436                 // display the value
00437                 if (quiet)
00438                 {
00439                         log.displayNL (toString(human).c_str());
00440                 }
00441                 else
00442                 {
00443                         log.displayNL ("Variable %s = %s", _CommandName.c_str(), toString(human).c_str());
00444                 }
00445                 return true;
00446         }

virtual void NLMISC::CVariable< std::string >::fromString const std::string &  val,
bool  human = false
[inline, virtual]
 

Definition at line 377 of file variable.h.

References NLMISC::CVariable< T >::set().

00378         {
00379                 set (val);
00380         }

const std::string& NLMISC::CVariable< std::string >::get  )  const [inline]
 

Definition at line 420 of file variable.h.

00421         {
00422                 return _Value;
00423         }

NLMISC::CVariable< std::string >::operator const char *  )  const [inline]
 

Definition at line 398 of file variable.h.

00399         {
00400                 return get().c_str();
00401         }

NLMISC::CVariable< std::string >::operator std::string  )  const [inline]
 

Definition at line 393 of file variable.h.

References NLMISC::CVariable< T >::get().

00394         {
00395                 return get();
00396         }

CVariable<std::string>& NLMISC::CVariable< std::string >::operator= const std::string &  val  )  [inline]
 

Definition at line 387 of file variable.h.

References NLMISC::CVariable< T >::set().

00388         {
00389                 set (val);
00390                 return *this;
00391         }

void NLMISC::CVariable< std::string >::set const std::string &  val  )  [inline]
 

Definition at line 408 of file variable.h.

00409         {
00410                 _Value = val;
00411                 static bool RecurseSet = false;
00412                 if (ChangeCallback && !RecurseSet)
00413                 {
00414                         RecurseSet = true;
00415                         ChangeCallback(*this);
00416                         RecurseSet = false;
00417                 }
00418         }

virtual std::string NLMISC::CVariable< std::string >::toString bool  human = false  )  const [inline, virtual]
 

Definition at line 382 of file variable.h.

00383         {
00384                 return _Value;
00385         }


Field Documentation

std::string NLMISC::CVariable< std::string >::_Value [private]
 

Definition at line 450 of file variable.h.


The documentation for this class was generated from the following file:
Generated on Tue Mar 16 13:40:47 2004 for NeL by doxygen 1.3.6