MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ overlay_text_fields()

template<Described T, typename Fields>
bool MayaFlux::Reflect::overlay_text_fields ( T & target,
Fields && fields,
std::string_view label,
std::string & error )

Overlay named text values onto a described value.

Parameters
fieldsCallable taking a visitor of (name, text) that returns false to stop.
Note
A failed overlay may have changed earlier members of the target.

Definition at line 47 of file TextBinding.hpp.

49{
50 return overlay_described_fields(target,
51 [&](const auto& visit) {
52 return fields([&](std::string_view name, std::string_view value) {
53 return visit(name, value);
54 });
55 },
56 [&](std::string_view name, std::string_view source, auto& value) {
57 return decode_text_field(name, source, value, label, error);
58 },
59 [&](std::string_view name) {
60 error = "<" + std::string(label) + "> has an unsupported attribute "
61 + std::string(name);
62 return false;
63 });
64}
void error(Component component, Context context, std::source_location location, std::string_view message)
Log an error message and optionally throw an exception.
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.

References decode_text_field(), and overlay_described_fields().

Referenced by MayaFlux::Reflect::RecordBinding< Input, Source, Access >::overlay(), and MayaFlux::Reflect::RecordBinding< Input, Source, Access >::read().

Here is the call graph for this function:
Here is the caller graph for this function: