|
BPMN-OS
BPMN for optimization and simulation
|
A class representing a node in an XML-tree. More...
The XMLObject class allows to read and store an XML-tree. The root element can be created using
Each object has the following members:
Derived classes with dedicated members for attributes and children are automatically generated by schematic++ according to respective XML schema definition(s).
Each XMLObject can be converted to a string using stringify() and printed to an output stream using operator<<(std::ostream& os, const XMLObject* obj) and operator<<(std::ostream& os, const XMLObject& obj) .
Definition at line 115 of file XMLObject.h.
#include <bpmn++.h>
Public Member Functions | |
| virtual | ~XMLObject () |
| template<typename T > | |
| T * | is () |
| Returns a pointer of type T of the object. | |
| template<typename T > | |
| const T * | is () const |
| template<typename T > | |
| T * | get () |
| Attempt to cast the current instance to the specified type T. | |
| template<typename T > | |
| const T * | get () const |
| Attempt to cast the current instance to the specified type T. | |
| template<typename T > | |
| std::vector< std::reference_wrapper< T > > | find () |
| Find all descendants of type T. | |
| template<typename T > | |
| std::vector< std::reference_wrapper< const T > > | find () const |
| Find all descendants of type T. | |
| std::string | stringify () const |
| Convert the XMLObject and its children to a string representation. | |
| std::string | format (std::string indentation="\t", unsigned int depth=0) const |
| Creates formated string representing the XMLObject including its children. | |
| template<typename T > | |
| T & | getRequiredChild () |
| Get a required child of type T. | |
| template<typename T > | |
| std::optional< std::reference_wrapper< T > > | getOptionalChild () |
| Get an optional child of type T. | |
| template<typename T > | |
| std::vector< std::reference_wrapper< T > > | getChildren () |
| Get all children of type T. | |
| XMLObject & | getRequiredChildByName (const ElementName &elementName) |
| Get a required child with the specified element name. | |
| std::optional< std::reference_wrapper< XMLObject > > | getOptionalChildByName (const ElementName &elementName) |
| Get the optional child with the specified element name. | |
| std::vector< std::reference_wrapper< XMLObject > > | getChildrenByName (const ElementName &elementName) |
| Get all children with the specified element name. | |
| Attribute & | getRequiredAttributeByName (const AttributeName &attributeName) |
| Get a required attribute with the specified attribute name. | |
| std::optional< std::reference_wrapper< Attribute > > | getOptionalAttributeByName (const AttributeName &attributeName) |
| Get an optional attribute with the specified attribute name. | |
| virtual | ~XMLObject () |
| template<typename T > | |
| T * | is () |
| Returns a pointer of type T of the object. | |
| template<typename T > | |
| const T * | is () const |
| template<typename T > | |
| T * | get () |
| Attempt to cast the current instance to the specified type T. | |
| template<typename T > | |
| const T * | get () const |
| Attempt to cast the current instance to the specified type T. | |
| template<typename T > | |
| std::vector< std::reference_wrapper< T > > | find () |
| Find all descendants of type T. | |
| template<typename T > | |
| std::vector< std::reference_wrapper< const T > > | find () const |
| Find all descendants of type T. | |
| std::string | stringify () const |
| Convert the XMLObject and its children to a string representation. | |
| std::string | format (std::string indentation="\t", unsigned int depth=0) const |
| Creates formated string representing the XMLObject including its children. | |
| template<typename T > | |
| T & | getRequiredChild () |
| Get a required child of type T. | |
| template<typename T > | |
| std::optional< std::reference_wrapper< T > > | getOptionalChild () |
| Get an optional child of type T. | |
| template<typename T > | |
| std::vector< std::reference_wrapper< T > > | getChildren () |
| Get all children of type T. | |
| XMLObject & | getRequiredChildByName (const ElementName &elementName) |
| Get a required child with the specified element name. | |
| std::optional< std::reference_wrapper< XMLObject > > | getOptionalChildByName (const ElementName &elementName) |
| Get the optional child with the specified element name. | |
| std::vector< std::reference_wrapper< XMLObject > > | getChildrenByName (const ElementName &elementName) |
| Get all children with the specified element name. | |
| Attribute & | getRequiredAttributeByName (const AttributeName &attributeName) |
| Get a required attribute with the specified attribute name. | |
| std::optional< std::reference_wrapper< Attribute > > | getOptionalAttributeByName (const AttributeName &attributeName) |
| Get an optional attribute with the specified attribute name. | |
Static Public Member Functions | |
| static XMLObject * | createFromStream (std::istream &xmlStream) |
| Create an XMLObject from the input stream. | |
| static XMLObject * | createFromString (const std::string &xmlString) |
| Create an XMLObject from a string representation of XML. | |
| static XMLObject * | createFromFile (const std::string &filename) |
| Create an XMLObject from an XML file. | |
| static XMLObject * | createFromStream (std::istream &xmlStream) |
| Create an XMLObject from the input stream. | |
| static XMLObject * | createFromString (const std::string &xmlString) |
| Create an XMLObject from a string representation of XML. | |
| static XMLObject * | createFromFile (const std::string &filename) |
| Create an XMLObject from an XML file. | |
Public Attributes | |
| Namespace | xmlns |
| const ClassName | className |
| Namespace | prefix |
| ElementName | elementName |
| TextContent | textContent |
| Textual content of XML element without children. | |
| Children | children |
| Child nodes of the XML element. | |
| Attributes | attributes |
Static Public Attributes | |
| static const Attributes | defaults = {} |
| Attributes of the XML element. | |
Protected Member Functions | |
| XMLObject (const Namespace &xmlns, const ClassName &className, const xercesc::DOMElement *element, const Attributes &defaultAttributes) | |
| XMLObject (const Namespace &xmlns, const ClassName &className, const xercesc::DOMElement *element, const Attributes &defaultAttributes) | |
Static Protected Member Functions | |
| static XMLObject * | createObject (const xercesc::DOMElement *element) |
| static XMLObject * | createObject (const xercesc::DOMElement *element) |
Static Protected Attributes | |
| static Factory | factory |
Friends | |
| template<typename T > | |
| XMLObject * | createInstance (const Namespace &xmlns, const ClassName &className, const xercesc::DOMElement *element) |
| Template function used to store in factory. | |
| template<typename T > | |
| XMLObject * | createInstance (const Namespace &xmlns, const ClassName &className, const xercesc::DOMElement *element) |
| Template function used to store in factory. | |
|
protected |
Definition at line 123 of file XMLObject.cpp.
|
inlinevirtual |
Definition at line 145 of file XMLObject.h.
|
protected |
|
static |
| filename | The path to the XML file. |
| std::runtime_error | if loading the file or parsing the XML fails. |
|
static |
| filename | The path to the XML file. |
| std::runtime_error | if loading the file or parsing the XML fails. |
Definition at line 80 of file XMLObject.cpp.
|
static |
| xmlStream | The input stream containing the XML data. |
| std::runtime_error | if parsing the XML fails. |
|
static |
| xmlStream | The input stream containing the XML data. |
| std::runtime_error | if parsing the XML fails. |
Definition at line 46 of file XMLObject.cpp.
|
static |
| xmlString | The string containing the XML data. |
| std::runtime_error | if parsing the XML fails. |
|
static |
| xmlString | The string containing the XML data. |
| std::runtime_error | if parsing the XML fails. |
Definition at line 74 of file XMLObject.cpp.
|
staticprotected |
|
staticprotected |
Definition at line 113 of file XMLObject.cpp.
|
inline |
Definition at line 222 of file XMLObject.h.
|
inline |
|
inline |
Definition at line 235 of file XMLObject.h.
|
inline |
| std::string XML::XMLObject::format | ( | std::string | indentation = "\t", |
| unsigned int | depth = 0 ) const |
| std::string XML::XMLObject::format | ( | std::string | indentation = "\t", |
| unsigned int | depth = 0 ) const |
Definition at line 222 of file XMLObject.cpp.
|
inline |
| std::runtime_error | if the cast fails. |
Definition at line 171 of file XMLObject.h.
|
inline |
|
inline |
| std::runtime_error | if the cast fails. |
Definition at line 184 of file XMLObject.h.
|
inline |
|
inline |
Definition at line 301 of file XMLObject.h.
|
inline |
| std::vector< std::reference_wrapper< XMLObject > > XML::XMLObject::getChildrenByName | ( | const ElementName & | elementName | ) |
| elementName | The name of the child elements without namespace prefix. |
| std::vector< std::reference_wrapper< XMLObject > > XML::XMLObject::getChildrenByName | ( | const ElementName & | elementName | ) |
| elementName | The name of the child elements without namespace prefix. |
Definition at line 177 of file XMLObject.cpp.
| std::optional< std::reference_wrapper< Attribute > > XML::XMLObject::getOptionalAttributeByName | ( | const AttributeName & | attributeName | ) |
| attributeName | The name of the attribute without namespace prefix. |
std::nullopt if the optional attribute is not found. | std::optional< std::reference_wrapper< Attribute > > XML::XMLObject::getOptionalAttributeByName | ( | const AttributeName & | attributeName | ) |
| attributeName | The name of the attribute without namespace prefix. |
std::nullopt if the optional attribute is not found. Definition at line 197 of file XMLObject.cpp.
|
inline |
std::nullopt if the optional child is not found. Definition at line 287 of file XMLObject.h.
|
inline |
| std::optional< std::reference_wrapper< XMLObject > > XML::XMLObject::getOptionalChildByName | ( | const ElementName & | elementName | ) |
| elementName | The name of the child element without namespace prefix. |
std::nullopt if the optional child is not found. | std::optional< std::reference_wrapper< XMLObject > > XML::XMLObject::getOptionalChildByName | ( | const ElementName & | elementName | ) |
| elementName | The name of the child element without namespace prefix. |
std::nullopt if the optional child is not found. Definition at line 168 of file XMLObject.cpp.
| Attribute & XML::XMLObject::getRequiredAttributeByName | ( | const AttributeName & | attributeName | ) |
| attributeName | The name of the attribute without namespace prefix. |
| std::runtime_error | if the required attribute is not found. |
| Attribute & XML::XMLObject::getRequiredAttributeByName | ( | const AttributeName & | attributeName | ) |
| attributeName | The name of the attribute without namespace prefix. |
| std::runtime_error | if the required attribute is not found. |
Definition at line 187 of file XMLObject.cpp.
|
inline |
| std::runtime_error | if the required child is not found. |
Definition at line 272 of file XMLObject.h.
|
inline |
| XMLObject & XML::XMLObject::getRequiredChildByName | ( | const ElementName & | elementName | ) |
| elementName | The name of the child element without namespace prefix. |
| std::runtime_error | if the required child is not found. |
| XMLObject & XML::XMLObject::getRequiredChildByName | ( | const ElementName & | elementName | ) |
| elementName | The name of the child element without namespace prefix. |
| std::runtime_error | if the required child is not found. |
Definition at line 159 of file XMLObject.cpp.
|
inline |
Definition at line 158 of file XMLObject.h.
|
inline |
Definition at line 162 of file XMLObject.h.
|
inline |
| std::string XML::XMLObject::stringify | ( | ) | const |
| std::string XML::XMLObject::stringify | ( | ) | const |
Definition at line 207 of file XMLObject.cpp.
| Attributes XML::XMLObject::attributes |
|
inlinestatic |
| ElementName XML::XMLObject::elementName |
|
inlinestaticprotected |
| TextContent XML::XMLObject::textContent |