39 std::vector<RapidXmlReaderNode> nodes;
49 std::string get_attrib_value(
const char* attrName)
const
52 for (
auto& node : nodes)
54 if (node.has_attribute(attrName))
56 return node.attribute_value(attrName);
64 std::string(
"Attribute '") + attrName +
68 std::string get_value()
const
90 reverse(rnodes.begin(), rnodes.end());
91 nodes = std::move(rnodes);
104 std::vector<RapidXmlReaderNode>
v;
107 if (n.get_node_ptr()->first_node(name) !=
nullptr)
109 v.push_back(n.first_node(name));
114 std::stringstream ch;
117 std::string(
"Node with name '") + name +
133 if (n.has_attribute(attrName))
141 bool attribute_as_bool(
const std::string& attrName,
const std::string& trueValue,
const std::string& falseValue)
const
145 bool attribute_as_bool(
const char* attrName,
const std::string& trueValue,
const std::string& falseValue)
const
147 std::string
value = std::string(get_attrib_value(attrName));
149 if (
value == trueValue)
153 else if (
value == falseValue)
163 bool attribute_as_optional_bool(
const std::string& name,
const std::string& trueValue,
const std::string& falseValue,
bool defaultValue)
const
176 std::string
value = std::string(get_attrib_value(name));
178 if (
value == trueValue)
182 else if (
value == falseValue)
198 return std::string(get_attrib_value(attrName));
207 std::stringstream(get_attrib_value(attrName)) >>
value;
212 return attribute_as<T>(attrName.c_str());
227 return attribute_as<float>(attrName);
236 return attribute_as<uint32_t>(attrName);
242 return std::string(get_value());
248 std::stringstream strValue(get_value());
250 strValue >> retValue;
257 return static_cast<uint32_t
>(std::stoul(get_value(),
nullptr, 0));
263 return static_cast<uint16_t
>(std::stoul(get_value(),
nullptr, 0));
269 return static_cast<int32_t
>(std::stoul(get_value(),
nullptr, 0));
275 return static_cast<int16_t
>(std::stoul(get_value(),
nullptr, 0));
278 bool value_as_bool(
const std::string& trueValue,
const std::string& falseValue)
const
281 std::string
value = std::string(get_value());
282 if (
value == trueValue)
286 else if (
value == falseValue)
295 s += std::string(node.name());
298 s =
s.substr(0,
s.length() - 2);
307 std::string
value = std::string(get_value());
308 if (
value == trueValue)
312 else if (
value == falseValue)
324 return !nodes.empty();
330 std::set<std::string> results;
333 const auto paths = n.getChildPaths();
334 results.insert(paths.begin(), paths.end());
336 return {results.begin(), results.end()};
341 std::vector<std::string> results;
344 results.push_back(n.getPath());
350 std::vector<std::string> paths =
getPaths();
351 std::string all_paths;
352 for (std::string path : paths)
357 all_paths = all_paths.substr(0, all_paths.length() - 4);
373 if (position > nodes.size())
378 if (!added_nodes.empty())
380 std::vector<RapidXmlReaderNode>
v;
381 v.reserve(added_nodes.size() + nodes.size());
382 for (
auto& node : added_nodes)
386 v.emplace_back(std::move(node));
391 const auto n_inserted =
v.size();
392 v.insert(
v.end(), nodes.rbegin(), nodes.rend());
395 std::rotate(it, it + n_inserted, it + n_inserted + position);
408 if (pos >= nodes.size())
410 pos = nodes.size() - 1;
414 std::vector<RapidXmlReaderNode>
v = nodes;
416 v.erase(
v.begin() + pos);