Woman, Life, Freedom


Adaptive AUTOSAR
ARA public interface header documentation
arxml_node.h
1#ifndef ARXML_NODE_H
2#define ARXML_NODE_H
3
4#include <string>
5#include "./pugixml.hpp"
6
7namespace arxml
8{
11 {
12 private:
13 pugi::xml_node mNode;
14
15 public:
16 ArxmlNode() = delete;
17
20 explicit ArxmlNode(pugi::xml_node &&node);
21
26 template <typename T>
27 T GetValue(T defaultValue = {}) const
28 {
29 auto _defaultValueUInt{static_cast<unsigned int>(defaultValue)};
30 unsigned int _value{mNode.text().as_uint(_defaultValueUInt)};
31 auto _result{static_cast<T>(_value)};
32
33 return _result;
34 }
35
38 std::string GetShortName() const;
39
46 bool TryGetReference(
47 const std::string &sourceNode, const std::string &destinationType,
48 std::string &referenceNode) const;
49
52 std::string GetContent() const;
53 };
54
55 template <>
56 std::string ArxmlNode::GetValue(std::string defaultValue) const;
57}
58
59#endif
A class that represents a XML node within a ARXML configuration.
Definition: arxml_node.h:11
std::string GetShortName() const
Get the node short name.
Definition: arxml_node.cpp:11
bool TryGetReference(const std::string &sourceNode, const std::string &destinationType, std::string &referenceNode) const
Try to get a reference node.
Definition: arxml_node.cpp:27
T GetValue(T defaultValue={}) const
Get the node value.
Definition: arxml_node.h:27
std::string GetContent() const
Get XML content of the node.
Definition: arxml_node.cpp:51
AUTOSAR XML (ARXML) configuration files utilities namespace.
Definition: arxml_node.cpp:6