]> git.tdb.fi Git - builder.git/blobdiff - source/analyzer.h
Remove most container typedefs and refactor others
[builder.git] / source / analyzer.h
index b9afffa9e7e8896a58a10a53535f43fd4d823f85..373150b847690039a77e402a737e5d57c8bdef9f 100644 (file)
@@ -1,14 +1,9 @@
-/* $Id$
-
-This file is part of builder
-Copyright © 2006-2007, 2009  Mikko Rasa, Mikkosoft Productions
-Distributed under the LGPL
-*/
-
 #ifndef ANALYZER_H_
 #define ANALYZER_H_
 
 #include <list>
+#include <map>
+#include <set>
 #include <string>
 #include <vector>
 
@@ -23,45 +18,42 @@ class Analyzer
 public:
        enum Mode
        {
-               DEPS,     //< Skip over "trivial" targets such as Install and Compile
+               DEPS,     //< Skip over "trivial" targets such as InstalledFile
                ALLDEPS,  //< Print out absolutely every target
                REBUILD,  //< Print targets that are going to be rebuilt
-               RDEPS     //< Print targets that depend on the given targets (NYI)
+               RDEPS     //< Print targets that depend on the given targets
        };
 
 private:
-       typedef std::vector<std::string> TableRow;
-       typedef std::list<TableRow> Table;
+       using TableRow = std::vector<std::string>;
 
        Builder &builder;
        Mode mode;
-       Table table;
+       std::list<TableRow> table;
        unsigned max_depth;
        bool full_paths;
+       std::map<const Target *, std::set<Target *> > rdepends;
 
 public:
        Analyzer(Builder &);
+
        void set_mode(Mode m) { mode = m; }
        void set_max_depth(unsigned m) { max_depth = m; }
        void set_full_paths(bool f) { full_paths = f; }
 
-       /**
-       Performs the analysis and prints out the resulting dependency tree.
-       */
+       /// Performs the analysis and prints out the resulting dependency tree.
        void analyze();
 
 private:
-       /**
-       Adds rows to the table for the given target and its dependencies.
-       */
+       /** Adds rows for a target, then recursively adds rows for dependencies as
+       needed. */
        void build_depend_table(Target &, unsigned);
 
-       /**
-       Prints out the table that resulted from the analysis.
-       */
+       /// Prints out the table that resulted from the analysis.
        void print_table() const;
 
-       static bool target_order(Target *, Target *);
+       static bool target_order(const Target *, const Target *);
+       static bool target_order_full(const Target *, const Target *);
 };
 
 #endif