Index: src/ch/TTaskConfiguration.h =================================================================== diff -u -N -r1d7d79169d480a02e335b8b0a4919f9c78d58325 -rca046f75806db6693a4b2dc6ddb255f76d0bbc3f --- src/ch/TTaskConfiguration.h (.../TTaskConfiguration.h) (revision 1d7d79169d480a02e335b8b0a4919f9c78d58325) +++ src/ch/TTaskConfiguration.h (.../TTaskConfiguration.h) (revision ca046f75806db6693a4b2dc6ddb255f76d0bbc3f) @@ -23,7 +23,7 @@ #ifndef __TTASKCONFIGURATION_H__ #define __TTASKCONFIGURATION_H__ -class TConfig; +#include "TConfig.h" enum ETaskOptions { @@ -47,6 +47,9 @@ eTO_CreateEmptyFiles, eTO_CreateDirectoriesRelativeToRoot, eTO_IgnoreDirectories, + + // add new elements before this one + eTO_Last }; ///////////////////////////////////////////////////////////////////////////////////////////// @@ -55,19 +58,24 @@ template struct TaskPropData; #define TASK_PROPERTY(enum_id, val_type, val_name, def_value)\ - template<> struct TaskPropData\ + template<> struct TaskPropData : public PropDataBase\ {\ - typedef val_type value_type;\ static value_type GetDefaultValue() { return def_value; }\ static const wchar_t* GetPropertyName() { return val_name; }\ } #define TASK_PROPERTY_MINMAX(enum_id, val_type, val_name, def_value, min_val, max_val)\ - template<> struct TaskPropData\ + template<> struct TaskPropData : public PropDataMinMaxBase\ {\ - typedef val_type value_type;\ static value_type GetDefaultValue() { return def_value; }\ static const wchar_t* GetPropertyName() { return val_name; }\ + static void ValidateRange(value_type& rValue)\ + {\ + if(rValue < (min_val))\ + rValue = (min_val);\ + else if(rValue > (max_val))\ + rValue = (max_val);\ + }\ } TASK_PROPERTY(eTO_UseOnlyDefaultBuffer, bool, _T("Buffer.UseOnlyDefaultBuffer"), false); @@ -99,21 +107,19 @@ template typename TaskPropData::value_type GetTaskPropValue(const TConfig& rConfig) { - typename TaskPropData::value_type tValue; - rConfig.GetValue(TaskPropData::GetPropertyName(), tValue, TaskPropData::GetDefaultValue()); - return tValue; + return rConfig.GetPropValue >(); } template bool GetTaskPropValue(const TConfig& rConfig, typename TaskPropData::value_type& rValue) { - return rConfig.GetValue(TaskPropData::GetPropertyName(), rValue, TaskPropData::GetDefaultValue()); + return rConfig.GetPropValue >(rValue); } template void SetTaskPropValue(TConfig& rConfig, const typename TaskPropData::value_type& rValue) { - rConfig.SetValue(TaskPropData::GetPropertyName(), rValue); + rConfig.SetPropValue >(rValue); } #endif