Caffa
1.1.0
C++ Application Framework for Embedded Systems with introspection
|
Simple range validator. More...
#include <cafRangeValidator.h>
Public Types | |
using | FailureSeverity = FieldValidatorInterface::FailureSeverity |
![]() | |
using | FailureSeverity = FieldValidatorInterface::FailureSeverity |
![]() | |
enum | FailureSeverity { VALIDATOR_WARNING, VALIDATOR_ERROR, VALIDATOR_CRITICAL } |
The severity of failure. Essentially tells the application how to treat a validator failure: VALIDATOR_WARNING -> user warning VALIDATOR_ERROR -> user error VALIDATOR_CRITICAL -> critical application failure. | |
Public Member Functions | |
RangeValidator (DataType minimum, DataType maximum, FailureSeverity failureSeverity=FailureSeverity::VALIDATOR_ERROR) | |
void | readFromString (const std::string &string) override |
Read the validator from string. More... | |
std::string | writeToString () const override |
Write the validator tostring. More... | |
std::pair< bool, std::string > | validate (const DataType &value) const override |
Validate the value. More... | |
![]() | |
FieldValidator (FailureSeverity failureSeverity=FailureSeverity::VALIDATOR_ERROR) | |
![]() | |
FieldValidatorInterface (FailureSeverity failureSeverity) | |
Construct a new Field Validator Interface object. More... | |
FailureSeverity | failureSeverity () const |
Get the severity of a failure of the validator. More... | |
Static Public Member Functions | |
static std::unique_ptr< RangeValidator< DataType > > | create (DataType minimum, DataType maximum, FailureSeverity failureSeverity=FailureSeverity::VALIDATOR_ERROR) |
Simple range validator.
DataType |
|
inlineoverridevirtual |
Read the validator from string.
string | the string to read from |
Implements caffa::FieldValidatorInterface.
|
inlineoverridevirtual |
Validate the value.
value | The value to validate |
Implements caffa::FieldValidator< DataType >.
|
inlineoverridevirtual |
Write the validator tostring.
Implements caffa::FieldValidatorInterface.