summaryrefslogtreecommitdiff
path: root/src/command.cpp
blob: e81d3075e2898be09fd1ffa836317575310a5da2 (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
#include "command.h"

#include "astbranch.h"

#include <bu/sio.h>
using namespace Bu;

Command::Command() :
	pAst( NULL )
{
}

Command::~Command()
{
	delete pAst;
}

void Command::addLiteral( const Bu::String &sValue )
{
	lChunks.append( Chunk( true, sValue ) );
}

void Command::addParam( const Bu::String &sValue )
{
	lChunks.append( Chunk( false, sValue ) );
}

void Command::setAst( class AstBranch *pAst )
{
	this->pAst = pAst;
}

void Command::print()
{
	sio << "command:";
	for( ChunkList::iterator i = lChunks.begin(); i; i++ )
	{
		if( (*i).bLiteral )
			sio << " \"" << (*i).sValue << "\"";
		else
			sio << " " << (*i).sValue;
	}

	sio << *pAst << sio.nl;
}