limal::ValueCheck Class Reference
Expression chain for checking values.
More...
#include <ValueCheck.hpp>
Inheritance diagram for limal::ValueCheck:
List of all members.
Detailed Description
Expression chain for checking values.
The ValueCheck class allows to construct a simple expression. It contains one or more single checks derived from ValueCheckBase or also sub-expressions, that are combined with And, Or and Not operators.
The check can be evaluated for a value using the isValid() method, showed as string with the explain() method and of course stored in a variable and used to check values multiple times.
ValueCheck check = ValueCheck(
new ValueRegExCheck("^[-]?[0-9]{1,}$")
).And(
ValueCheck(
new ValueIntCheck(Int64(0), Int64(99))
).Or(
new ValueIntCheck(Int64(-5), Int64(5))
).And(
ValueCheck(
new ValueIntCheck(Int64(7), Int64(7))
).Not()
)
);
std::cout << check.explain("42") << endl;
std::cout << check.isValid("-3") << endl;
- See also:
- ValueRegExCheck, ValueIntCheck classes.
Member Enumeration Documentation
Constructor & Destructor Documentation
| limal::ValueCheck::ValueCheck |
( |
|
) |
|
|
|
|
Default constructor. Since it does not contain any check, the isValid() and and explain() will throw an error until a check is assigned using the operator=(). |
|
|
Single check assignment constructor. - Parameters:
-
| check | Pointer to a single check. |
|
| limal::ValueCheck::ValueCheck |
( |
const ValueCheck & |
ref |
) |
|
|
|
|
Check expression copy constructor. - Parameters:
-
| ref | Reference to a check expression. |
|
| virtual limal::ValueCheck::~ValueCheck |
( |
|
) |
[virtual] |
|
|
|
Private constructor used to add the value check reference to the current expression list.
- Parameters:
-
| ref | Reference to a value check. |
| op | Relation to the current or last expression in the list. |
|
Member Function Documentation
|
|
Append a single check to the list of checks using the E_AND relationship operator.
- Parameters:
-
| check | Pointer to a single value check. |
- Returns:
- Reference to the current object.
|
|
|
Append a sub-expression to the list of checks using the E_OR relationship operator.
- Parameters:
-
| ref | Reference to the sub-expression. |
- Returns:
- Reference to the current object.
|
|
|
Decrement the reference counter of the check and delete the object if needed. - Parameters:
-
| ptr | Pointer to a value check. |
|
| virtual blocxx::String limal::ValueCheck::explain |
( |
const blocxx::String & |
value |
) |
const [virtual] |
|
|
|
Returns a string explaining / showing the checks that will be done for the specified string value parameter.
- Parameters:
-
- Returns:
- A string showing the check (list).
Implements limal::ValueCheckBase. |
|
|
Increment the reference counter of the check. - Parameters:
-
| ptr | Pointer to a value check. |
|
| virtual bool limal::ValueCheck::isValid |
( |
const blocxx::String & |
value |
) |
const [virtual] |
|
|
|
Evaluates a the specified string value parameter to a boolean using the single checks and sub-expressions it contains.
- Parameters:
-
| value | The string value to evaluate. |
- Returns:
- The boolean result of the check.
Implements limal::ValueCheckBase. |
|
|
Negate the result of the current expression.
- Note:
- There is no difference between: and Both are negating the complete expression like: Not( (...) And (...) )
- Returns:
- Reference to the current object.
|
|
|
Check expression assignment operator. - Parameters:
-
| ref | Reference to a check expression. |
- Returns:
- Reference to the current object.
|
|
|
Single check assignment operator. - Parameters:
-
| check | Pointer to a single check. |
- Returns:
- Reference to the current object.
|
|
|
Append a single check to the list of checks using the E_OR relationship operator.
- Parameters:
-
| check | Pointer to a single value check. |
- Returns:
- Reference to the current object.
|
|
|
Append a sub-expression to the list of checks using the E_OR relationship operator.
- Parameters:
-
| ref | Reference to the sub-expression. |
- Returns:
- Reference to the current object.
|
Member Data Documentation
|
|
Check relationship operator to the parent check. |
|
|
List of further checks in the chain. |
|
|
Whether to negate the result of the current chain. |
|
|
Pointer to the current (reference counted) check. |
The documentation for this class was generated from the following file:
Generated on Tue Sep 13 01:57:19 2005 for limal by
1.4.4