Caffa  1.1.0
C++ Application Framework for Embedded Systems with introspection
Public Types | Public Member Functions | List of all members
caffa::FieldValidatorInterface Class Referenceabstract

An abstract field validator interface for validating field values. More...

#include <cafFieldValidator.h>

Inheritance diagram for caffa::FieldValidatorInterface:
Inheritance graph
[legend]

Public Types

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

 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...
 

Detailed Description

An abstract field validator interface for validating field values.

Constructor & Destructor Documentation

◆ FieldValidatorInterface()

caffa::FieldValidatorInterface::FieldValidatorInterface ( FailureSeverity  failureSeverity)
inline

Construct a new Field Validator Interface object.

Parameters
failureSeveritythe severity of a validation failure

Member Function Documentation

◆ failureSeverity()

FailureSeverity caffa::FieldValidatorInterface::failureSeverity ( ) const
inline

Get the severity of a failure of the validator.

Returns
FailureSeverity

◆ readFromJson()

virtual void caffa::FieldValidatorInterface::readFromJson ( const nlohmann::json &  jsonFieldObject,
const Serializer serializer 
)
pure virtual

Read the validator from JSON.

Parameters
jsonFieldObjectthe JSON value to read from
serializerthe serializer object

Implemented in caffa::RangeValidator< DataType >.

◆ writeToJson()

virtual void caffa::FieldValidatorInterface::writeToJson ( nlohmann::json &  jsonFieldObject,
const Serializer serializer 
) const
pure virtual

Write the validator to JSON.

Parameters
jsonFieldObjectto JSON value to write to.
serializerthe serializer object

Implemented in caffa::RangeValidator< DataType >.


The documentation for this class was generated from the following file: