aboutsummaryrefslogtreecommitdiff
path: root/src/builder.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/builder.cpp')
-rw-r--r--src/builder.cpp98
1 files changed, 97 insertions, 1 deletions
diff --git a/src/builder.cpp b/src/builder.cpp
index e8cd6e2..70be725 100644
--- a/src/builder.cpp
+++ b/src/builder.cpp
@@ -2,6 +2,7 @@
2#include "functionfactory.h" 2#include "functionfactory.h"
3#include "performfactory.h" 3#include "performfactory.h"
4#include "targetfactory.h" 4#include "targetfactory.h"
5#include "action.h"
5 6
6subExceptionDef( BuildException ); 7subExceptionDef( BuildException );
7 8
@@ -62,11 +63,46 @@ bool Builder::isFunction( const char *sFunc )
62 63
63void Builder::newFunctionCall( const char *sName ) 64void Builder::newFunctionCall( const char *sName )
64{ 65{
65 66 pTmpFunc = fFunction.instantiate( sName );
66} 67}
67 68
68void Builder::addFunctionParam( const char *sParam ) 69void Builder::addFunctionParam( const char *sParam )
69{ 70{
71 pTmpFunc->addParam( sParam );
72}
73
74void Builder::newList()
75{
76 lTmp.clear();
77}
78
79void Builder::addListString( const char *str )
80{
81 lTmp.push_back( BuildListItem(str, NULL) );
82}
83
84void Builder::addListFunc()
85{
86 lTmp.push_back( BuildListItem("", pTmpFunc ) );
87}
88
89StringList Builder::buildToStringList( Builder::BuildList &lSrc, StringList &lIn )
90{
91 StringList lOut;
92
93 for( BuildList::iterator i = lSrc.begin(); i != lSrc.end(); i++ )
94 {
95 if( (*i).second )
96 {
97 (*i).second->execute( lIn, lOut );
98 }
99 else
100 {
101 lOut.push_back( (*i).first );
102 }
103 }
104
105 return lOut;
70} 106}
71 107
72// 108//
@@ -85,3 +121,63 @@ void Builder::addPerformParam( const char *sParam )
85{ 121{
86} 122}
87 123
124//
125// Functions for dealing with actions
126//
127void Builder::addAction()
128{
129 lActions.push_back( ActionTmp("", ActionTmpCmdList()) );
130}
131
132void Builder::addAction( const char *sName )
133{
134 lActions.push_back( ActionTmp(sName, ActionTmpCmdList()) );
135}
136
137void Builder::addCommand( int nType )
138{
139 lActions.back().second.push_back( ActionTmpCmd( nType, lTmp ) );
140}
141
142//
143// Debug
144//
145void Builder::debugDump()
146{
147 printf("Actions:\n");
148 for( ActionTmpList::iterator i = lActions.begin();
149 i != lActions.end(); i++ )
150 {
151 if( (*i).first == "" )
152 {
153 printf(" default:\n");
154 }
155 else
156 {
157 printf(" \"%s\":\n", (*i).first.c_str() );
158 }
159 for( ActionTmpCmdList::iterator j = (*i).second.begin();
160 j != (*i).second.end(); j++ )
161 {
162 printf(" %d [", (*j).first );
163 for( BuildList::iterator k = (*j).second.begin();
164 k != (*j).second.end(); k++ )
165 {
166 if( k != (*j).second.begin() )
167 {
168 printf(", ");
169 }
170 if( (*k).second )
171 {
172 printf("func()");
173 }
174 else
175 {
176 printf("\"%s\"", (*k).first.c_str() );
177 }
178 }
179 printf("]\n");
180 }
181 }
182}
183