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

◆ claim()

template<typename Source, typename Access = RecordAccess<Source>>
bool MayaFlux::Reflect::AttributeIndex< Source, Access >::claim ( const Source & source,
std::string & error )
inline

Claim the attribute's value for an element.

Parameters
errorReceives a located message when false is returned: the attribute is missing or empty, or another element already holds the value.

Definition at line 51 of file AttributeChecks.hpp.

52 {
54 if (!value || value->empty()) {
56 "<" + std::string(Access::name(source)) + "> needs a non-empty " + m_attribute);
57 return false;
58 }
59 const auto [slot, inserted] = m_claimed.emplace(std::string(*value), Access::location(source));
60 if (!inserted) {
62 m_attribute + " " + std::string(*value) + " is already used at row "
63 + std::to_string(slot->second));
64 return false;
65 }
66 return true;
67 }
The values of one attribute across a tree, each claimed by one element.
std::string located_message(uint64_t location, std::string_view message)
A diagnostic message prefixed with the location of the element it concerns.

References MayaFlux::Reflect::located_message(), m_attribute, and m_claimed.

Here is the call graph for this function: