# Class validator

- Defined in File validate.hpp

## Class Documentation

class validator

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

  Public Functions

  inline validator(std::string_view name)

    Construct a new validator object.

    Parameters:

      name – The name of the underlying dictionary

  ~validator() = default

    destructor

  validator(const validator &rhs) = delete
  validator &operator=(const validator &rhs) = delete
  validator(validator &&rhs) = default

    move constructor

  validator &operator=(validator &&rhs) = default

    move assignment operator

  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.

  void add_link_validator(link_validator &&v)

    Add link_validator v to the list of link validators.

  std::vector<const link_validator*> get_links_for_parent(std::string_view category) const

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

  std::vector<const link_validator*> get_links_for_child(std::string_view category) const

    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.

  inline const std::string &name() const

    Get the name of this validator.

  inline void set_name(const std::string &name)

    Set the name of this validator.

  inline const std::string &version() const

    Get the version of this validator.

  inline void set_version(const std::string &version)

    Set the version of this validator.

  Friends

  friend class dictionary_parser