X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fanalyzer.h;h=d30de049bab557ed7c0195be8a9471b4d378f9ff;hb=451ef4f33b5a57dcb56bd7cb671bed359ac86247;hp=6d6af9b5ab5706a076617bd6e9a500cf84052ee3;hpb=e7fe6a0e161cbba80ef924f53792eded80cbb3a1;p=builder.git diff --git a/source/analyzer.h b/source/analyzer.h index 6d6af9b..d30de04 100644 --- a/source/analyzer.h +++ b/source/analyzer.h @@ -1,14 +1,7 @@ -/* $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 +#include #include #include #include @@ -24,43 +17,38 @@ 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 }; private: - typedef std::vector TableRow; - typedef std::list Table; + using TableRow = std::vector; Builder &builder; - Mode mode; - Table table; - unsigned max_depth; - bool full_paths; + Mode mode = DEPS; + std::vector table; + unsigned max_depth = 0; + bool full_paths = false; std::map > rdepends; public: - Analyzer(Builder &); + Analyzer(Builder &b): builder(b) { } + 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. - */ - void build_depend_table(const Target &, unsigned); + /** 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(const Target *, const Target *);