Class validator

Class Documentation

class validator

The validator class combines all the link, category and item validator classes.

Public Functions

inline validator()

Construct a new validator object.

Parameters

name – The name of the underlying dictionary

inline validator(std::istream &is)

Construct a new validator object.

Parameters
  • name – The name of the underlying dictionary

  • is – The data to parse

~validator() = default

destructor

validator(const validator &rhs)
inline validator(validator &&rhs)

move constructor

inline validator &operator=(validator rhs)
void parse(std::istream &is)

Parse dictionary in is and put content in this validator, optionally extending it.

Parameters

is – The stream containing a valid cif dictionary

void add_type_validator(type_validator &&v)

Add type_validator v to the list of type validators.

const type_validator *get_validator_for_type(std::string_view type_code) const

Return the type validator for type_code, may return nullptr.

void add_category_validator(category_validator &&v)

Add category_validator v to the list of category validators.

const category_validator *get_validator_for_category(std::string_view category) const

Return the category validator for category, may return nullptr.

Add link_validator v to the list of link validators.

Return the list of link validators for which the parent is category.

Return the list of link validators for which the child is category.

inline void report_error(validation_error err, bool fatal = true) const

Bottleneck function to report an error in validation.

void report_error(std::error_code ec, bool fatal = true) const

Bottleneck function to report an error in validation.

inline void report_error(validation_error err, std::string_view category, std::string_view item, bool fatal = true) const

Bottleneck function to report an error in validation.

void report_error(std::error_code ec, std::string_view category, std::string_view item, bool fatal = true) const

Bottleneck function to report an error in validation.

void fill_audit_conform(category &audit_conform) const

Write out the audit_conform data for this validator.

Parameters

audit_conform

bool matches_audit_conform(const category &audit_conform) const

Return true if this validator matches audit_conform.

void append_audit_conform(const std::string &name, const std::optional<std::string> &version)

Add info.

Friends

friend class dictionary_parser
friend class validator_factory
friend void swap(validator &a, validator &b) noexcept