ENH: keep cleaning up Tcl/Tk modules
[cmake.git] / Source / cmDependsC.h
blob41db4208122762cab0744608bad8b816dfa16d78
1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmDependsC.h,v $
5 Language: C++
6 Date: $Date: 2007-02-05 14:48:38 $
7 Version: $Revision: 1.20 $
9 Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
10 See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
12 This software is distributed WITHOUT ANY WARRANTY; without even
13 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 PURPOSE. See the above copyright notices for more information.
16 =========================================================================*/
17 #ifndef cmDependsC_h
18 #define cmDependsC_h
20 #include "cmDepends.h"
21 #include <cmsys/RegularExpression.hxx>
22 #include <queue>
24 /** \class cmDependsC
25 * \brief Dependency scanner for C and C++ object files.
27 class cmDependsC: public cmDepends
29 public:
30 /** Checking instances need to know the build directory name and the
31 relative path from the build directory to the target file. */
32 cmDependsC();
33 cmDependsC(std::vector<std::string> const& includes,
34 const char* scanRegex, const char* complainRegex,
35 const cmStdString& cachFileName);
37 /** Virtual destructor to cleanup subclasses properly. */
38 virtual ~cmDependsC();
40 protected:
41 typedef std::vector<char> t_CharBuffer;
43 // Implement writing/checking methods required by superclass.
44 virtual bool WriteDependencies(const char *src,
45 const char *file,
46 std::ostream& makeDepends,
47 std::ostream& internalDepends);
49 // Method to scan a single file.
50 void Scan(std::istream& is, const char* directory,
51 const cmStdString& fullName);
53 // The include file search path.
54 std::vector<std::string> const* IncludePath;
56 // Regular expression to identify C preprocessor include directives.
57 cmsys::RegularExpression IncludeRegexLine;
59 // Regular expressions to choose which include files to scan
60 // recursively and which to complain about not finding.
61 cmsys::RegularExpression IncludeRegexScan;
62 cmsys::RegularExpression IncludeRegexComplain;
63 const std::string IncludeRegexLineString;
64 const std::string IncludeRegexScanString;
65 const std::string IncludeRegexComplainString;
67 public:
68 // Data structures for dependency graph walk.
69 struct UnscannedEntry
71 cmStdString FileName;
72 cmStdString QuotedLocation;
75 struct cmIncludeLines
77 cmIncludeLines(): Used(false) {}
78 std::vector<UnscannedEntry> UnscannedEntries;
79 bool Used;
81 protected:
82 std::set<cmStdString> Encountered;
83 std::queue<UnscannedEntry> Unscanned;
84 t_CharBuffer Buffer;
86 std::map<cmStdString, cmIncludeLines *> FileCache;
87 std::map<cmStdString, cmStdString> HeaderLocationCache;
89 cmStdString CacheFileName;
91 void WriteCacheFile() const;
92 void ReadCacheFile();
93 private:
94 cmDependsC(cmDependsC const&); // Purposely not implemented.
95 void operator=(cmDependsC const&); // Purposely not implemented.
98 #endif