10template <Reflect::Described T>
12 std::string& error, uint64_t* error_row =
nullptr);
18template <Reflect::Described T>
21 std::string& error, uint64_t* error_row)
27template <Reflect::Described T>
30 std::string& error, uint64_t* error_row)
35 value.push_back(std::move(item));
40template <Reflect::Described T>
43 std::string& error, uint64_t* error_row)
45 T item = value.value_or(
T {});
48 value = std::move(item);
55 std::string& error, uint64_t* error_row) {
57 -> std::same_as<bool>;
61template <Reflect::Described T>
63 std::string& error, uint64_t* error_row)
66 *error_row = element.
row();
68 [&](
const auto& visit) {
71 *error_row = field.
row;
72 return visit(field.
name, field);
75 [&](std::string_view name,
const XmlFieldView& field,
auto& value) {
76 using Value = std::remove_cvref_t<
decltype(value)>;
81 error =
"<" + std::string(element.
name()) +
"> has an unsupported child <"
82 + std::string(name) +
">";
85 [&](std::string_view name) {
86 error =
"<" + std::string(element.
name()) +
"> has an unsupported field "
std::string_view name() const noexcept
uint64_t row() const noexcept
bool for_each_field(Fn &&visitor) const
Visit attributes and immediate child elements in document order.
Borrowed XML element with named attributes and immediate child elements.
bool overlay_xml_element(T &target, const XmlElementView &element, std::string &error, uint64_t *error_row=nullptr)
Overlay XML attributes and same-named children onto a described value.
bool decode_text_field(std::string_view name, std::string_view source, T &value, std::string_view label, std::string &error)
Decode one authored text value into a described member.
bool overlay_described_fields(T &target, Fields &&fields, Decode &&decode, Unknown &&unknown)
Apply present named fields to a described value.
static bool decode(const XmlElementView &element, T &value, std::string &error, uint64_t *error_row)
static bool decode(const XmlElementView &element, std::optional< T > &value, std::string &error, uint64_t *error_row)
static bool decode(const XmlElementView &element, std::vector< T > &value, std::string &error, uint64_t *error_row)
Decode one XML child element into a described member.
One attribute or immediate child element borrowed from an XML element.