aboutsummaryrefslogtreecommitdiff
path: root/src/context.cpp
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2011-01-20 18:21:03 +0000
committerMike Buland <eichlan@xagasoft.com>2011-01-20 18:21:03 +0000
commitc435c7daa9df1b08dc85132fcd1c154bea9b69e2 (patch)
tree5537f3c91a67b35c4c8aa918b708b7e4aad8f146 /src/context.cpp
parent59690513123de8904eef2a03fe7fcaaed98b1b7b (diff)
downloadbuild-c435c7daa9df1b08dc85132fcd1c154bea9b69e2.tar.gz
build-c435c7daa9df1b08dc85132fcd1c154bea9b69e2.tar.bz2
build-c435c7daa9df1b08dc85132fcd1c154bea9b69e2.tar.xz
build-c435c7daa9df1b08dc85132fcd1c154bea9b69e2.zip
Fixes to use libbu++ Bu::String
Diffstat (limited to '')
-rw-r--r--src/context.cpp34
1 files changed, 17 insertions, 17 deletions
diff --git a/src/context.cpp b/src/context.cpp
index 1125248..dc2e6a1 100644
--- a/src/context.cpp
+++ b/src/context.cpp
@@ -42,7 +42,7 @@ void Context::addFunction( Function *pFunction )
42 hFunction.insert( pFunction->getName(), pFunction ); 42 hFunction.insert( pFunction->getName(), pFunction );
43} 43}
44 44
45void Context::addVariable( const Bu::FString &sName, const Variable &vValue ) 45void Context::addVariable( const Bu::String &sName, const Variable &vValue )
46{ 46{
47 for( ScopeStack::iterator i = sVars.begin(); i; i++ ) 47 for( ScopeStack::iterator i = sVars.begin(); i; i++ )
48 { 48 {
@@ -61,12 +61,12 @@ void Context::addAction( Action *pAction )
61 hAction.insert( pAction->getName(), pAction ); 61 hAction.insert( pAction->getName(), pAction );
62} 62}
63 63
64Action *Context::getAction( const Bu::FString &sName ) 64Action *Context::getAction( const Bu::String &sName )
65{ 65{
66 return hAction.get( sName ); 66 return hAction.get( sName );
67} 67}
68 68
69void Context::addTargetToTag( Target *pTarget, const Bu::FString &sTag ) 69void Context::addTargetToTag( Target *pTarget, const Bu::String &sTag )
70{ 70{
71 if( !hTag.has( sTag ) ) 71 if( !hTag.has( sTag ) )
72 { 72 {
@@ -83,12 +83,12 @@ void Context::addTargetToTags( Target *pTarget, const StrList &sTags )
83 } 83 }
84} 84}
85 85
86TargetList &Context::getTag( const Bu::FString &sTag ) 86TargetList &Context::getTag( const Bu::String &sTag )
87{ 87{
88 return hTag.get( sTag ); 88 return hTag.get( sTag );
89} 89}
90 90
91Variable &Context::getVariable( const Bu::FString &sName ) 91Variable &Context::getVariable( const Bu::String &sName )
92{ 92{
93 for( ScopeStack::iterator i = sVars.begin(); i; i++ ) 93 for( ScopeStack::iterator i = sVars.begin(); i; i++ )
94 { 94 {
@@ -100,7 +100,7 @@ Variable &Context::getVariable( const Bu::FString &sName )
100 throw Bu::ExceptionBase("No such variable."); 100 throw Bu::ExceptionBase("No such variable.");
101} 101}
102 102
103void Context::delVariable( const Bu::FString &sName ) 103void Context::delVariable( const Bu::String &sName )
104{ 104{
105 for( ScopeStack::iterator i = sVars.begin(); i; i++ ) 105 for( ScopeStack::iterator i = sVars.begin(); i; i++ )
106 { 106 {
@@ -150,7 +150,7 @@ void Context::popScope()
150 sVars.pop(); 150 sVars.pop();
151} 151}
152 152
153Variable Context::call( const Bu::FString &sName, Variable &input, 153Variable Context::call( const Bu::String &sName, Variable &input,
154 VarList lParams ) 154 VarList lParams )
155{ 155{
156 if( !hFunction.has( sName ) ) 156 if( !hFunction.has( sName ) )
@@ -171,18 +171,18 @@ Variable Context::call( const Bu::FString &sName, Variable &input,
171 171
172#include <bu/sio.h> 172#include <bu/sio.h>
173using namespace Bu; 173using namespace Bu;
174Bu::FString Context::expand( const Bu::FString &sInS ) 174Bu::String Context::expand( const Bu::String &sInS )
175{ 175{
176 Bu::FString sRet; 176 Bu::String sRet;
177 Bu::FString sIn = sInS; 177 Bu::String sIn = sInS;
178 178
179 for( int iPass = 0; iPass < 2; iPass++ ) 179 for( int iPass = 0; iPass < 2; iPass++ )
180 { 180 {
181 Bu::FString::const_iterator b = sIn.begin(); 181 Bu::String::const_iterator b = sIn.begin();
182 sRet.clear(); 182 sRet.clear();
183 for(;;) 183 for(;;)
184 { 184 {
185 Bu::FString::const_iterator e = b.find('$'); 185 Bu::String::const_iterator e = b.find('$');
186 if( !e ) 186 if( !e )
187 { 187 {
188 sRet.append( b ); 188 sRet.append( b );
@@ -198,7 +198,7 @@ Bu::FString Context::expand( const Bu::FString &sInS )
198 { 198 {
199 b++; 199 b++;
200 e = b.find('}'); 200 e = b.find('}');
201 Bu::FString sVar( b, e ); 201 Bu::String sVar( b, e );
202 try 202 try
203 { 203 {
204 sRet.append( getVariable( sVar ).toString() ); 204 sRet.append( getVariable( sVar ).toString() );
@@ -214,8 +214,8 @@ Bu::FString Context::expand( const Bu::FString &sInS )
214 { 214 {
215 b++; 215 b++;
216 e = b.find(')'); 216 e = b.find(')');
217 Bu::FString sCmd( b, e ); 217 Bu::String sCmd( b, e );
218 Bu::FString sBuf; 218 Bu::String sBuf;
219 try 219 try
220 { 220 {
221 //sio << "Executing command: >>>" << sCmd << "<<<" << sio.nl; 221 //sio << "Executing command: >>>" << sCmd << "<<<" << sio.nl;
@@ -250,7 +250,7 @@ Bu::FString Context::expand( const Bu::FString &sInS )
250 return sRet; 250 return sRet;
251} 251}
252 252
253Target *Context::getTarget( const Bu::FString &sOutput ) 253Target *Context::getTarget( const Bu::String &sOutput )
254{ 254{
255 return hTarget.get( sOutput ); 255 return hTarget.get( sOutput );
256} 256}
@@ -347,7 +347,7 @@ void Context::buildTargetTree( Runner &r )
347 } 347 }
348} 348}
349 349
350void Context::buildTargetTree( class Runner &r, class Target *pTarget, const Bu::FString &sInput, Rule *pMaster, StrList &lNewIns ) 350void Context::buildTargetTree( class Runner &r, class Target *pTarget, const Bu::String &sInput, Rule *pMaster, StrList &lNewIns )
351{ 351{
352 Target *pNewTarget = NULL; 352 Target *pNewTarget = NULL;
353 for( RuleHash::iterator i = hRule.begin(); i; i++ ) 353 for( RuleHash::iterator i = hRule.begin(); i; i++ )