aboutsummaryrefslogtreecommitdiff
path: root/src/rule.h
blob: d8accf0aa4d9b6268fd891e2a9f487d4a211385c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#ifndef RULE_H
#define RULE_H

#include "types.h"
#include <bu/formatter.h>

class Rule
{
	friend Bu::Formatter &operator<<( Bu::Formatter &f, const Rule &t );
public:
	Rule( const Bu::String &sName );
	virtual ~Rule();

	const Bu::String &getName() const;

	void setInput( const AstBranch *pNewInput );
	const AstBranch *getInput() const;

	bool hasOutputs() const;

	void addOutput( const AstBranch *pNewOutput );
	void addProfile( const AstBranch *pProfile );

	void prepTarget( class Target *pTarget );
	class Target *createTarget( class Runner &r, const Bu::String &sInput,
			class Target *pParent );
	bool ruleMatches( class Runner &r, const Bu::String &sInput );

	void addTag( const Bu::String &sTag );
	const StrList &getTagList() const;

	void setDisplay( const Bu::String &sStr );
	const Bu::String &getDisplay() const;

	void addRequires( const AstBranch *pBr );

private:
	Bu::String sName;
	Bu::String sDisplay;
	const AstBranch *pInput;
	AstBranchList lOutput;
	ProfileHash hProfiles;
	StrList lsTags;
	AstBranchList lRequires;
};

Bu::Formatter &operator<<( Bu::Formatter &f, const Rule &t );

namespace Bu
{
	template<> Bu::Formatter &operator<< <Rule>( Bu::Formatter &f, const Rule *t );
};

#endif