summaryrefslogtreecommitdiffstats
path: root/src/state.cc
diff options
context:
space:
mode:
authorRobert Iannucci <robbie@rail.com>2012-10-01 20:51:00 (GMT)
committerRobert A Iannucci Jr <iannucci@chromium.org>2012-11-09 04:25:39 (GMT)
commit8775c4d1e3630230dcea202f2d1647e56a81c20f (patch)
treec603c0d2f6063647703ef00dbf3c1c2e9e377a79 /src/state.cc
parent93e509469953a90f31afc838536b82568da397b2 (diff)
downloadNinja-8775c4d1e3630230dcea202f2d1647e56a81c20f.zip
Ninja-8775c4d1e3630230dcea202f2d1647e56a81c20f.tar.gz
Ninja-8775c4d1e3630230dcea202f2d1647e56a81c20f.tar.bz2
Pull out base changes to state
Diffstat (limited to 'src/state.cc')
-rw-r--r--src/state.cc17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/state.cc b/src/state.cc
index 4c7168b..0697e48 100644
--- a/src/state.cc
+++ b/src/state.cc
@@ -22,10 +22,12 @@
#include "metrics.h"
#include "util.h"
+const Pool State::kDefaultPool("", 0);
const Rule State::kPhonyRule("phony");
State::State() {
AddRule(&kPhonyRule);
+ AddPool(&kDefaultPool);
}
void State::AddRule(const Rule* rule) {
@@ -40,7 +42,20 @@ const Rule* State::LookupRule(const string& rule_name) {
return i->second;
}
-Edge* State::AddEdge(const Rule* rule) {
+void State::AddPool(const Pool* pool) {
+ assert(LookupPool(pool->name()) == NULL);
+ pools_[pool->name()] = pool;
+}
+
+const Pool* State::LookupPool(const string& pool_name) {
+ map<string, const Pool*>::iterator i = pools_.find(pool_name);
+ if (i == pools_.end())
+ return NULL;
+ return i->second;
+}
+
+Edge* State::AddEdge(const Rule* rule, const Pool* pool) {
+ // FIXME(iannucci): do something with pool
Edge* edge = new Edge();
edge->rule_ = rule;
edge->env_ = &bindings_;