|
MUSX Document Model
|
Factory class for creating Options objects from XML.
More...
#include <PoolFactory.h>
Inheritance diagram for musx::factory::OptionsFactory:Static Public Member Functions | |
| static auto | extractFromXml (const XmlElementPtr &element, const dom::DocumentPtr &document, ElementLinker &elementLinker, const OptionsPoolPtr &pool) |
Extracts an OptionsBase object from an XML element. | |
| static std::shared_ptr< PoolType > | create (const XmlElementPtr &element, const dom::DocumentPtr &document, ElementLinker &elementLinker) |
Creates a OthersPool object from an XML element. | |
Static Public Member Functions inherited from musx::factory::PoolFactory< OptionsFactory, dom::OptionsBase, dom::OptionsPool > | |
| static std::shared_ptr< dom::OptionsPool > | create (const XmlElementPtr &element, const dom::DocumentPtr &document, ElementLinker &elementLinker) |
Creates a OthersPool object from an XML element. | |
Additional Inherited Members | |
Static Protected Member Functions inherited from musx::factory::FactoryBase | |
| template<typename DataType , typename ParserFunc > | |
| static void | getFieldFromXml (const XmlElementPtr &element, const std::string &nodeName, DataType &dataField, ParserFunc parserFunc, bool expected=false) |
| Helper function to check if a child exists and populate it if so. | |
| static XmlElementPtr | getFirstChildElement (const XmlElementPtr &element, const std::string &childElementName) |
| Helper function to throw when child element does not exist. | |
| static std::optional< std::string > | getOptionalChildText (const XmlElementPtr &element, const std::string &childElementName) |
| Helper function to return std::nullopt when child element does not exist. | |
| template<typename T > | |
| static std::optional< T > | getOptionalChildTextAs (const XmlElementPtr &element, const std::string &childElementName, T defaultValue={}) |
| Helper function to return std::nullopt when child element does not exist. | |
Factory class for creating Options objects from XML.
This class specializes PoolFactory to handle the creation of Options objects, which represent various document options stored in a ScalarPool. It includes functionality for extracting and creating these objects from XML elements.
|
inlinestatic |
Creates a OthersPool object from an XML element.
This function creates an object pool by parsing the XML element representing the <others> node. It iterates over each child element of the XML element, extracts relevant information using DerivedType::extractFromXml, and adds the created objects to the pool.
| element | The XML element representing the <others> node. |
| document | The document object providing context for the XML parsing. |
| elementLinker | A class for storing deferred linkage commands. |
ObjectPoolType object.
|
inlinestatic |
Extracts an OptionsBase object from an XML element.
Extracts an OptionsBase derived object from the given XML element by delegating to the RegisteredOptions class. This allows the creation of Options objects from XML.
| element | The XML element from which to extract the object. |
| document | The document object providing context for the XML parsing. |
| elementLinker | The ElementLinker instance that is used to resolve all internal connections after the document is created. |
| pool | The pool we are constructiong. (It hasn't been assigned to document yet.) |