#include <val.h>


This kind of infrastructure ensures that types are checked at compile time as much as possible. Furthermore, it throws an exception at runtime if something unpredicted happens.
Example:
val_String strrule("Name", cfg_Limit(0, 20)); // rule
string str; // target value
strrule.Bind(str); // bind rule to target
strrule.Conv("ABCDEDEF"); // convert string to str through strrule
Conv() does?
If an implementation of Validate() detects invalid input to be converted, it must throw ivd_Error(ie_NOT_VALID).
Conv(low, high) calls only AssignRange(), which uses one of the basic converters to do the conversion of low and high values separately.
cfg_Value is just an interface to all conversion classes.
Templated class val_List is designed to convert a list-type input (e.g. PF_LIST) value to a vector of target values. It uses one of the basic converters to convert each of the input elements to new element in the vector.
Templated class val_Range is designed to convert a range (low, high) input (e.g. PF_RANGE) value to an instance of cfg_Element.
Definition at line 281 of file val.h.
Public Member Functions | |
| val_Value (const string &a_name, const val_Limit a_limits, const UInt64_t a_minNumOfVal=1, const UInt64_t a_maxNumOfVal=cfg_INFINITE) | |
| val_Value (const string &a_name, const val_Limit a_limits, const UInt64_t a_minNumOfVal, const UInt64_t a_maxNumOfVal, const string &a_defaultStr) | |
| virtual | ~val_Value () |
| void | Conv (const string &a_strVal) |
| void | Conv (const string &a_strLow, const string &a_strHigh) |
| This version of Conv() is used by templated class for ranges. | |
| const string & | GetName () const |
| const string & | GetDefault () const |
| const val_Limit | GetLimits () const |
| virtual void | Add (const string &a_strVal) |
| virtual void | AddRange (const string &a_strLow, const string &a_strHigh) |
Public Attributes | |
| UInt32_t | m_numParsed |
| UInt64_t | m_minNumOfVal |
| UInt64_t | m_maxNumOfVal |
| string | m_default |
| bool | m_useDefault |
Protected Member Functions | |
| virtual string | Validate (const string &a_strVal) |
| virtual void | CheckLimits () |
| virtual void | AssignRange (const string &a_strLow, const string &a_strHigh) |
Protected Attributes | |
| string | m_name |
| val_Limit | m_limits |
Private Attributes | |
| log_CLASSID_m | |
| val_Value::val_Value | ( | const string & | a_name, | |
| const val_Limit | a_limits, | |||
| const UInt64_t | a_minNumOfVal = 1, |
|||
| const UInt64_t | a_maxNumOfVal = cfg_INFINITE | |||
| ) |
Definition at line 137 of file val.cpp.
00142 : m_name(a_name), 00143 m_limits(a_limits), 00144 m_numParsed(0), 00145 m_minNumOfVal(a_minNumOfVal), 00146 m_maxNumOfVal(a_maxNumOfVal), 00147 m_default(""), 00148 m_useDefault(false) { 00149 // Empty 00150 }
| val_Value::val_Value | ( | const string & | a_name, | |
| const val_Limit | a_limits, | |||
| const UInt64_t | a_minNumOfVal, | |||
| const UInt64_t | a_maxNumOfVal, | |||
| const string & | a_defaultStr | |||
| ) |
Definition at line 153 of file val.cpp.
00159 : m_name(a_name), 00160 m_limits(a_limits), 00161 m_numParsed(0), 00162 m_minNumOfVal(a_minNumOfVal), 00163 m_maxNumOfVal(a_maxNumOfVal), 00164 m_default(a_defaultStr), 00165 m_useDefault(true) { 00166 // Empty 00167 }
| virtual val_Value::~val_Value | ( | ) | [inline, virtual] |
| void val_Value::Conv | ( | const string & | a_strVal | ) |
Definition at line 169 of file val.cpp.
References val_BasicValue::Assign(), CheckLimits(), and Validate().
Referenced by val_SlotList::Add(), val_List< val_FileNamePattern, string >::AddRange(), val_SlotList::AddRange(), val_Size::Assign(), val_Duration::Assign(), cfg_PMClient::cfg_PMClient(), cfg_PMFileExpiration::cfg_PMFileExpiration(), cfg_RMHost::cfg_RMHost(), cfg_Base::Convert(), ParseDiskMediumVolume(), and bea_DiskVolume::ReparseFiles().
00169 { 00170 string validated = Validate(a_strVal); 00171 Assign(validated); 00172 CheckLimits(); 00173 }


| void val_Value::Conv | ( | const string & | a_strLow, | |
| const string & | a_strHigh | |||
| ) |
This version of Conv() is used by templated class for ranges.
Validate() and CheckLimits() are not called, because they are implicitely called by val_Range::Assign() (temporary converters for basic types do that).
Definition at line 180 of file val.cpp.
References AssignRange().
00180 { 00181 AssignRange(a_strLow, a_strHigh); 00182 }

| const string& val_Value::GetName | ( | void | ) | const [inline] |
Definition at line 307 of file val.h.
Referenced by cfg_Base::Convert().
00307 { 00308 return m_name; 00309 };

| const string& val_Value::GetDefault | ( | ) | const [inline] |
| const val_Limit val_Value::GetLimits | ( | ) | const [inline] |
| virtual void val_Value::Add | ( | const string & | a_strVal | ) | [inline, virtual] |
Implements val_ValueList.
Reimplemented in val_List< CNV, DT >, val_SlotList, val_List< val_StrictString, string >, and val_List< val_FileNamePattern, string >.
Definition at line 317 of file val.h.
References ie_PARSER_ERROR, and ivd_Error.
Referenced by cfg_Base::Convert().
00317 { 00318 throw ivd_Error(ie_PARSER_ERROR, "Undefined member function Add(str)."); 00319 };

| virtual void val_Value::AddRange | ( | const string & | a_strLow, | |
| const string & | a_strHigh | |||
| ) | [inline, virtual] |
Implements val_ValueList.
Reimplemented in val_List< CNV, DT >, val_SlotList, val_FileNamePatternList, val_List< val_StrictString, string >, and val_List< val_FileNamePattern, string >.
Definition at line 320 of file val.h.
References ie_PARSER_ERROR, and ivd_Error.
Referenced by cfg_Base::Convert().
00320 { 00321 throw ivd_Error(ie_PARSER_ERROR, "Undefined member function Add(str, str)."); 00322 };

| virtual string val_Value::Validate | ( | const string & | a_strVal | ) | [inline, protected, virtual] |
Reimplemented in val_Path, val_Duration, val_Size, val_Percentage, val_ObjectName, val_Hostname, val_DbgLevel, val_DbgFlags, and val_FileNamePattern.
Definition at line 328 of file val.h.
Referenced by Conv().

| virtual void val_Value::CheckLimits | ( | ) | [inline, protected, virtual] |
Reimplemented in val_String, and val_Integer.
Definition at line 333 of file val.h.
Referenced by Conv().

| virtual void val_Value::AssignRange | ( | const string & | a_strLow, | |
| const string & | a_strHigh | |||
| ) | [inline, protected, virtual] |
Implements val_RangeValue.
Reimplemented in val_Range< CNV, DT >.
Definition at line 337 of file val.h.
References ie_PARSER_ERROR, and ivd_Error.
Referenced by Conv().
00337 { 00338 throw ivd_Error(ie_PARSER_ERROR, "Undefined member function Assign(str, str)."); 00339 };

string val_Value::m_name [protected] |
Definition at line 339 of file val.h.
Referenced by val_SlotList::Add(), val_SlotList::AddRange(), val_Size::Assign(), val_Duration::Assign(), val_Integer::Assign(), val_Bool::Assign(), val_Integer::CheckLimits(), val_String::CheckLimits(), val_StrictString::CheckSpaces(), val_Path::Validate(), val_FileNamePattern::Validate(), val_Hostname::Validate(), val_ObjectName::Validate(), val_Percentage::Validate(), val_Size::Validate(), and val_Duration::Validate().
val_Limit val_Value::m_limits [protected] |
Definition at line 342 of file val.h.
Referenced by val_SlotList::AddRange(), val_Duration::Assign(), val_Integer::CheckLimits(), and val_String::CheckLimits().
| string val_Value::m_default |
val_Value::log_CLASSID_m [private] |
Reimplemented from val_BasicValue.
Reimplemented in val_String, val_StrictString, val_Path, val_Bool, val_Integer, val_Duration, val_Time, val_Size, val_Percentage, val_ObjectName, val_Hostname, val_CliCommand, val_LibType, val_PoolType, val_MediaFamilyType, val_SysVolLocationType, val_FSType, val_DriveCapab, val_DbgLevel, val_DbgFlags, val_Range< CNV, DT >, val_List< CNV, DT >, val_FileNamePattern, val_List< val_StrictString, string >, and val_List< val_FileNamePattern, string >.
1.5.6