|
FERS 1.0.0
The Flexible Extensible Radar Simulator
|
Class representing a node in an XML document. More...
#include "libxml_wrapper.h"
Public Member Functions | |
| XmlElement (const xmlNode *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_view | name () const noexcept |
| 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 noexcept |
| 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 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 54 of file libxml_wrapper.h.
|
explicit |
Constructor for XmlElement.
| node | The xmlNode pointer representing the XML element. |
Definition at line 64 of file libxml_wrapper.h.
|
default |
|
defaultnoexcept |
|
default |
|
noexcept |
Add a child element to the current node.
| name | The name of the new child element. |
Definition at line 173 of file libxml_wrapper.h.
References name().
Referenced by serial::xml_serializer_utils::addChildWithText(), serial::xml_serializer_utils::serializeMonostatic(), serial::xml_serializer_utils::serializeMotionPath(), serial::xml_serializer_utils::serializeParameters(), serial::xml_serializer_utils::serializePlatform(), serial::xml_serializer_utils::serializeReceiver(), serial::xml_serializer_utils::serializeRotation(), serial::xml_serializer_utils::serializeSchedule(), serial::xml_serializer_utils::serializeTarget(), serial::xml_serializer_utils::serializeTiming(), serial::xml_serializer_utils::serializeTransmitter(), serial::xml_serializer_utils::serializeWaveform(), and serial::world_to_xml_string().
Here is the call graph for this function:
Here is the caller 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 187 of file libxml_wrapper.h.
References name().
Referenced by serial::xml_parser_utils::collectIncludeElements(), radar::FileTarget::FileTarget(), serial::xml_parser_utils::get_child_real_type(), serial::xml_parser_utils::parseMotionPath(), serial::xml_parser_utils::parseParameters(), serial::xml_parser_utils::parsePlatform(), serial::xml_parser_utils::parsePlatformElements(), serial::xml_parser_utils::parseReceiver(), serial::xml_parser_utils::parseRotationPath(), serial::xml_parser_utils::parseSchedule(), serial::xml_parser_utils::parseTarget(), serial::xml_parser_utils::parseTransmitter(), serial::xml_parser_utils::parseWaveform(), serial::xml_parser_utils::processParsedDocument(), and removeIncludeElements().
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 220 of file libxml_wrapper.h.
Referenced by getOptionalAttribute(), getSafeAttribute(), mergeXmlDocuments(), and XmlDocument::setRootElement().
Here is the caller graph for this function:
|
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 140 of file libxml_wrapper.h.
References getNode(), isValid(), and name().
Here is the call 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 118 of file libxml_wrapper.h.
References getNode(), and name().
Referenced by serial::xml_parser_utils::get_attribute_bool(), serial::xml_parser_utils::parseAntenna(), serial::xml_parser_utils::parseMotionPath(), serial::xml_parser_utils::parseParameters(), serial::xml_parser_utils::parsePlatform(), serial::xml_parser_utils::parseReceiver(), 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::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 88 of file libxml_wrapper.h.
Referenced by serial::xml_parser_utils::collectIncludeElements(), serial::xml_parser_utils::get_child_real_type(), and serial::xml_parser_utils::parseParameters().
Here is the caller graph for this function:
|
noexcept |
Check if the XML element is valid.
Definition at line 213 of file libxml_wrapper.h.
Referenced by serial::xml_parser_utils::collectIncludeElements(), getOptionalAttribute(), serial::xml_parser_utils::parseMotionPath(), serial::xml_parser_utils::parseParameters(), serial::xml_parser_utils::parsePlatform(), serial::xml_parser_utils::parsePlatformElements(), serial::xml_parser_utils::parseReceiver(), 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::parseWaveform(), and serial::xml_parser_utils::processParsedDocument().
Here is the caller graph for this function:
|
noexcept |
Get the name of the XML element.
Definition at line 81 of file libxml_wrapper.h.
Referenced by addChild(), childElement(), getOptionalAttribute(), getSafeAttribute(), serial::xml_parser_utils::processParsedDocument(), and setAttribute().
Here is the caller graph for this function:
|
default |
|
defaultnoexcept |
| void XmlElement::setAttribute | ( | const std::string_view | name, |
| const std::string_view | value | ||
| ) | const |
Set an attribute on the XML element.
| name | The name of the attribute. |
| value | The value to set for the attribute. |
Definition at line 161 of file libxml_wrapper.h.
References name().
Referenced by serial::xml_serializer_utils::serializeAntenna(), serial::xml_serializer_utils::serializeMonostatic(), serial::xml_serializer_utils::serializeMotionPath(), serial::xml_serializer_utils::serializeParameters(), serial::xml_serializer_utils::serializePlatform(), serial::xml_serializer_utils::serializeReceiver(), serial::xml_serializer_utils::serializeRotation(), serial::xml_serializer_utils::serializeSchedule(), serial::xml_serializer_utils::serializeTarget(), serial::xml_serializer_utils::serializeTiming(), serial::xml_serializer_utils::serializeTransmitter(), serial::xml_serializer_utils::serializeWaveform(), serial::xml_serializer_utils::setAttributeFromBool(), and serial::world_to_xml_string().
Here is the call graph for this function:
Here is the caller graph for this function:| void XmlElement::setText | ( | const std::string_view | text | ) | const |
Set the text content of the XML element.
| text | The text to set as the content of the node. |
Definition at line 105 of file libxml_wrapper.h.
Referenced by serial::xml_serializer_utils::addChildWithText().
Here is the caller graph for this function: