# Struct category_validator

- Defined in File validate.hpp

## Struct Documentation

struct category_validator

  A validator for categories.

  Categories can have a key, a set of items that in combination should be unique.

  Public Functions

  inline bool operator<(const category_validator &rhs) const

    return true if this category sorts before rhs

  void add_item_validator(item_validator &&v)

    Add item_validator v to the list of item validators.

  const item_validator *get_validator_for_item(std::string_view item_name) const

    Return the item_validator for item item_name, may return nullptr.

  const item_validator *get_validator_for_aliased_item(std::string_view item_name) const

    Return the item_validator for an item that has as alias name item_name, may return nullptr.

  Public Members

  std::string m_name

    The name of the category.

  std::vector<std::string> m_keys

    The list of items that make up the key.

  cif::iset m_groups

    The category groups this category belongs to.

  cif::iset m_mandatory_items

    The mandatory items for this category.

  std::set<item_validator> m_item_validators

    The item validators for the items in this category.