MUSX Document Model
Loading...
Searching...
No Matches
musx::factory::HeaderFactory Class Reference

Factory class for creating Header objects from XML. More...

#include <HeaderFactory.h>

+ Inheritance diagram for musx::factory::HeaderFactory:

Static Public Member Functions

static musx::dom::header::HeaderPtr create (const XmlElementPtr &element)
 Creates a Header 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.
 

Detailed Description

Factory class for creating Header objects from XML.

Member Function Documentation

◆ create()

static musx::dom::header::HeaderPtr musx::factory::HeaderFactory::create ( const XmlElementPtr element)
inlinestatic

Creates a Header object from an XML element.

Parameters
elementThe XML element representing the <header> node.
Returns
A fully populated Header object.
Exceptions
std::invalid_argumentIf required nodes or attributes are missing or invalid.