Struct type_validator

Struct Documentation

struct type_validator

For each defined type in a dictionary a type_validator is created.

A type validator can check if the contents of an item are conforming the specification. The check is done using regular expressions.

A type_validator can also be used to compare two values that conform to this type. Comparison is of course based on the primitive type.

Public Functions

type_validator() = delete
type_validator(std::string_view name, DDL_PrimitiveType type, std::string_view rx)

Constructor.

type_validator(const type_validator&) = delete
inline type_validator(type_validator &&rhs)

Copy constructor.

type_validator &operator=(const type_validator&) = delete
inline type_validator &operator=(type_validator &&rhs)

Move constructor.

~type_validator()

Destructor.

inline bool operator<(const type_validator &rhs) const

Return the sorting order.

int compare(std::string_view a, std::string_view b) const

Compare the contents of a and b based on the primitive type of this type. A value of zero indicates the values are equal. Less than zero means a sorts before b and a value larger than zero likewise means the opposite.

Public Members

std::string m_name

The name of the type.

DDL_PrimitiveType m_primitive_type

The primitive_type of the type.

regex_impl *m_rx

The regular expression for the type.