eRPC Generator (erpcgen)
Rev. 1.12.0
NXP Semiconductors
|
Homogeneous AST node class. More...
#include <AstNode.hpp>
Public Types | |
typedef std::map< std::string, Value * > | attribute_map_t |
typedef std::vector< AstNode * > | child_list_t |
typedef child_list_t::iterator | iterator |
typedef child_list_t::const_iterator | const_iterator |
Public Member Functions | |
AstNode (const Token &token) | |
This function is constructor of AstNode class. More... | |
AstNode (Token &token, AstNode *parent) | |
This function is constructor of AstNode class. More... | |
AstNode (const AstNode &other) | |
This function is copy constructor of AstNode class. More... | |
AstNode & | operator= (const AstNode &other) |
Assignment operator. More... | |
virtual | ~AstNode () |
This function is destructor of AstNode class. More... | |
virtual AstNode * | clone () const |
This function returns an exact duplicate of this object. More... | |
virtual std::string | nodeName () const |
This function returns name of this node. More... | |
std::string | getDescription () const |
This function returns string description of the node. More... | |
Token | |
Token & | getToken () |
This function returns token of this node. More... | |
const Token & | getToken () const |
This function returns constant token of this node. More... | |
void | setToken (const Token &token) |
This function set token to this node. More... | |
Value * | getTokenValue () |
This function returns value of token of this node. More... | |
std::string | getTokenString () |
This function returns string representation of this node token value. More... | |
Parent | |
AstNode * | getParent () const |
This function returns pointer to parent node. More... | |
void | setParent (AstNode *newParent) |
This function set parent for this node. More... | |
Attribute | |
size_t | attributeCount () const |
This function returns count of node attributes. More... | |
bool | hasAttribute (const std::string &name) const |
This function find attribute in AstNode attributes. More... | |
Value * | getAttribute (const std::string &name) |
This function return attribute from AstNode attributes. More... | |
void | setAttribute (const std::string &name, Value *node) |
This function set attribute in AstNode attributes. More... | |
void | removeAttribute (const std::string &name) |
This function remove attribute from AstNode attributes. More... | |
Value *& | operator[] (const std::string &name) |
Square brackets. More... | |
Children | |
void | appendChild (AstNode *node) |
This function add given node to the end of children list for current AstNode. More... | |
size_t | childCount () const |
This function return count of children for current node. More... | |
AstNode * | getChild (int index) const |
This function return child node from node children. More... | |
size_t | getIndexOfChild (const AstNode *child) |
This function return index of searched child node. More... | |
size_t | getIndex () |
This function return index of current node in parent's list of children. More... | |
void | replaceChild (AstNode *original, AstNode *replacement) |
This function replace child in AstNode tree. More... | |
void | reverseExpr () |
This function replace children location in AstNode tree. More... | |
AstNode *& | operator[] (int index) |
Square brackets. More... | |
const AstNode * | operator[] (int index) const |
Square brackets. More... | |
Child iterators | |
iterator | begin () |
iterator | end () |
const_iterator | begin () const |
const_iterator | end () const |
Protected Attributes | |
Token | m_token |
AstNode * | m_parent |
attribute_map_t | m_attributes |
child_list_t | m_children |
Homogeneous AST node class.
This class is meant to represent arbitrary AST nodes. Each node optionally has a Token object associated with it. It has an ordered list of child nodes and a pointer to its parent. Named attribute values can be set on a node. The attribute values are members of the Value class hierarchy of boxed types.
typedef std::map<std::string, Value *> erpcgen::AstNode::attribute_map_t |
Map type of named attributes.
typedef std::vector<AstNode *> erpcgen::AstNode::child_list_t |
Vector of AstNode children.
typedef child_list_t::const_iterator erpcgen::AstNode::const_iterator |
Constant iterator of AstNode children vector.
typedef child_list_t::iterator erpcgen::AstNode::iterator |
Iterator of AstNode children vector.
|
inlineexplicit |
This function is constructor of AstNode class.
This function set parent AstNode variable for this object to nullptr and token variable for this object to given token.
[in] | token | Constant reference to token. |
This function is constructor of AstNode class.
This function set parent AstNode variable for this object to given node and token variable for this object to given token.
[in] | token | Pointer to given token. |
[in] | parent | Pointer to given parent node. |
AstNode::AstNode | ( | const AstNode & | other | ) |
This function is copy constructor of AstNode class.
This function copy data from given node to this object.
[in] | other | Given node. |
|
virtual |
This function is destructor of AstNode class.
This function also call for children destructors.
void AstNode::appendChild | ( | AstNode * | node | ) |
This function add given node to the end of children list for current AstNode.
If node is NULL then a NULL pointer is added to the children list. The list node's location is automatically updated after the node is added by a call to updateLocation().
[in] | node | Child node for current AstNode. |
|
inline |
This function returns count of node attributes.
|
inline |
This function return count of children for current node.
|
inlinevirtual |
This function returns an exact duplicate of this object.
Value * AstNode::getAttribute | ( | const std::string & | name | ) |
This function return attribute from AstNode attributes.
This function return attribute from giving name in AstNode attributes.
[in] | name | Name for AstNode attribute. |
|
inline |
This function return child node from node children.
[in] | index | Index of node child. |
string AstNode::getDescription | ( | ) | const |
This function returns string description of the node.
size_t AstNode::getIndex | ( | ) |
This function return index of current node in parent's list of children.
size_t AstNode::getIndexOfChild | ( | const AstNode * | child | ) |
This function return index of searched child node.
[in] | child | Searched child node for current AstNode. |
-1 | If child was not found. |
|
inline |
This function returns pointer to parent node.
|
inline |
|
inline |
This function returns constant token of this node.
|
inline |
This function returns string representation of this node token value.
|
inline |
This function returns value of token of this node.
bool AstNode::hasAttribute | ( | const std::string & | name | ) | const |
This function find attribute in AstNode attributes.
This function find attribute from giving name in AstNode attributes.
[in] | name | Name for AstNode attribute. |
|
inlinevirtual |
This function returns name of this node.
|
inline |
Square brackets.
This function return node attribute from attributes. Attribute is requested by given attribute name in square brackets.
[in] | name | Name of searched attribute. |
|
inline |
Square brackets.
This function return node from this node children list. Attribute is requested by given attribute index number in square brackets.
[in] | index | Index of searched child node. |
|
inline |
Square brackets.
This function return const node from this node children list. Attribute is requested by given attribute index number in square brackets.
[in] | index | Index of searched child node. |
void AstNode::removeAttribute | ( | const std::string & | name | ) |
This function remove attribute from AstNode attributes.
This function remove attribute from giving name in AstNode attributes.
[in] | name | Name for AstNode attribute. |
This function replace child in AstNode tree.
This function replace original AstNode child with replacement.
void AstNode::reverseExpr | ( | ) |
This function replace children location in AstNode tree.
This function move top of array AstNode node in AstNode tree to bottom of tree.
void AstNode::setAttribute | ( | const std::string & | name, |
Value * | node | ||
) |
This function set attribute in AstNode attributes.
This function set attribute for giving name and node in AstNode attributes.
|
inline |
This function set parent for this node.
[in] | newParent | Pointer to given parent node. |
|
inline |
This function set token to this node.
[in] | token | Pointer to given token. |
|
protected |
Map of named attributes.
|
protected |
Ordered list of children of this node.
|
protected |
Pointer to parent node of this object. May be NULL.
|
protected |
The token associated with this node.