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

◆ decode_xml_attribute()

template<typename T>
bool MayaFlux::IO::decode_xml_attribute ( std::string_view name,
std::string_view source,
T & value,
std::string_view label,
std::string & error )

Definition at line 11 of file XmlAttributeBinding.hpp.

13{
14 if constexpr (XmlTextDecodable<T>) {
16 if (XmlTextCodec<T>::decode(source, value, reason))
17 return true;
18 if (reason == XmlTextError::Cardinality) {
19 error = "<" + std::string(label) + "> needs "
20 + std::to_string(XmlTextCodec<T>::extent) + " numbers in "
21 + std::string(name);
22 } else if (reason == XmlTextError::Unsupported) {
23 error = "<" + std::string(label) + "> has an unsupported "
24 + std::string(name) + " " + std::string(source);
25 } else {
26 error = "<" + std::string(label) + "> has an invalid "
27 + std::string(name) + " attribute";
28 }
29 } else {
30 error = "<" + std::string(label) + "> has an unsupported attribute "
31 + std::string(name);
32 }
33 return false;
34}
void error(Component component, Context context, std::source_location location, std::string_view message)
Log an error message and optionally throw an exception.
Convert XML attribute text to one described member value.

References Cardinality, Invalid, and Unsupported.

Referenced by overlay_xml_attributes().

Here is the caller graph for this function: