commonlib
DxNode Class Reference

DxNode class defines an internal xml node and implements functions for creating, modifying and removing xml tree elements that are used in LibXmlNode class. More...

#include <dx_node.h>

Public Member Functions

 DxNode ()
 Default constructor that creates an instance od a DxNode class with default values.
 
 DxNode (const std::string &name, const std::string &value="")
 Constructor that creates an instance od a DxNode class with a given name. More...
 
 ~DxNode ()
 Destructor.
 

Static Public Member Functions

static DxNodePtr dxNodeCreate (const std::string &nodeName, const std::string &value)
 Function creates and returns a new node with a given name and value. More...
 
static void dxNodeDestroy (DxNodePtr &node)
 Function recursively clears all child nodes and sets node pointer to nullptr. More...
 
static void dxNodeSetValue (const DxNodePtr &node, const std::string &value)
 Function sets a value to a node. More...
 
static void dxNodeMakeChildNodes (const DxNodePtr &node)
 Function creates a new pointer to child elements and assigns it to a given node. More...
 
static void dxNodeRemoveChild (const DxNodePtr &node, DxNodePtr &childNode)
 Function removes a given child from a given node. More...
 
static void dxNodeRemoveChild (const DxNodePtr &node, const std::string &name)
 Function removes children with a given name from a given node. More...
 
static void dxNodeRemoveChild (const DxNodePtr &node, const size_t childIndex)
 Function removes a child with a given index from a given node. More...
 
static void dxNodeClearChildNodes (const DxNodePtr &node)
 Function clears all children elements of a given node. More...
 
static void dxNodeRemoveAttributeNode (const DxNodePtr &node, DxNodePtr &attributeNode)
 Function removes a given attribute from a given node. More...
 
static void dxNodeRemoveAttributeNode (const DxNodePtr &node, const std::string &attributeName)
 Function removes attributes with a given name from a given node. More...
 
static void dxNodeRemoveAttributeNode (const DxNodePtr &node, const size_t attributeIndex)
 Function removes an attribute with a given index from a given node. More...
 
static DxNodePtr dxNodeFindChildNode (const DxNodePtr &node, const std::string &childNodeName)
 Function returns a shared pointer to a child node with a given name. More...
 
static DxNodePtr dxNodeFindAttributeNode (const DxNodePtr &node, const std::string &attributeNodeName)
 Function returns a shared pointer to an attribute node with a given name. More...
 
static void dxNodeAddChildNode (const DxNodePtr &node, const DxNodePtr &childNode)
 Function adds a given child to a given node. More...
 
static DxNodePtr dxNodeGetAttribute (const DxNodePtr &node, const size_t attributeIndex)
 Function returns an attribute with a given index. More...
 
static void dxNodeAddAttributeNode (const DxNodePtr &node, const DxNodePtr &attributeNode)
 Function adds a given attribute to a given node. More...
 
static size_t dxNodeGetChildCount (const DxNodePtr &node)
 Function returns a number of child elements of a given node. More...
 
static DxNodePtr dxNodeGetChild (const DxNodePtr &node, const size_t childIndex)
 Function returns a child with a given index. More...
 
static DxNodePtr dxNodeGetNextSibling (const DxNodePtr &node)
 Function returns a sibling of a given node (next child of a given node parent). More...
 
static size_t dxNodeGetAttributeCount (const DxNodePtr &node)
 Function returns a number of attribute elements of a given node. More...
 
static void dxNodeClearAttributeNodes (const DxNodePtr &node)
 Function clears all attribute elements of a given node. More...
 
static DxNodePtr dxNodeClone (const DxNodePtr &sourceNode)
 Function creates and returns a copy of a given node. More...
 

Public Attributes

std::string name
 Name of a node.
 
std::string value
 Value of a node.
 
DxNodeExtInfoPtr extInfo = nullptr
 Shared pointer to a DxNodeExtInfo that contains pointers to child and attribute elements.
 
DxNodeWPtr parent
 Weak pointer to a parent node.
 
size_t childIndex = 0
 Child index of a node.
 

Detailed Description

DxNode class defines an internal xml node and implements functions for creating, modifying and removing xml tree elements that are used in LibXmlNode class.

Constructor & Destructor Documentation

◆ DxNode()

DxNode::DxNode ( const std::string &  name,
const std::string &  value = "" 
)
inlineexplicit

Constructor that creates an instance od a DxNode class with a given name.

Parameters
nameNode name

Member Function Documentation

◆ dxNodeAddAttributeNode()

static void DxNode::dxNodeAddAttributeNode ( const DxNodePtr &  node,
const DxNodePtr &  attributeNode 
)
static

Function adds a given attribute to a given node.

Parameters
nodeShared pointer to a node
attributeNodeShared pointer to an attribute node

◆ dxNodeAddChildNode()

static void DxNode::dxNodeAddChildNode ( const DxNodePtr &  node,
const DxNodePtr &  childNode 
)
static

Function adds a given child to a given node.

Parameters
nodeShared pointer to a node
childNodeShared pointer to a child node

◆ dxNodeClearAttributeNodes()

static void DxNode::dxNodeClearAttributeNodes ( const DxNodePtr &  node)
static

Function clears all attribute elements of a given node.

Parameters
nodeShared pointer to a node

◆ dxNodeClearChildNodes()

static void DxNode::dxNodeClearChildNodes ( const DxNodePtr &  node)
static

Function clears all children elements of a given node.

Parameters
nodeShared pointer to a node

◆ dxNodeClone()

