#include <tConfiguration.h>
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 |
Definition at line 221 of file tConfiguration.h.
typedef tTypeToConfig< T >::DUMMYREQUIRED tConfItem< T >::DUMMYREQUIRED |
Definition at line 235 of file tConfiguration.h.
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().
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 }
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().
static void tConfItem< T >::DoWrite | ( | std::ostream & | s, | |
T const & | value, | |||
int * | ||||
) | [inline, static] |
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 }
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 }