aboutsummaryrefslogtreecommitdiff
path: root/src/target.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/target.h')
-rw-r--r--src/target.h89
1 files changed, 89 insertions, 0 deletions
diff --git a/src/target.h b/src/target.h
new file mode 100644
index 0000000..766366a
--- /dev/null
+++ b/src/target.h
@@ -0,0 +1,89 @@
1#ifndef TARGET_H
2#define TARGET_H
3
4#include "types.h"
5#include <bu/formatter.h>
6
7class Target
8{
9 friend Bu::Formatter &operator<<( Bu::Formatter &f, const Target &t );
10public:
11 Target( bool bExplicit );
12 Target( const Bu::FString &sOutput, bool bExplicit );
13 virtual ~Target();
14
15 void addInput( const Bu::FString &sInput );
16 const StrList &getInputList() const;
17 void resetInputList( const StrList &lInputs );
18
19 void addRequires( const Bu::FString &sReq );
20 void addRequires( const AstBranch *pBr );
21 const StrList &getRequiresList() const;
22 void buildRequires( class Runner &r );
23
24 void addOutput( const Bu::FString &sOutput );
25 const StrList &getOutputList() const;
26
27 void setPrefix( const Bu::FString &sPrefix );
28 const Bu::FString &getPrefix() const;
29
30 void setRule( const Bu::FString &sRule );
31 const Bu::FString &getRule() const;
32 bool hasRule() const;
33
34 bool isExplicit() const;
35
36 void addDep( Target *pDep );
37 const TargetList &getDepList() const;
38
39 void addProfile( const class AstBranch *pProfRoot );
40 void addProfile( const class Profile *pSrc );
41 bool hasProfile( const Bu::FString &sName ) const;
42 const class Profile *getProfile( const Bu::FString &sName ) const;
43
44 void setVars( const VarHash &hNewVars );
45 const VarHash &getVars() const;
46
47 void setDisplay( const Bu::FString &sNewDisplay );
48 const Bu::FString &getDisplay() const;
49
50 void process( class Runner &r, const Bu::FString &sProfile );
51
52 void mergeUnder( const Target *pSrc );
53
54 bool hasRun();
55
56 void resetRun( bool bHasRun=true );
57 void setDepCount();
58 int getDepCount() const;
59
60 void collapseDeps();
61
62private:
63 void mergeUnder( const VarHash &hVars );
64 void merge( StrList &lOut, const StrList &lIn );
65
66private:
67 bool bExplicit;
68 StrList lsInput;
69 StrList lsRequires;
70 StrList lsOutput;
71 Bu::FString sPrefix;
72 Bu::FString sRule;
73 VarHash hVars;
74 TargetList lDeps;
75 ProfileHash hProfiles;
76 Bu::FString sDisplay;
77 bool bRun;
78 AstBranchList lbRequires;
79 int iDepCount;
80};
81
82Bu::Formatter &operator<<( Bu::Formatter &f, const Target &t );
83
84namespace Bu
85{
86 template<> Bu::Formatter &operator<< <Target>( Bu::Formatter &f, const Target *t );
87};
88
89#endif