static DxNodePtr DxNode::dxNodeClone ( const DxNodePtr &  sourceNode)
static

Function creates and returns a copy of a given node.

Parameters
sourceNodeShared pointer to a source node
Returns
Returns a copy of a source node

◆ dxNodeCreate()

static DxNodePtr DxNode::dxNodeCreate ( const std::string &  nodeName,
const std::string &  value 
)
static

Function creates and returns a new node with a given name and value.

Parameters
nodeNameNode name
valueNode value
Returns
Returns a shared pointer to a newly created node

◆ dxNodeDestroy()

static void DxNode::dxNodeDestroy ( DxNodePtr &  node)
static

Function recursively clears all child nodes and sets node pointer to nullptr.

Parameters
nodeShared pointer to a node

◆ dxNodeFindAttributeNode()

static DxNodePtr DxNode::dxNodeFindAttributeNode ( const DxNodePtr &  node,
const std::string &  attributeNodeName 
)
static

Function returns a shared pointer to an attribute node with a given name.

Parameters
nodeShared pointer to a node
attributeNodeNameAttribute name
Returns
Returns a shared pointer to a found attribute node or a nullptr in case attribute is not found

◆ dxNodeFindChildNode()

static DxNodePtr DxNode::dxNodeFindChildNode ( const DxNodePtr &  node,
const std::string &  childNodeName 
)
static

Function returns a shared pointer to a child node with a given name.

Parameters
nodeShared pointer to a node
childNodeNameChild node name
Returns
Returns a shared pointer to a found node or nullptr in case child is not found

◆ dxNodeGetAttribute()

static DxNodePtr DxNode::dxNodeGetAttribute ( const DxNodePtr &  node,
const size_t  attributeIndex 
)
static

Function returns an attribute with a given index.

Parameters
nodeShared pointer to a node
attributeIndexAttribute index
Returns
Returns a shared pointer to an attribute node with a given index or nullptr in case index is invalid

◆ dxNodeGetAttributeCount()

static size_t DxNode::dxNodeGetAttributeCount ( const DxNodePtr &  node)
static

Function returns a number of attribute elements of a given node.

Parameters
nodeShared pointer to a node
Returns
Returns a number of attribute elements

◆ dxNodeGetChild()

static DxNodePtr DxNode::dxNodeGetChild ( const DxNodePtr &  node,
const size_t  childIndex 
)
static

Function returns a child with a given index.

Parameters
nodeShared pointer to a node
childIndexChild index
Returns
Returns a shared pointer to a child node with a given index or nullptr in case index is invalid

◆ dxNodeGetChildCount()

static size_t DxNode::dxNodeGetChildCount ( const DxNodePtr &  node)
static

Function returns a number of child elements of a given node.

Parameters
nodeShared pointer to a node
Returns
Returns a number of child elements

◆ dxNodeGetNextSibling()

static DxNodePtr DxNode::dxNodeGetNextSibling ( const DxNodePtr &  node)
static

Function returns a sibling of a given node (next child of a given node parent).

Parameters
nodeShared pointer to a node
Returns
Returns a shared pointer to a given node sibling or nullptr in case sibling does not exist

◆ dxNodeMakeChildNodes()

static void DxNode::dxNodeMakeChildNodes ( const DxNodePtr &  node)
static

Function creates a new pointer to child elements and assigns it to a given node.

Parameters
nodeShared pointer to a node

◆ dxNodeRemoveAttributeNode() [1/3]

static void DxNode::dxNodeRemoveAttributeNode ( const DxNodePtr &  node,
DxNodePtr &  attributeNode 
)
static

Function removes a given attribute from a given node.

Parameters
nodeShared pointer to a node
attributeNodeShared pointer to an attribute node

◆ dxNodeRemoveAttributeNode() [2/3]

static void DxNode::dxNodeRemoveAttributeNode ( const DxNodePtr &  node,
const std::string &  attributeName 
)
static

Function removes attributes with a given name from a given node.

Parameters
nodeShared pointer to a node
attributeNameA name of an attribute to remove

◆ dxNodeRemoveAttributeNode() [3/3]

static void DxNode::dxNodeRemoveAttributeNode ( const DxNodePtr &  node,
const size_t  attributeIndex 
)
static

Function removes an attribute with a given index from a given node.

Parameters
nodeShared pointer to a node
attributeIndexAn index of an attribute to remove

◆ dxNodeRemoveChild() [1/3]

static void DxNode::dxNodeRemoveChild ( const DxNodePtr &  node,
DxNodePtr &  childNode 
)
static

Function removes a given child from a given node.

Parameters
nodeShared pointer to a node
childNodeShared pointer to a child node

◆ dxNodeRemoveChild() [2/3]

static void DxNode::dxNodeRemoveChild ( const DxNodePtr &  node,
const std::string &  name 
)
static

Function removes children with a given name from a given node.

Parameters
nodeShared pointer to a node
nameA name of a child to remove

◆ dxNodeRemoveChild() [3/3]

static void DxNode::dxNodeRemoveChild ( const DxNodePtr &  node,
const size_t  childIndex 
)
static

Function removes a child with a given index from a given node.

Parameters
nodeShared pointer to a node
childIndexAn index of a child to remove

◆ dxNodeSetValue()

static void DxNode::dxNodeSetValue ( const DxNodePtr &  node,
const std::string &  value 
)
static

Function sets a value to a node.

Parameters
nodeShared pointer to a node
valueA value

The documentation for this class was generated from the following file: