diff options
author | Jan Niklas Hasse <jhasse@bixense.com> | 2020-11-28 11:22:23 (GMT) |
---|---|---|
committer | Jan Niklas Hasse <jhasse@bixense.com> | 2020-11-28 11:22:23 (GMT) |
commit | 9cf70a20685ac3bd48fceac2ea268d449c7e78d5 (patch) | |
tree | 433402b91ee03f5a476da5c0bdb26f6d3bad7809 /src/state.h | |
parent | a1f879b29c9aafe6a2bc0ba885701f8f4f19f772 (diff) | |
parent | ed056bdd8c8d578a9952bd93b76f29c14199c85b (diff) | |
download | Ninja-9cf70a20685ac3bd48fceac2ea268d449c7e78d5.zip Ninja-9cf70a20685ac3bd48fceac2ea268d449c7e78d5.tar.gz Ninja-9cf70a20685ac3bd48fceac2ea268d449c7e78d5.tar.bz2 |
Merge branch 'master' into release
Diffstat (limited to 'src/state.h')
-rw-r--r-- | src/state.h | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/src/state.h b/src/state.h index 6fe886c..f553ed4 100644 --- a/src/state.h +++ b/src/state.h @@ -19,7 +19,6 @@ #include <set> #include <string> #include <vector> -using namespace std; #include "eval_env.h" #include "hash_map.h" @@ -38,13 +37,13 @@ struct Rule; /// the total scheduled weight diminishes enough (i.e. when a scheduled edge /// completes). struct Pool { - Pool(const string& name, int depth) + Pool(const std::string& name, int depth) : name_(name), current_use_(0), depth_(depth), delayed_(&WeightedEdgeCmp) {} // A depth of 0 is infinite bool is_valid() const { return depth_ >= 0; } int depth() const { return depth_; } - const string& name() const { return name_; } + const std::string& name() const { return name_; } int current_use() const { return current_use_; } /// true if the Pool might delay this edge @@ -62,13 +61,13 @@ struct Pool { void DelayEdge(Edge* edge); /// Pool will add zero or more edges to the ready_queue - void RetrieveReadyEdges(set<Edge*>* ready_queue); + void RetrieveReadyEdges(std::set<Edge*>* ready_queue); /// Dump the Pool and its edges (useful for debugging). void Dump() const; private: - string name_; + std::string name_; /// |current_use_| is the total of the weights of the edges which are /// currently scheduled in the Plan (i.e. the edges in Plan::ready_). @@ -77,7 +76,7 @@ struct Pool { static bool WeightedEdgeCmp(const Edge* a, const Edge* b); - typedef set<Edge*,bool(*)(const Edge*, const Edge*)> DelayedEdges; + typedef std::set<Edge*,bool(*)(const Edge*, const Edge*)> DelayedEdges; DelayedEdges delayed_; }; @@ -90,17 +89,17 @@ struct State { State(); void AddPool(Pool* pool); - Pool* LookupPool(const string& pool_name); + Pool* LookupPool(const std::string& pool_name); Edge* AddEdge(const Rule* rule); Node* GetNode(StringPiece path, uint64_t slash_bits); Node* LookupNode(StringPiece path) const; - Node* SpellcheckNode(const string& path); + Node* SpellcheckNode(const std::string& path); void AddIn(Edge* edge, StringPiece path, uint64_t slash_bits); bool AddOut(Edge* edge, StringPiece path, uint64_t slash_bits); - bool AddDefault(StringPiece path, string* error); + bool AddDefault(StringPiece path, std::string* error); /// Reset state. Keeps all nodes and edges, but restores them to the /// state where we haven't yet examined the disk for dirty state. @@ -111,21 +110,21 @@ struct State { /// @return the root node(s) of the graph. (Root nodes have no output edges). /// @param error where to write the error message if somethings went wrong. - vector<Node*> RootNodes(string* error) const; - vector<Node*> DefaultNodes(string* error) const; + std::vector<Node*> RootNodes(std::string* error) const; + std::vector<Node*> DefaultNodes(std::string* error) const; /// Mapping of path -> Node. typedef ExternalStringHashMap<Node*>::Type Paths; Paths paths_; /// All the pools used in the graph. - map<string, Pool*> pools_; + std::map<std::string, Pool*> pools_; /// All the edges of the graph. - vector<Edge*> edges_; + std::vector<Edge*> edges_; BindingEnv bindings_; - vector<Node*> defaults_; + std::vector<Node*> defaults_; }; #endif // NINJA_STATE_H_ |