#include <val.h>


Definition at line 631 of file val.h.
Public Member Functions | |
| val_Percentage (const string &a_name, const val_Limit a_limits, const UInt32_t a_minNumOfVal=1, const UInt64_t a_maxNumOfVal=cfg_INFINITE, const string &a_defaultStr="") | |
| virtual | ~val_Percentage () |
| virtual string | Validate (const string &a_strVal) |
Private Attributes | |
| log_CLASSID_m | |
| val_Percentage::val_Percentage | ( | const string & | a_name, | |
| const val_Limit | a_limits, | |||
| const UInt32_t | a_minNumOfVal = 1, |
|||
| const UInt64_t | a_maxNumOfVal = cfg_INFINITE, |
|||
| const string & | a_defaultStr = "" | |||
| ) |
Definition at line 813 of file val.cpp.
00819 : val_Integer(a_name, a_limits, a_minNumOfVal, a_maxNumOfVal, a_defaultStr ) { 00820 // Empty 00821 }
| val_Percentage::~val_Percentage | ( | ) | [virtual] |
| string val_Percentage::Validate | ( | const string & | a_strVal | ) | [virtual] |
Reimplemented from val_Value.
Definition at line 828 of file val.cpp.
References ie_NOT_VALID, ivd_Error, and val_Value::m_name.
00828 { 00829 00830 if (a_strVal.length() < 2) { 00831 ostringstream sstr; 00832 sstr 00833 << "Invalid percentage format. String too short. Variable: " << m_name; 00834 00835 throw ivd_Error(ie_NOT_VALID, sstr.str()); 00836 }; 00837 00838 char lastChar = a_strVal[a_strVal.length() - 1]; 00839 switch (lastChar) { 00840 case '%': // % sign detected. OK. 00841 break; 00842 default: 00843 { 00844 ostringstream sstr; 00845 sstr 00846 << "Invalid percentage format. Expected %. Variable: " << m_name 00847 << " = " << a_strVal; 00848 00849 throw ivd_Error(ie_NOT_VALID, sstr.str()); 00850 break; 00851 } 00852 } 00853 return a_strVal.substr(0, a_strVal.length()-1); 00854 }
val_Percentage::log_CLASSID_m [private] |
1.5.6