Ninja
Public Member Functions | Private Attributes | List of all members
InputsCollector Struct Reference

A class used to collect the transitive set of inputs from a given set of starting nodes. More...

#include <graph.h>

Public Member Functions

std::vector< std::string > GetInputsAsStrings (bool shell_escape=false) const
 Same as inputs(), but returns the list of visited nodes as a list of strings, with optional shell escaping. More...
 
const std::vector< const Node * > & inputs () const
 Retrieve list of visited input nodes. More...
 
void Reset ()
 Reset collector state. More...
 
void VisitNode (const Node *node)
 Visit a single. More...
 

Private Attributes

std::vector< const Node * > inputs_
 
std::set< const Node * > visited_nodes_
 

Detailed Description

A class used to collect the transitive set of inputs from a given set of starting nodes.

Used to implement the inputs tool.

When collecting inputs, the outputs of phony edges are always ignored from the result, but are followed by the dependency walk.

Usage is:

Definition at line 442 of file graph.h.

Member Function Documentation

◆ GetInputsAsStrings()

std::vector< std::string > InputsCollector::GetInputsAsStrings ( bool  shell_escape = false) const

Same as inputs(), but returns the list of visited nodes as a list of strings, with optional shell escaping.

Definition at line 786 of file graph.cc.

References GetShellEscapedString(), and GetWin32EscapedString().

Referenced by TEST_F().

◆ inputs()

const std::vector<const Node*>& InputsCollector::inputs ( ) const
inline

Retrieve list of visited input nodes.

A dependency always appears before its dependents in the result, but final order depends on the order of the VisitNode() calls performed before this.

Definition at line 449 of file graph.h.

References inputs_.

◆ Reset()

void InputsCollector::Reset ( )
inline

Reset collector state.

Definition at line 456 of file graph.h.

References inputs_, and visited_nodes_.

Referenced by TEST_F().

◆ VisitNode()

void InputsCollector::VisitNode ( const Node node)

Visit a single.

  • node during this collection.

Definition at line 764 of file graph.cc.

References Node::in_edge(), Edge::inputs_, and Edge::is_phony().

Referenced by TEST_F().

Member Data Documentation

◆ inputs_

std::vector<const Node*> InputsCollector::inputs_
private

Definition at line 462 of file graph.h.

Referenced by inputs(), and Reset().

◆ visited_nodes_

std::set<const Node*> InputsCollector::visited_nodes_
private

Definition at line 463 of file graph.h.

Referenced by Reset().


The documentation for this struct was generated from the following files: