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

◆ read_template()

template<typename Source, typename Access>
bool MayaFlux::Portal::Forma::Detail::DocumentWalk< Source, Access >::read_template ( const Source & definition)
inlineprivate

Definition at line 344 of file Instantiate.hpp.

345 {
347 return false;
348 const auto id = claim_id(definition);
349 if (!id)
350 return false;
351
353 size_t count = 0;
355 if (!factory_element)
356 factory_element.emplace(child);
357 ++count;
358 return true;
359 });
360 if (count != 1)
361 return fail(definition, "<template> needs exactly one factory element");
362
363 const auto name = Access::name(*factory_element);
364 if (!m_table.contains(name))
365 return fail(*factory_element, "no registered factory " + std::string(name));
366 m_templates.emplace(*id, *factory_element);
367 return true;
368 }
std::optional< std::string > claim_id(const Source &source)
bool only_attributes(const Source &source, std::initializer_list< std::string_view > allowed, std::string_view allowed_prefix={})
bool fail(const Source &at, std::string message)
std::unordered_map< std::string, Source > m_templates

References claim_id(), fail(), m_table, m_templates, only_attributes(), and MayaFlux::Portal::Forma::reserved_id_attribute.

Referenced by read_templates().

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