75 KeywordLocation location;
76 std::size_t record_number;
77 std::optional<std::size_t> item_number;
78 std::optional<std::string> item_value;
79 std::optional<std::string> user_message;
86 std::string get_error_report(
const std::vector<ValidationError>& errors,
101 const PartiallySupportedKeywords<std::string>& string_items,
102 const PartiallySupportedKeywords<int>& int_items,
103 const PartiallySupportedKeywords<double>& double_items,
104 const std::unordered_map<std::string, std::function<
void(
const DeckKeyword& keyword, std::vector<ValidationError>& errors)>>& special_validation)
105 : m_keywords(keywords)
106 , m_string_items(string_items)
107 , m_int_items(int_items)
108 , m_double_items(double_items)
109 , m_special_validation(special_validation)
118 void validateDeck(
const Deck& deck,
119 const ParseContext& parse_context,
120 const bool treat_critical_as_noncritical,
121 ErrorGuard& error_guard)
const;
125 void validateDeckKeyword(
const DeckKeyword& keyword, std::vector<ValidationError>& errors)
const;
128 template <
typename T>
129 void validateKeywordItem(
const DeckKeyword& keyword,
131 const bool multiple_records,
132 const std::size_t record_number,
133 const std::size_t item_number,
135 std::vector<ValidationError>& errors)
const;
138 template <
typename T>
139 void validateKeywordItems(
const DeckKeyword& keyword,
140 const PartiallySupportedKeywords<T>& partially_supported_options,
141 std::vector<ValidationError>& errors)
const;
143 const UnsupportedKeywords m_keywords;
144 const PartiallySupportedKeywords<std::string> m_string_items;
145 const PartiallySupportedKeywords<int> m_int_items;
146 const PartiallySupportedKeywords<double> m_double_items;
147 const std::unordered_map<std::string, std::function<void(
const DeckKeyword& keyword, std::vector<ValidationError>& errors)>> m_special_validation;
156 allow_values(
const std::initializer_list<T>& allowed_values)
158 for (
auto item : allowed_values) {
159 m_allowed_values.push_back(item);
163 bool operator()(
const T& value)
const
165 return std::find(m_allowed_values.begin(), m_allowed_values.end(), value) != m_allowed_values.end();
169 std::vector<T> m_allowed_values;