Woman, Life, Freedom


Adaptive AUTOSAR
ARA public interface header documentation
arxml::ArxmlNode Class Reference

A class that represents a XML node within a ARXML configuration. More...

#include <arxml_node.h>

Public Member Functions

 ArxmlNode (pugi::xml_node &&node)
 Constructor. More...
 
template<typename T >
GetValue (T defaultValue={}) const
 Get the node value. More...
 
std::string GetShortName () const
 Get the node short name. More...
 
bool TryGetReference (const std::string &sourceNode, const std::string &destinationType, std::string &referenceNode) const
 Try to get a reference node. More...
 
std::string GetContent () const
 Get XML content of the node. More...
 
template<>
std::string GetValue (std::string defaultValue) const
 

Detailed Description

A class that represents a XML node within a ARXML configuration.

Constructor & Destructor Documentation

◆ ArxmlNode()

arxml::ArxmlNode::ArxmlNode ( pugi::xml_node &&  node)
explicit

Constructor.

Parameters
nodeXML node

Member Function Documentation

◆ GetContent()

std::string arxml::ArxmlNode::GetContent ( ) const

Get XML content of the node.

Returns
XML content including the node itself

◆ GetShortName()

std::string arxml::ArxmlNode::GetShortName ( ) const

Get the node short name.

Returns
Short name child text of the node

◆ GetValue()

template<typename T >
T arxml::ArxmlNode::GetValue ( defaultValue = {}) const
inline

Get the node value.

Template Parameters
TValue type
Parameters
defaultValueDefault value
Returns
Node value if exists; otherwise the default value

◆ TryGetReference()

bool arxml::ArxmlNode::TryGetReference ( const std::string &  sourceNode,
const std::string &  destinationType,
std::string &  referenceNode 
) const

Try to get a reference node.

Parameters
[in]sourceNodeSource node name that is referring to another node
[in]destinationTypeExpected reference destination node type
[out]referenceNodeReference node name
Returns
True if the expected destination type matches the actual type; otherwise false
Note
Reference node argument will be untouched in case of destination type mismatch.