8#include <Common/assertion.h>
19 typename NoticeReceiver,
20 bool SHOULD_NOTIFY_REDUNDANT_CLAUSE>
26 NoticeReceiver noticeReceiver)
29 constexpr std::size_t MAX_FIELD_FLAGS = 64;
30 PH_ASSERT_GE(MAX_FIELD_FLAGS, fieldSet.numFields());
33 std::array<bool, MAX_FIELD_FLAGS> isFieldTouched{};
36 for(std::size_t clauseIdx = 0; clauseIdx < clauses.
size();)
40 const auto& clause = clauses[clauseIdx];
41 const auto& fieldIdx = fieldSet.findFieldIndex(clause.type, clause.name);
44 const auto& field = fieldSet[fieldIdx.value()];
45 field.fromSdl(owner, clause, ctx);
47 isFieldTouched[fieldIdx.value()] =
true;
55 if constexpr(SHOULD_NOTIFY_REDUNDANT_CLAUSE)
59 "no matching field for input clause <" + clause.genPrettyName() +
"> "
70 for(std::size_t fieldIdx = 0; fieldIdx < fieldSet.numFields(); ++fieldIdx)
72 if(!isFieldTouched[fieldIdx])
74 const auto& field = fieldSet[fieldIdx];
75 const auto importance = field.getImportance();
76 if(field.isFallbackEnabled())
78 field.ownedValueToDefault(owner);
87 "<" + field.valueToString(owner) +
">",
97 "a clause for value <" + field.genPrettyName() +
"> is required");
109 typename NoticeReceiver>
115 NoticeReceiver noticeReceiver)
122 std::move(noticeReceiver));
std::string genPrettySrcInfo() const
Definition SdlIOContext.cpp:8
Data that SDL input process can rely on.
Definition SdlInputContext.h:19
Error on the SDL input process.
Definition sdl_exceptions.h:22
Definition field_set_op.h:10
void load_fields_from_sdl(Owner &owner, FieldSet &fieldSet, SdlInputClauses &clauses, const SdlInputContext &ctx, NoticeReceiver noticeReceiver=NoOpNoticeReceiver())
Definition field_set_op.ipp:21
void load_fields_from_sdl_with_redundant_clauses(Owner &owner, FieldSet &fieldSet, SdlInputClauses &clauses, const SdlInputContext &ctx, NoticeReceiver noticeReceiver=NoOpNoticeReceiver())
Definition field_set_op.ipp:110
std::string gen_pretty_name(const SdlClass *const clazz)
Generate a human-readable name for the SDL types. These helpers allow input types to be null.
Definition sdl_helpers.cpp:24
Low-level helpers for SDL. Helpers are in an additional sdl namespace.