#include "astbranch.h" #include AstBranch::AstBranch( AstNode::Type eType ) : AstNode( eType ), pParent( NULL ) { } AstBranch::~AstBranch() { for( NodeList::iterator i = lNodes.begin(); i; i++ ) { delete *i; } } AstNode *AstBranch::addNode( AstNode *pNode ) { AstBranch *pBranch = dynamic_cast(pNode); if( pBranch ) { pBranch->pParent = this; } lNodes.append( pNode ); return pNode; } Bu::Formatter &operator<<( Bu::Formatter &f, const AstBranch &b ) { f << "(Branch " << b.getType() << ": "; f.incIndent(); for( typename AstBranch::NodeList::const_iterator i = b.lNodes.begin(); i; i++ ) { f << f.nl << *(*i); } f.decIndent(); return f << f.nl << ")"; }