74 KeywordLocation location;
75 std::size_t record_number;
76 std::optional<std::size_t> item_number;
77 std::optional<std::string> item_value;
78 std::optional<std::string> user_message;
85 std::string get_error_report(
const std::vector<ValidationError>& errors,
100 const PartiallySupportedKeywords<std::string>& string_items,
101 const PartiallySupportedKeywords<int>& int_items,
102 const PartiallySupportedKeywords<double>& double_items,
103 const std::unordered_map<std::string, std::function<
void(
const DeckKeyword& keyword, std::vector<ValidationError>& errors)>>& special_validation)
104 : m_keywords(keywords)
105 , m_string_items(string_items)
106 , m_int_items(int_items)
107 , m_double_items(double_items)
108 , m_special_validation(special_validation)
117 void validateDeck(
const Deck& deck,
118 const ParseContext& parse_context,
119 const bool treat_critical_as_noncritical,
120 ErrorGuard& error_guard)
const;
124 void validateDeckKeyword(
const DeckKeyword& keyword, std::vector<ValidationError>& errors)
const;
127 template <
typename T>
128 void validateKeywordItem(
const DeckKeyword& keyword,
130 const bool multiple_records,
131 const std::size_t record_number,
132 const std::size_t item_number,
134 std::vector<ValidationError>& errors)
const;
137 template <
typename T>
138 void validateKeywordItems(
const DeckKeyword& keyword,
139 const PartiallySupportedKeywords<T>& partially_supported_options,
140 std::vector<ValidationError>& errors)
const;
142 const UnsupportedKeywords m_keywords;
143 const PartiallySupportedKeywords<std::string> m_string_items;
144 const PartiallySupportedKeywords<int> m_int_items;
145 const PartiallySupportedKeywords<double> m_double_items;
146 const std::unordered_map<std::string, std::function<void(
const DeckKeyword& keyword, std::vector<ValidationError>& errors)>> m_special_validation;
155 allow_values(
const std::initializer_list<T>& allowed_values)
157 for (
auto item : allowed_values) {
158 m_allowed_values.push_back(item);
162 bool operator()(
const T& value)
const
164 return std::find(m_allowed_values.begin(), m_allowed_values.end(), value) != m_allowed_values.end();
168 std::vector<T> m_allowed_values;