FERS 0.1.0
The Flexible Extensible Radar Simulator
Loading...
Searching...
No Matches
xml_detail Namespace Reference

Classes

class  XmlCharBuffer
 

Functions

std::string toString (const xmlChar *value)
 
std::string toString (const xmlChar *value, const int length)
 
bool equals (const xmlChar *xml_value, const std::string_view value)
 
xmlNodePtr createNode (const std::string_view name)
 
xmlDocPtr createDocument ()
 

Function Documentation

◆ createDocument()

xmlDocPtr xml_detail::createDocument ( )

Definition at line 137 of file libxml_wrapper.h.

138 {
139 const XmlCharBuffer version("1.0");
140 return xmlNewDoc(version.c_str());
141 }
math::Vec3 max

References max.

◆ createNode()

xmlNodePtr xml_detail::createNode ( const std::string_view  name)

Definition at line 126 of file libxml_wrapper.h.

127 {
128 const XmlCharBuffer xml_name(name);
129 xmlNodePtr node = xmlNewNode(nullptr, xml_name.c_str());
130 if (node == nullptr)
131 {
132 throw XmlException("Failed to create XML node: " + std::string(name));
133 }
134 return node;
135 }
Exception class for handling XML-related errors.

References max.

Referenced by XmlElement::addChild(), and XmlElement::create().

+ Here is the caller graph for this function:

◆ equals()

bool xml_detail::equals ( const xmlChar xml_value,
const std::string_view  value 
)

Definition at line 109 of file libxml_wrapper.h.

110 {
111 if (xml_value == nullptr)
112 {
113 return false;
114 }
115
116 for (std::size_t index = 0; index < value.size(); ++index)
117 {
118 if (xml_value[index] == 0 || static_cast<char>(xml_value[index]) != value[index])
119 {
120 return false;
121 }
122 }
123 return xml_value[value.size()] == 0;
124 }

References max.

Referenced by XmlElement::childElement().

+ Here is the caller graph for this function:

◆ toString() [1/2]

std::string xml_detail::toString ( const xmlChar value)

Definition at line 78 of file libxml_wrapper.h.

79 {
80 if (value == nullptr)
81 {
82 return "";
83 }
84
85 std::string result;
86 for (const xmlChar* cursor = value; *cursor != 0; ++cursor)
87 {
88 result.push_back(static_cast<char>(*cursor));
89 }
90 return result;
91 }

References max.

Referenced by XmlDocument::dumpToString(), XmlElement::getOptionalAttribute(), XmlElement::getSafeAttribute(), XmlElement::getText(), and XmlElement::name().

+ Here is the caller graph for this function:

◆ toString() [2/2]

std::string xml_detail::toString ( const xmlChar value,
const int  length 
)

Definition at line 93 of file libxml_wrapper.h.

94 {
95 if (value == nullptr || length <= 0)
96 {
97 return "";
98 }
99
100 std::string result;
101 result.reserve(static_cast<std::size_t>(length));
102 for (int index = 0; index < length; ++index)
103 {
104 result.push_back(static_cast<char>(value[index]));
105 }
106 return result;
107 }

References max.