aboutsummaryrefslogtreecommitdiff
path: root/src/profile.cpp
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2012-11-08 22:58:28 +0000
committerMike Buland <eichlan@xagasoft.com>2012-11-08 22:58:28 +0000
commit52be1ef0d126f09ba943c7afcf367e7d9347f2fd (patch)
treefd4b0dd148751c3c6c1b95296c3b82cb86051b83 /src/profile.cpp
parent795d0737fed40d88a7801b451b7750ba90802345 (diff)
downloadbuild-52be1ef0d126f09ba943c7afcf367e7d9347f2fd.tar.gz
build-52be1ef0d126f09ba943c7afcf367e7d9347f2fd.tar.bz2
build-52be1ef0d126f09ba943c7afcf367e7d9347f2fd.tar.xz
build-52be1ef0d126f09ba943c7afcf367e7d9347f2fd.zip
tabconv: it's all spaces now.
Diffstat (limited to '')
-rw-r--r--src/profile.cpp102
1 files changed, 51 insertions, 51 deletions
diff --git a/src/profile.cpp b/src/profile.cpp
index a9c1d5b..20251c3 100644
--- a/src/profile.cpp
+++ b/src/profile.cpp
@@ -10,92 +10,92 @@
10using namespace Bu; 10using namespace Bu;
11 11
12Profile::Profile( const class AstBranch *pRoot ) : 12Profile::Profile( const class AstBranch *pRoot ) :
13 pRoot( pRoot ), 13 pRoot( pRoot ),
14 pCond( NULL ), 14 pCond( NULL ),
15 pAst( NULL ) 15 pAst( NULL )
16{ 16{
17 sName = dynamic_cast<const AstLeaf *>( 17 sName = dynamic_cast<const AstLeaf *>(
18 (*pRoot->getBranchBegin()).first() 18 (*pRoot->getBranchBegin()).first()
19 )->getStrValue(); 19 )->getStrValue();
20 20
21 setCondition(); 21 setCondition();
22} 22}
23 23
24Profile::Profile( const Profile &rSrc ) : 24Profile::Profile( const Profile &rSrc ) :
25 sName( rSrc.sName ), 25 sName( rSrc.sName ),
26 pRoot( rSrc.pRoot ), 26 pRoot( rSrc.pRoot ),
27 pCond( rSrc.pCond->clone() ), 27 pCond( rSrc.pCond->clone() ),
28 pAst( NULL ) 28 pAst( NULL )
29{ 29{
30} 30}
31 31
32Profile::~Profile() 32Profile::~Profile()
33{ 33{
34 delete pAst; 34 delete pAst;
35 pAst = NULL; 35 pAst = NULL;
36} 36}
37 37
38const Bu::String &Profile::getName() const 38const Bu::String &Profile::getName() const
39{ 39{
40 return sName; 40 return sName;
41} 41}
42 42
43const AstBranch *Profile::getRoot() const 43const AstBranch *Profile::getRoot() const
44{ 44{
45 return pRoot; 45 return pRoot;
46} 46}
47 47
48const Condition *Profile::getCond() const 48const Condition *Profile::getCond() const
49{ 49{
50 return pCond; 50 return pCond;
51} 51}
52 52
53bool Profile::shouldExec( class Runner &r, class Target &rTarget ) const 53bool Profile::shouldExec( class Runner &r, class Target &rTarget ) const
54{ 54{
55 return pCond->shouldExec( r, rTarget ); 55 return pCond->shouldExec( r, rTarget );
56} 56}
57 57
58Profile *Profile::genDefaultClean() 58Profile *Profile::genDefaultClean()
59{ 59{
60 Ast *pAst = new Ast(); 60 Ast *pAst = new Ast();
61 pAst->addNode( AstNode::typeProfile ); 61 pAst->addNode( AstNode::typeProfile );
62 pAst->openBranch(); 62 pAst->openBranch();
63 pAst->addNode( AstNode::typeString, "clean" ); 63 pAst->addNode( AstNode::typeString, "clean" );
64 pAst->openBranch(); 64 pAst->openBranch();
65 pAst->addNode( AstNode::typeCondition, "fileExists" ); 65 pAst->addNode( AstNode::typeCondition, "fileExists" );
66 pAst->addNode( AstNode::typeFunction ); 66 pAst->addNode( AstNode::typeFunction );
67 pAst->openBranch(); 67 pAst->openBranch();
68 pAst->addNode( AstNode::typeString, "unlink" ); 68 pAst->addNode( AstNode::typeString, "unlink" );
69 pAst->openBranch(); 69 pAst->openBranch();
70 pAst->addNode( AstNode::typeVariable, "OUTPUT" ); 70 pAst->addNode( AstNode::typeVariable, "OUTPUT" );
71 pAst->closeNode(); 71 pAst->closeNode();
72 pAst->closeNode(); 72 pAst->closeNode();
73 //pAst->closeNode(); 73 //pAst->closeNode();
74 Profile *pRet = new Profile( 74 Profile *pRet = new Profile(
75 dynamic_cast<const AstBranch *>(*pAst->getNodeBegin()) 75 dynamic_cast<const AstBranch *>(*pAst->getNodeBegin())
76 ); 76 );
77 pRet->pAst = pAst; 77 pRet->pAst = pAst;
78 78
79 return pRet; 79 return pRet;
80} 80}
81 81
82void Profile::setCondition() 82void Profile::setCondition()
83{ 83{
84 for( AstBranch::NodeList::const_iterator i = 84 for( AstBranch::NodeList::const_iterator i =
85 (*(pRoot->getBranchBegin()+1)).begin(); i; i++ ) 85 (*(pRoot->getBranchBegin()+1)).begin(); i; i++ )
86 { 86 {
87 if( (*i)->getType() == AstNode::typeCondition ) 87 if( (*i)->getType() == AstNode::typeCondition )
88 { 88 {
89 Bu::String sCond = dynamic_cast<const AstLeaf *>(*i)->getStrValue(); 89 Bu::String sCond = dynamic_cast<const AstLeaf *>(*i)->getStrValue();
90 delete pCond; 90 delete pCond;
91 pCond = ConditionPlugger::getInstance().instantiate( sCond ); 91 pCond = ConditionPlugger::getInstance().instantiate( sCond );
92 } 92 }
93 } 93 }
94 94
95 if( pCond == NULL ) 95 if( pCond == NULL )
96 { 96 {
97 // The default condition 97 // The default condition
98 pCond = ConditionPlugger::getInstance().instantiate("fileTime"); 98 pCond = ConditionPlugger::getInstance().instantiate("fileTime");
99 } 99 }
100} 100}
101 101