elftosb::ListASTNode Class Reference

AST node that contains other AST nodes. More...

`#include <ElftosbAST.h>`

Inheritance diagram for elftosb::ListASTNode:
[legend]
Collaboration diagram for elftosb::ListASTNode:
[legend]

## Public Types

typedef std::list< ASTNode * > | ast_list_t
typedef ast_list_t::iterator | iterator
typedef ast_list_t::const_iterator | const_iterator

## Public Member Functions

| ListASTNode (const ListASTNode &other)
virtual | ~ListASTNode ()
virtual ASTNode * | clone () const
| Returns an exact duplicate of this object.
virtual std::string | nodeName () const
| Returns the name of the object's class.
virtual void | printTree (int indent) const
List operations
virtual void | appendNode (ASTNode *node)
| Adds node to the end of the ordered list of child nodes. More...
virtual unsigned | nodeCount () const
| Returns the number of nodes in this list.
Node iterators
iterator | begin ()
iterator | end ()
const_iterator | begin () const
const_iterator | end () const
Location
virtual void | updateLocation ()
Public Member Functions inherited from elftosb::ASTNode
| ASTNode ()
| Default constructor.
| ASTNode (ASTNode *parent)
| Constructor taking a parent node.
| ASTNode (const ASTNode &other)
| Copy constructor.
virtual | ~ASTNode ()
| Destructor.
virtual ASTNode * | getParent () const
virtual void | setParent (ASTNode *newParent)
virtual void | printTree () const
virtual void | setLocation (token_loc_t &loc)
virtual void | setLocation (token_loc_t &first, token_loc_t &last)
virtual void | setLocation (ASTNode *loc)
virtual void | setLocation (ASTNode *first, ASTNode *last)
virtual token_loc_t & | getLocation ()
virtual const token_loc_t & | getLocation () const
virtual int | getFirstLine ()
virtual int | getLastLine ()

## Protected Attributes

ast_list_t | m_list
| Ordered list of child nodes.
Protected Attributes inherited from elftosb::ASTNode
ASTNode * | m_parent
| Pointer to parent node of this object. May be NULL.
token_loc_t | m_location
| Location of this node in the source file.

## Additional Inherited Members

Protected Member Functions inherited from elftosb::ASTNode
void | printIndent (int indent) const
| Prints indent number of spaces.

## Detailed Description

AST node that contains other AST nodes.

Unlike other AST nodes, the location of a ListASTNode is computed dynamically based on the nodes in its list. Or mostly dynamic at least. The updateLocation() method is used to force the list object to recalculate its beginning and ending line numbers.

## Constructor & Destructor Documentation

ListASTNode::~ListASTNode | ( |  | ) |

virtual

Deletes child node in the list.

## Member Function Documentation

void ListASTNode::appendNode | ( | ASTNode * | node | ) |

virtual

Adds node to the end of the ordered list of child nodes.

If node is NULL then the list is left unmodified.

The list node's location is automatically updated after the node is added by a call to updateLocation().

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

- ElftosbAST.h
- ElftosbAST.cpp