#include <tConfiguration.h>
Public Member Functions | |
tConfItemLine (const char *title, const char *help, tString &s, callbackFunc *cb=0) | |
virtual | ~tConfItemLine () |
tConfItemLine (const char *title, tString &s, callbackFunc *cb=0) | |
virtual void | ReadVal (std::istream &s) |
virtual void | WriteVal (std::ostream &s) |
Definition at line 338 of file tConfiguration.h.
tConfItemLine::tConfItemLine | ( | const char * | title, | |
const char * | help, | |||
tString & | s, | |||
callbackFunc * | cb = 0 | |||
) | [inline] |
Definition at line 340 of file tConfiguration.h.
00341 :tConfItemBase(title,help),tConfItem<tString>(title,help,s,cb){};
virtual tConfItemLine::~tConfItemLine | ( | ) | [inline, virtual] |
tConfItemLine::tConfItemLine | ( | const char * | title, | |
tString & | s, | |||
callbackFunc * | cb = 0 | |||
) | [inline] |
Definition at line 345 of file tConfiguration.h.
00346 :tConfItemBase(title,cb),tConfItem<tString>(title,s){};
void tConfItemLine::ReadVal | ( | std::istream & | s | ) | [virtual] |
Implements tConfItemBase.
Definition at line 868 of file tConfiguration.cpp.
References tConfItemBase::changed, tColoredString::ColorString(), con, tConfItemBase::ExecuteCallback(), tConfItemBase::printChange, tString::ReadLine(), tOutput::SetTemplateParameter(), tConfItem< tString >::target, and tConfItemBase::title.
00868 { 00869 tString dummy; 00870 dummy.ReadLine(s, true); 00871 if(strcmp(dummy,*target)){ 00872 if (printChange) 00873 { 00874 tColoredString oldval; 00875 oldval << *target << tColoredString::ColorString(1,1,1); 00876 tColoredString newval; 00877 newval << dummy << tColoredString::ColorString(1,1,1); 00878 tOutput o; 00879 o.SetTemplateParameter(1, title); 00880 o.SetTemplateParameter(2, oldval); 00881 o.SetTemplateParameter(3, newval); 00882 o << "$config_value_changed"; 00883 con << o; 00884 } 00885 *target=dummy; 00886 changed=true; 00887 00888 ExecuteCallback(); 00889 } 00890 00891 *target=dummy; 00892 }
void tConfItemLine::WriteVal | ( | std::ostream & | s | ) | [virtual] |
Implements tConfItemBase.
Definition at line 895 of file tConfiguration.cpp.
References tString::Len(), tConfItem< tString >::target, and tConfItem< T >::WriteVal().
00895 { 00896 tConfItem<tString>::WriteVal(s); 00897 00898 // double trailing backslash so it is read back as a single backslash, not 00899 // a continued line (HACK: this would actually be the job of the calling function) 00900 if ( target->Len() >= 2 && 00901 target->operator()(target->Len() - 2) == '\\' ) 00902 s << "\\"; 00903 }