Implementation of IXmlElement using PugiXML.
More...
#include <PugiXmlImpl.h>
|
| Element (::pugi::xml_node elem) |
| Constructor.
|
|
std::string | getTagName () const override |
| Gets the tag name of the element.
|
|
std::string | getText () const override |
| Gets the text content of the element.
|
|
std::shared_ptr< IXmlAttribute > | getFirstAttribute () const override |
| Gets the first attribute.
|
|
std::shared_ptr< IXmlAttribute > | findAttribute (const std::string &name) const override |
| Finds the first attribute.
|
|
std::shared_ptr< IXmlElement > | getFirstChildElement (const std::string &tagName={}) const override |
| Finds the first child element.
|
|
std::shared_ptr< IXmlElement > | getNextSibling (const std::string &tagName={}) const override |
| Gets the next sibling element.
|
|
std::shared_ptr< IXmlElement > | getPreviousSibling (const std::string &tagName={}) const override |
| Gets the previous sibling element.
|
|
std::shared_ptr< IXmlElement > | getParent () const override |
| Gets the parent element.
|
|
std::string | getTextTrimmed () const |
| Gets the text content of the element with whitespace trimmed.
|
|
template<typename T > |
T | getTextAs (T defaultValue={}) const |
| Gets the text content of the element, converted to the specified type.
|
|
Implementation of IXmlElement using PugiXML.
◆ findAttribute()
std::shared_ptr< IXmlAttribute > musx::xml::pugi::Element::findAttribute |
( |
const std::string & |
name | ) |
const |
|
inlineoverridevirtual |
Finds the first attribute.
- Parameters
-
name | The name of the attribute to find. |
- Returns
- A shared pointer to the attribute, or nullptr if not found.
Implements musx::xml::IXmlElement.
◆ getFirstAttribute()
std::shared_ptr< IXmlAttribute > musx::xml::pugi::Element::getFirstAttribute |
( |
| ) |
const |
|
inlineoverridevirtual |
Gets the first attribute.
- Returns
- A shared pointer to the attribute, or nullptr if not found.
Implements musx::xml::IXmlElement.
◆ getFirstChildElement()
std::shared_ptr< IXmlElement > musx::xml::pugi::Element::getFirstChildElement |
( |
const std::string & |
tagName = {} | ) |
const |
|
inlineoverridevirtual |
Finds the first child element.
- Parameters
-
tagName | [optional] The tag name of the child elements to find. If omitted or empty, finds the first child with any name. |
- Returns
- A shared pointer to the child element, or nullptr if not found.
Implements musx::xml::IXmlElement.
◆ getNextSibling()
std::shared_ptr< IXmlElement > musx::xml::pugi::Element::getNextSibling |
( |
const std::string & |
tagName = {} | ) |
const |
|
inlineoverridevirtual |
Gets the next sibling element.
- Parameters
-
tagName | [optional] The tag name of the sibling elements to find. If omitted or empty, finds the next sibling with any name. |
- Returns
- A shared pointer to the next sibling element, or nullptr if not found.
Implements musx::xml::IXmlElement.
◆ getParent()
std::shared_ptr< IXmlElement > musx::xml::pugi::Element::getParent |
( |
| ) |
const |
|
inlineoverridevirtual |
Gets the parent element.
- Returns
- A shared pointer to the parent element, or nullptr if not applicable.
Implements musx::xml::IXmlElement.
◆ getPreviousSibling()
std::shared_ptr< IXmlElement > musx::xml::pugi::Element::getPreviousSibling |
( |
const std::string & |
tagName = {} | ) |
const |
|
inlineoverridevirtual |
Gets the previous sibling element.
- Parameters
-
tagName | [optional] The tag name of the sibling elements to find. If omitted or empty, finds the previous sibling with any name. |
- Returns
- A shared pointer to the previous sibling element, or nullptr if not found.
Implements musx::xml::IXmlElement.
◆ getTagName()
std::string musx::xml::pugi::Element::getTagName |
( |
| ) |
const |
|
inlineoverridevirtual |
◆ getText()
std::string musx::xml::pugi::Element::getText |
( |
| ) |
const |
|
inlineoverridevirtual |
Gets the text content of the element.
- Returns
- The text content of the element.
Implements musx::xml::IXmlElement.