tConfItem< T > Class Template Reference

#include <tConfiguration.h>

Inheritance diagram for tConfItem< T >:

Inheritance graph
[legend]
Collaboration diagram for tConfItem< T >:

Collaboration graph
[legend]

List of all members.

Public Types

typedef tTypeToConfig< T >
::DUMMYREQUIRED 
DUMMYREQUIRED

Public Member Functions

 tConfItem (const char *title, const tOutput &help, T &t, callbackFunc *cb=0)
 tConfItem (const char *title, T &t, callbackFunc *cb=0)
virtual ~tConfItem ()
virtual void ReadVal (std::istream &s)
virtual void WriteVal (std::ostream &s)

Static Public Member Functions

static void DoRead (std::istream &s, T &value, int)
static void DoRead (std::istream &s, T &value, int *)
static void DoWrite (std::ostream &s, T const &value, int)
static void DoWrite (std::ostream &s, T const &value, int *)

Protected Member Functions

 tConfItem (T &t)

Protected Attributes

T * target


Detailed Description

template<class T>
class tConfItem< T >

Definition at line 221 of file tConfiguration.h.


Member Typedef Documentation

template<class T>
typedef tTypeToConfig< T >::DUMMYREQUIRED tConfItem< T >::DUMMYREQUIRED

Definition at line 235 of file tConfiguration.h.


Constructor & Destructor Documentation

template<class T>
tConfItem< T >::tConfItem ( T &  t  )  [inline, protected]

Definition at line 225 of file tConfiguration.h.

00225 :tConfItemBase(""),target(&t){};

template<class T>
tConfItem< T >::tConfItem ( const char *  title,
const tOutput help,
T &  t,
callbackFunc *  cb = 0 
) [inline]

Definition at line 227 of file tConfiguration.h.

00228             :tConfItemBase(title,help,cb),target(&t){}

template<class T>
tConfItem< T >::tConfItem ( const char *  title,
T &  t,
callbackFunc *  cb = 0 
) [inline]

Definition at line 230 of file tConfiguration.h.

00231             :tConfItemBase(title,cb),target(&t){}

template<class T>
virtual tConfItem< T >::~tConfItem (  )  [inline, virtual]

Definition at line 233 of file tConfiguration.h.

00233 {}


Member Function Documentation

template<class T>
static void tConfItem< T >::DoRead ( std::istream &  s,
T &  value,
int   
) [inline, static]

Definition at line 238 of file tConfiguration.h.

Referenced by tConfItem< nConfigItemBehavior >::ReadVal().

00239     {
00240         s >> value;
00241     }

Here is the caller graph for this function:

template<class T>
static void tConfItem< T >::DoRead ( std::istream &  s,
T &  value,
int *   
) [inline, static]

Definition at line 244 of file tConfiguration.h.

00245     {
00246         typename tTypeToConfig< T >::TOSTREAM dummy;
00247         s >> dummy;
00248         value = static_cast< T >( dummy );
00249     }

template<class T>
static void tConfItem< T >::DoWrite ( std::ostream &  s,
T const &  value,
int   
) [inline, static]

Definition at line 252 of file tConfiguration.h.

Referenced by tConfItem< nConfigItemBehavior >::WriteVal().

00253     {
00254         s << value;
00255     }

Here is the caller graph for this function:

template<class T>
static void tConfItem< T >::DoWrite ( std::ostream &  s,
T const &  value,
int *   
) [inline, static]

Definition at line 258 of file tConfiguration.h.

00259     {
00260         s << static_cast< typename tTypeToConfig< T >::TOSTREAM >( value );
00261     }

template<class T>
virtual void tConfItem< T >::ReadVal ( std::istream &  s  )  [inline, virtual]

Implements tConfItemBase.

Reimplemented in nConfItemLine, and tConfItemLine.

Definition at line 263 of file tConfiguration.h.

00263                                        {
00264         // eat whitepsace
00265         int c= EatWhitespace(s);
00266 
00267         T dummy( *target );
00268         if (c!='\n' && s && !s.eof() && s.good()){
00269             DoRead( s, dummy, DUMMYREQUIRED() );
00270             if (!s.good() && !s.eof() )
00271             {
00272                 tOutput o;
00273                 o.SetTemplateParameter(1, title);
00274                 o << "$config_error_read";
00275                 con << o;
00276             }
00277             else
00278                 if (dummy!=*target){
00279                     if (!Writable())
00280                     {
00281                         tOutput o;
00282                         o.SetTemplateParameter(1, title);
00283                         o << "nconfig_errror_protected";
00284                         con << "";
00285                     }
00286                     else{
00287                         if (printChange)
00288                         {
00289                             tOutput o;
00290                             o.SetTemplateParameter(1, title);
00291                             o.SetTemplateParameter(2, *target);
00292                             o.SetTemplateParameter(3, dummy);
00293                             o << "$config_value_changed";
00294                             con << o;
00295                         }
00296 
00297                         *target=dummy;
00298                         changed=true;
00299                         ExecuteCallback();
00300                     }
00301                 }
00302         }
00303         else
00304         {
00305             tOutput o;
00306             o.SetTemplateParameter(1, title);
00307             o.SetTemplateParameter(2, *target);
00308             o << "$config_message_info";
00309             con << o;
00310         }
00311 
00312         // read the rest of the line
00313         c=' ';
00314         while (c!='\n' && s.good() && !s.eof()) c=s.get();
00315     }

template<class T>
virtual void tConfItem< T >::WriteVal ( std::ostream &  s  )  [inline, virtual]

Implements tConfItemBase.

Reimplemented in tConfItemLine.

Definition at line 317 of file tConfiguration.h.

Referenced by tConfItemLine::WriteVal().

00317                                         {
00318         DoWrite( s, *target, DUMMYREQUIRED() );
00319     }

Here is the caller graph for this function:


Member Data Documentation

template<class T>
T* tConfItem< T >::target [protected]

Definition at line 223 of file tConfiguration.h.

Referenced by nConfItem< tString >::NetReadVal(), nConfItem< tString >::NetWriteVal(), nConfItem< tString >::OnSaveValue(), tConfItem< nConfigItemBehavior >::ReadVal(), nConfItem< tString >::Set(), and tConfItem< nConfigItemBehavior >::WriteVal().


The documentation for this class was generated from the following file:
Generated on Sat Mar 15 23:55:11 2008 for Armagetron Advanced by  doxygen 1.5.4