diff options
author | Mike Buland <eichlan@xagasoft.com> | 2011-12-29 10:27:38 -0700 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2011-12-29 10:27:38 -0700 |
commit | bae6192c54533e8da95d8ae1ed4d4eccee28c39a (patch) | |
tree | f27b03b518894420992ad1a3ed3ee1a07935ca4b /src/command.cpp | |
parent | 550d4f13ace49e3d442e43d46cd066f174709400 (diff) | |
download | stage-bae6192c54533e8da95d8ae1ed4d4eccee28c39a.tar.gz stage-bae6192c54533e8da95d8ae1ed4d4eccee28c39a.tar.bz2 stage-bae6192c54533e8da95d8ae1ed4d4eccee28c39a.tar.xz stage-bae6192c54533e8da95d8ae1ed4d4eccee28c39a.zip |
Getting close to realy running.
Diffstat (limited to 'src/command.cpp')
-rw-r--r-- | src/command.cpp | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/src/command.cpp b/src/command.cpp new file mode 100644 index 0000000..5b859f7 --- /dev/null +++ b/src/command.cpp | |||
@@ -0,0 +1,46 @@ | |||
1 | #include "command.h" | ||
2 | |||
3 | #include "astbranch.h" | ||
4 | |||
5 | #include <bu/sio.h> | ||
6 | using namespace Bu; | ||
7 | |||
8 | Command::Command() : | ||
9 | pAst( NULL ) | ||
10 | { | ||
11 | } | ||
12 | |||
13 | Command::~Command() | ||
14 | { | ||
15 | delete pAst; | ||
16 | } | ||
17 | |||
18 | void Command::addLiteral( const Bu::String &sValue ) | ||
19 | { | ||
20 | lChunks.append( Chunk( true, sValue ) ); | ||
21 | } | ||
22 | |||
23 | void Command::addParam( const Bu::String &sValue ) | ||
24 | { | ||
25 | lChunks.append( Chunk( false, sValue ) ); | ||
26 | } | ||
27 | |||
28 | void Command::setAst( class AstBranch *pAst ) | ||
29 | { | ||
30 | this->pAst = pAst; | ||
31 | } | ||
32 | |||
33 | void Command::print() | ||
34 | { | ||
35 | sio << "command:"; | ||
36 | for( ChunkList::iterator i = lChunks.begin(); i; i++ ) | ||
37 | { | ||
38 | if( (*i).bLiteral ) | ||
39 | sio << " \"" << (*i).sValue << "\""; | ||
40 | else | ||
41 | sio << " " << (*i).sValue; | ||
42 | } | ||
43 | |||
44 | sio << sio.nl; | ||
45 | } | ||
46 | |||