aboutsummaryrefslogtreecommitdiff
path: root/src/build.h
blob: fe71d308ced110f84cd955dd2e6bfa02b2874975 (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
55
56
57
58
#ifndef BUILD_H
#define BUILD_H

#include <stdint.h>

#include <map>
#include <string>

#include "exceptions.h"
#include "rule.h"
#include "target.h"
#include "action.h"

subExceptionDecl( BuildException );

class Build
{
public:
	Build();
	virtual ~Build();

	/**
	 * Adds a target to the build.  If the target already exists, this will
	 * attempt to merge them as best it can.  If there are any conflicts, it
	 * will throw an exception.
	 *@param pTarget A pointer to a Target object that Build takes ownership of.
	 */
	void addTarget( Target *pTarget );
	void addRequires( const std::string &who, const std::string &what );
	void addRule( Rule *pRule );

	void set( const std::string &cont, const std::string &var, const std::string &val );
	void setAdd( const std::string &cont, const std::string &var, const std::string &val );
	std::string getVar( const std::string &cont, const std::string &var );

	void debugDump();

private:
	typedef std::map<std::string, Target *> TargetMap;
	typedef std::list<std::string> StringList;
	typedef std::map<std::string, StringList> ReqMap;
	typedef std::map<std::string, std::string> VarMap;
	typedef std::map<std::string, VarMap> ContextMap;
	typedef std::map<std::string, Rule *> RuleMap;

	TargetMap mTarget;
	ReqMap mRequires;
	VarMap mVars;
	ContextMap mContVars;
	RuleMap mRule;

	//std::map<std::string, Rule *> mRule;
	//Action *pActDefault;
	//std::map<std::string, Action *> mAction;

};

#endif