aboutsummaryrefslogtreecommitdiff
path: root/src/action.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/action.cpp')
-rw-r--r--src/action.cpp63
1 files changed, 0 insertions, 63 deletions
diff --git a/src/action.cpp b/src/action.cpp
deleted file mode 100644
index 51868eb..0000000
--- a/src/action.cpp
+++ /dev/null
@@ -1,63 +0,0 @@
1#include "action.h"
2#include "command.h"
3#include "builder.h"
4
5Action::Action() :
6 bDefault( true ),
7 sName("")
8{
9}
10
11Action::Action( const char *sName ) :
12 bDefault( false ),
13 sName( sName )
14{
15}
16
17Action::~Action()
18{
19}
20
21void Action::add( Command *pCmd )
22{
23 lCommand.push_back( pCmd );
24}
25
26void Action::add( int nType, const char *sCmd )
27{
28 lRegExCommand.push_back( std::pair<int,std::string>( nType, sCmd ) );
29}
30
31void Action::debug()
32{
33 if( bDefault )
34 printf(" action default:\n");
35 else
36 printf(" action \"%s\":\n", sName.getString() );
37
38 for( std::list<Command *>::iterator i = lCommand.begin();
39 i != lCommand.end(); i++ )
40 {
41 (*i)->debug();
42 }
43}
44
45void Action::execute( Builder &bld )
46{
47 for( std::list<std::pair<int,std::string> >::iterator i =
48 lRegExCommand.begin(); i != lRegExCommand.end(); i++ )
49 {
50 std::list<std::string> lTmp = bld.findTargets( (*i).second.c_str() );
51 for( std::list<std::string>::iterator j = lTmp.begin();
52 j != lTmp.end(); j++ )
53 {
54 add( new Command( (Command::CmdType)(*i).first, (*j).c_str() ) );
55 }
56 }
57 for( std::list<Command *>::iterator i = lCommand.begin();
58 i != lCommand.end(); i++ )
59 {
60 (*i)->execute( bld );
61 }
62}
63