Caffa
1.1.0
C++ Application Framework for Embedded Systems with introspection
|
Used to validate the value of data fields Implementations need the the validate method as well as readFromJson and writeToJson. More...
#include <cafFieldValidator.h>
Public Types | |
using | FailureSeverity = FieldValidatorInterface::FailureSeverity |
![]() | |
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 | |
FieldValidator (FailureSeverity failureSeverity=FailureSeverity::VALIDATOR_ERROR) | |
virtual std::pair< bool, std::string > | validate (const DataType &value) const =0 |
Validate the value. More... | |
![]() | |
FieldValidatorInterface (FailureSeverity failureSeverity) | |
Construct a new Field Validator Interface object. More... | |
virtual void | readFromJson (const nlohmann::json &jsonFieldObject, const Serializer &serializer)=0 |
Read the validator from JSON. More... | |
virtual void | writeToJson (nlohmann::json &jsonFieldObject, const Serializer &serializer) const =0 |
Write the validator to JSON. More... | |
FailureSeverity | failureSeverity () const |
Get the severity of a failure of the validator. More... | |
Used to validate the value of data fields Implementations need the the validate method as well as readFromJson and writeToJson.
DataType |
|
pure virtual |
Validate the value.
value | The value to validate |
Implemented in caffa::RangeValidator< DataType >.