aboutsummaryrefslogtreecommitdiff
path: root/src/astbranch.cpp
blob: afb6e73b0a09076540691d9f76a9dbb332e1f795 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/*
 * Copyright (C) 2007-2014 Xagasoft, All rights reserved.
 *
 * This file is part of the Xagasoft Build and is released under the
 * terms of the license contained in the file LICENSE.
 */
#include "astbranch.h"

AstBranch::AstBranch( const Location &loc, Type eType ) :
    AstNode( loc, eType )
{
}

AstBranch::~AstBranch()
{
}

void AstBranch::addBranch()
{
    lBranch.append( NodeList() );
}

void AstBranch::addNode( AstNode *pNode )
{
    lBranch.last().append( pNode );
}

AstBranch::BranchList::const_iterator AstBranch::getBranchBegin() const
{
    return lBranch.begin();
}

Bu::Formatter &operator<<( Bu::Formatter &f, const AstBranch &l )
{
    f.incIndent();
    f << ":";
    for( AstBranch::BranchList::const_iterator i = l.getBranchBegin(); i; i++ )
    {
        f << f.nl << "Branch:";
        f.incIndent();
        for( AstBranch::NodeList::const_iterator j = i->begin(); j; j++ )
        {
            f << f.nl << **j;
        }
        f.decIndent();
    }
    f.decIndent();
    return f;
}