|
Caffa
1.1.0
C++ Application Framework for Embedded Systems with introspection
|
Simple range validator. More...
#include <cafFieldValidator.h>


Public Types | |
| using | FailureSeverity = FieldValidatorInterface::FailureSeverity |
Public Types inherited from caffa::FieldValidator< DataType > | |
| using | FailureSeverity = FieldValidatorInterface::FailureSeverity |
Public Types inherited from caffa::FieldValidatorInterface | |
| enum class | 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 | readFromJson (const nlohmann::json &jsonFieldObject, const caffa::Serializer &serializer) override |
| Read the validator from JSON. More... | |
| void | writeToJson (nlohmann::json &jsonFieldObject, const caffa::Serializer &serializer) const override |
| Write the validator to JSON. More... | |
| std::pair< bool, std::string > | validate (const DataType &value) const override |
| Validate the value. More... | |
Public Member Functions inherited from caffa::FieldValidator< DataType > | |
| FieldValidator (FailureSeverity failureSeverity=FailureSeverity::VALIDATOR_ERROR) | |
Public Member Functions inherited from caffa::FieldValidatorInterface | |
| 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 JSON.
| jsonFieldObject | the JSON value to read from |
| serializer | the serializer object |
Implements caffa::FieldValidatorInterface.
|
inlineoverridevirtual |
Validate the value.
| value | The value to validate |
Implements caffa::FieldValidator< DataType >.
|
inlineoverridevirtual |
Write the validator to JSON.
| jsonFieldObject | to JSON value to write to. |
| serializer | the serializer object |
Implements caffa::FieldValidatorInterface.