COMMS
Template library intended to help with implementation of communication protocols.
|
#include "comms/options.h"
Option that specifies custom validation class.
By default, value of every field is considered to be valid (valid() member function of the field returns true). If there is a need to validate the value of the function, use this option to define custom validation logic for the field. The validation class provided as a template argument to this option must define the following member function:
For example, value of the string field considered to be valid if it's not empty and starts with '$' character. The provided validator class with the option will be instantiated and its operator() will be invoked.
Note that in the example above the default constructed MyField will have invalid value. To fix that you must also use comms::option::def::DefaultValueInitialiser option to specify proper default value.
T | Type of the validator class. |