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

◆ decode_parameter()

template<auto Function, typename Source, typename Access, size_t Index, typename Values>
bool MayaFlux::Portal::Forma::Detail::decode_parameter ( const Source & call,
Values & values,
std::array< bool, std::tuple_size_v< Values > > & given,
std::string & error )

Definition at line 62 of file CallTable.hpp.

64 {
66 using Parameter = std::tuple_element_t<Index, Values>;
67
68 const auto text = Access::attribute(call, Description::parameters[Index]);
69 if (!text)
70 return true;
73 if (!Reflect::TextCodec<Parameter>::decode(*text, std::get<Index>(values), reason)) {
74 error = Reflect::located_message(Access::location(call),
75 "<" + std::string(Access::name(call)) + "> has an invalid " + std::string(Description::parameters[Index])
76 + " of " + std::string(*text));
77 return false;
78 }
79 given[Index] = true;
80 return true;
81 } else {
82 error = Reflect::located_message(Access::location(call),
83 std::string(Description::parameters[Index]) + " of " + std::string(Description::name)
84 + " cannot be written in a document");
85 return false;
86 }
87 }
std::string located_message(uint64_t location, std::string_view message)
A diagnostic message prefixed with the location of the element it concerns.
The parameter names of a described function, which C++ cannot supply itself.
Definition Describe.hpp:52
Conversion of authored text to one value type.
Definition TextCodec.hpp:81

References MayaFlux::Reflect::Invalid, and MayaFlux::Reflect::located_message().

Referenced by call_described().

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