|
FERS 0.1.0
The Flexible Extensible Radar Simulator
|
Class representing a node in an XML document. More...
#include "libxml_wrapper.h"
Public Member Functions | |
| XmlElement (xmlNodePtr node) | |
| Constructor for XmlElement. | |
| XmlElement (const XmlElement &)=default | |
| XmlElement (XmlElement &&) noexcept=default | |
| XmlElement & | operator= (const XmlElement &)=default |
| XmlElement & | operator= (XmlElement &&) noexcept=default |
| ~XmlElement ()=default | |
| std::string | name () const |
| Get the name of the XML element. | |
| std::string | getText () const |
| Get the text content of the XML element. | |
| void | setText (const std::string_view text) const |
| Set the text content of the XML element. | |
| void | setAttribute (const std::string_view name, const std::string_view value) const |
| Set an attribute on the XML element. | |
| XmlElement | addChild (const std::string_view name) const |
| Add a child element to the current node. | |
| XmlElement | childElement (const std::string_view name="", const unsigned index=0) const noexcept |
| Retrieve a child element by name and index. | |
| bool | isValid () const noexcept |
| Check if the XML element is valid. | |
| xmlNodePtr | getNode () const noexcept |
| Get the underlying XML node pointer. | |
Static Public Member Functions | |
| static XmlElement | create (const std::string_view name) |
| Create a new XML element by name. | |
| static std::string | getSafeAttribute (const XmlElement &element, const std::string_view name) |
| Get the value of an attribute safely. | |
| static std::optional< std::string > | getOptionalAttribute (const XmlElement &element, const std::string_view name) |
| Get the value of an optional attribute. | |
Class representing a node in an XML document.
This class encapsulates an XML element, allowing users to access and manipulate element names, attributes, content, and children. It uses libxml2 for all operations and provides simplified methods to interact with XML nodes.
Definition at line 152 of file libxml_wrapper.h.
|
explicit |
Constructor for XmlElement.
| node | The xmlNode pointer representing the XML element. |
Definition at line 162 of file libxml_wrapper.h.
|
default |
|
defaultnoexcept |
|
default |
| XmlElement XmlElement::addChild | ( | const std::string_view | name | ) | const |
Add a child element to the current node.
| name | The name of the new child element. |
Definition at line 286 of file libxml_wrapper.h.
References xml_detail::createNode(), max, and name().
Here is the call graph for this function:
|
noexcept |
Retrieve a child element by name and index.
| name | The name of the child element (optional). |
| index | The index of the child to retrieve. |
Definition at line 300 of file libxml_wrapper.h.
References xml_detail::equals(), max, and name().
Referenced by serial::xml_parser_utils::parseCoordinateSystemParameter(), serial::xml_parser_utils::parseOptionalNumericParameters(), serial::xml_parser_utils::parseOriginParameter(), serial::xml_parser_utils::parseRotationAngleUnit(), serial::xml_parser_utils::parseWaveform(), serial::xml_parser_utils::setOptionalRealParameter(), and serial::xml_parser_utils::setOptionalUnsignedParameter().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Create a new XML element by name.
| name | The name of the XML element. |
Definition at line 187 of file libxml_wrapper.h.
References xml_detail::createNode(), and name().
Referenced by serial::world_to_xml_string().
Here is the call graph for this function:
Here is the caller graph for this function:
|
noexcept |
Get the underlying XML node pointer.
Definition at line 333 of file libxml_wrapper.h.
|
static |
Get the value of an optional attribute.
| element | The XmlElement to retrieve the attribute from. |
| name | The name of the attribute. |
Definition at line 251 of file libxml_wrapper.h.
References max, name(), and xml_detail::toString().
Referenced by serial::xml_parser_utils::get_attribute_bool(), serial::xml_parser_utils::parseMotionPath(), and serial::xml_parser_utils::parseOriginParameter().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Get the value of an attribute safely.
| element | The XmlElement to retrieve the attribute from. |
| name | The name of the attribute. |
| XmlException | if the attribute is not found. |
Definition at line 228 of file libxml_wrapper.h.
References max, name(), and xml_detail::toString().
Referenced by serial::xml_parser_utils::parseAntenna(), serial::xml_parser_utils::parseCoordinateSystemParameter(), serial::xml_parser_utils::parseMonostatic(), serial::xml_parser_utils::parseOriginParameter(), serial::xml_parser_utils::parsePlatform(), serial::xml_parser_utils::parseReceiver(), serial::xml_parser_utils::parseReceiverWithMode(), serial::xml_parser_utils::parseRotationPath(), serial::xml_parser_utils::parseSchedule(), serial::xml_parser_utils::parseTarget(), serial::xml_parser_utils::parseTiming(), serial::xml_parser_utils::parseTransmitter(), serial::xml_parser_utils::parseTransmitterWithMode(), serial::xml_parser_utils::parseUtmCoordinateSystem(), serial::xml_parser_utils::parseWaveform(), serial::xml_parser_utils::processParsedDocument(), and serial::xml_parser_utils::resolve_reference_id().
Here is the call graph for this function:
Here is the caller graph for this function:| std::string XmlElement::getText | ( | ) | const |
Get the text content of the XML element.
Definition at line 197 of file libxml_wrapper.h.
References max, and xml_detail::toString().
Referenced by serial::xml_parser_utils::parseRotationAngleUnit().
Here is the call graph for this function:
Here is the caller graph for this function:
|
noexcept |
Check if the XML element is valid.
Definition at line 326 of file libxml_wrapper.h.
Referenced by serial::xml_parser_utils::parseOptionalNumericParameters(), serial::xml_parser_utils::parseWaveform(), serial::xml_parser_utils::setOptionalRealParameter(), and serial::xml_parser_utils::setOptionalUnsignedParameter().
Here is the caller graph for this function:| std::string XmlElement::name | ( | ) | const |
Get the name of the XML element.
Definition at line 179 of file libxml_wrapper.h.
References xml_detail::toString().
Referenced by addChild(), childElement(), create(), getOptionalAttribute(), getSafeAttribute(), and setAttribute().
Here is the call graph for this function:
Here is the caller graph for this function:
|
default |
|
defaultnoexcept |
Set an attribute on the XML element.
| name | The name of the attribute. |
| value | The value to set for the attribute. |
Definition at line 273 of file libxml_wrapper.h.
Referenced by serial::xml_serializer_utils::serializeWaveform().
Here is the call graph for this function:
Here is the caller graph for this function:Set the text content of the XML element.
| text | The text to set as the content of the node. |
Definition at line 214 of file libxml_wrapper.h.
References max.