#include <nConfig.h>
Public Member Functions | |
nConfItem (const char *title, const char *help, T &t) | |
virtual | ~nConfItem () |
virtual void | NetReadVal (nMessage &m) |
virtual void | NetWriteVal (nMessage &m) |
void | Set (const T &newval) |
virtual void | OnRevertToDefaults () |
revert this setting to its default | |
virtual void | OnSaveValue () |
saves value for later restoring | |
virtual void | OnRevertToSavedValue () |
reverts to the saved value | |
Protected Member Functions | |
nConfItem (T &t) | |
Private Member Functions | |
void | WasChanged () |
Private Attributes | |
T | default_ |
default value | |
T | saved_ |
a saved value |
Definition at line 111 of file nConfig.h.
Definition at line 117 of file nConfig.h.
00118 :tConfItemBase(""), tConfItem<T>("", t),default_(t),saved_(t){}
nConfItem< T >::nConfItem | ( | const char * | title, | |
const char * | help, | |||
T & | t | |||
) | [inline] |
Definition at line 121 of file nConfig.h.
00122 :tConfItem<T>(t), 00123 tConfItemBase(title, help ), 00124 default_(t), 00125 saved_(t){}
Implements nConfItemBase.
Definition at line 129 of file nConfig.h.
00129 { 00130 T dummy; 00131 m >> dummy; 00132 if (sn_compare(dummy,*this->target)){ 00133 if (printChange) 00134 { 00135 tOutput o; 00136 o.SetTemplateParameter(1, title); 00137 o.SetTemplateParameter(2, *this->target); 00138 o.SetTemplateParameter(3, dummy); 00139 o << "$nconfig_value_changed"; 00140 con << con.ColorString(1,.3,.3) << o; 00141 } 00142 *this->target=dummy; 00143 this->ExecuteCallback(); 00144 changed=true; 00145 } 00146 }
Implements nConfItemBase.
Definition at line 148 of file nConfig.h.
00148 { 00149 m << *this->target; 00150 }
void nConfItem< T >::Set | ( | const T & | newval | ) | [inline] |
Definition at line 152 of file nConfig.h.
Referenced by nConfItem< tString >::OnRevertToDefaults(), nConfItem< tString >::OnRevertToSavedValue(), and gCycle::SetWallsStayUpDelay().
00153 { 00154 bool changed = ( newval != *this->target ); 00155 *this->target = newval; 00156 00157 if ( changed ) 00158 { 00159 WasChanged(); 00160 } 00161 }
virtual void nConfItem< T >::OnRevertToDefaults | ( | ) | [inline, virtual] |
revert this setting to its default
Implements nConfItemBase.
Definition at line 163 of file nConfig.h.
virtual void nConfItem< T >::OnSaveValue | ( | ) | [inline, virtual] |
virtual void nConfItem< T >::OnRevertToSavedValue | ( | ) | [inline, virtual] |
void nConfItem< T >::WasChanged | ( | ) | [inline, private, virtual] |
Reimplemented from tConfItemBase.
Definition at line 178 of file nConfig.h.
Referenced by nConfItem< tString >::Set().
00179 { 00180 nConfItemBase::WasChanged( ! (*this->target == default_) ); 00181 }
default value
Definition at line 183 of file nConfig.h.
Referenced by nConfItem< tString >::OnRevertToDefaults(), and nConfItem< tString >::WasChanged().
a saved value
Definition at line 184 of file nConfig.h.
Referenced by nConfItem< tString >::OnRevertToSavedValue(), and nConfItem< tString >::OnSaveValue().