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

◆ instantiate_xml()

std::optional< PlacedInstances > MayaFlux::Portal::Forma::instantiate_xml ( const std::filesystem::path & path,
const XmlTables & tables,
SurfaceMap & surfaces,
std::string & error )
inlinenodiscard

Read an XML file and place it through tables.

Loads the file, takes its root and runs instantiate_document, so the document, its tables and the surfaces the host bound are all a host supplies. Surfaces stay the host's to create, with create_surface, because that is what binds a window and a name.

Parameters
pathThe XML file.
tablesFactories, calls and actions by name.
surfacesSurfaces by the name the document's surface elements use.
errorReceives the reason, with a row for a placement error, when nullopt is returned.
Returns
Each placed instance by id, with its surface and element.

Definition at line 34 of file XmlManifest.hpp.

36{
37 const auto document = IO::XmlDocument::load(path.string(), error);
38 if (!document)
39 return std::nullopt;
40 const auto root = document->root_element();
41 if (!root) {
42 error = "the document has no root element";
43 return std::nullopt;
44 }
45 return instantiate_document(tables, *root, surfaces, error);
46}
static std::shared_ptr< const XmlDocument > load(const std::string &path, std::string &error)
Parse a file into an owning document.
std::optional< PlacedInstances > instantiate_document(const FactoryTable< Source, Access > &table, const Source &root, SurfaceMap &surfaces, std::string &error)
Place every instance of a document through a table.

References instantiate_document(), and MayaFlux::IO::XmlDocument::load().

Here is the call graph for this function: