source: trunk/qmake/generators/makefiledeps.h@ 568

Last change on this file since 568 was 561, checked in by Dmitry A. Kuminov, 15 years ago

trunk: Merged in qt 4.6.1 sources.

File size: 4.6 KB
Line 
1/****************************************************************************
2**
3** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
4** All rights reserved.
5** Contact: Nokia Corporation ([email protected])
6**
7** This file is part of the qmake application of the Qt Toolkit.
8**
9** $QT_BEGIN_LICENSE:LGPL$
10** Commercial Usage
11** Licensees holding valid Qt Commercial licenses may use this file in
12** accordance with the Qt Commercial License Agreement provided with the
13** Software or, alternatively, in accordance with the terms contained in
14** a written agreement between you and Nokia.
15**
16** GNU Lesser General Public License Usage
17** Alternatively, this file may be used under the terms of the GNU Lesser
18** General Public License version 2.1 as published by the Free Software
19** Foundation and appearing in the file LICENSE.LGPL included in the
20** packaging of this file. Please review the following information to
21** ensure the GNU Lesser General Public License version 2.1 requirements
22** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
23**
24** In addition, as a special exception, Nokia gives you certain additional
25** rights. These rights are described in the Nokia Qt LGPL Exception
26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
27**
28** GNU General Public License Usage
29** Alternatively, this file may be used under the terms of the GNU
30** General Public License version 3.0 as published by the Free Software
31** Foundation and appearing in the file LICENSE.GPL included in the
32** packaging of this file. Please review the following information to
33** ensure the GNU General Public License version 3.0 requirements will be
34** met: http://www.gnu.org/copyleft/gpl.html.
35**
36** If you have questions regarding the use of this file, please contact
37** Nokia at [email protected].
38** $QT_END_LICENSE$
39**
40****************************************************************************/
41
42#ifndef MAKEFILEDEPS_H
43#define MAKEFILEDEPS_H
44
45#include <qstringlist.h>
46#include <qfileinfo.h>
47
48QT_BEGIN_NAMESPACE
49
50struct SourceFile;
51struct SourceDependChildren;
52class SourceFiles;
53
54class QMakeLocalFileName {
55 uint is_null : 1;
56 mutable QString real_name, local_name;
57public:
58 QMakeLocalFileName() : is_null(1) { }
59 QMakeLocalFileName(const QString &);
60 bool isNull() const { return is_null; }
61 inline const QString &real() const { return real_name; }
62 const QString &local() const;
63
64 bool operator==(const QMakeLocalFileName &other) {
65 return (this->real_name == other.real_name);
66 }
67 bool operator!=(const QMakeLocalFileName &other) {
68 return !(*this == other);
69 }
70};
71
72class QMakeSourceFileInfo
73{
74private:
75 //quick project lookups
76 SourceFiles *files, *includes;
77 bool files_changed;
78 QList<QMakeLocalFileName> depdirs;
79
80 //sleezy buffer code
81 char *spare_buffer;
82 int spare_buffer_size;
83 char *getBuffer(int s);
84
85 //actual guts
86 bool findMocs(SourceFile *);
87 bool findDeps(SourceFile *);
88 void dependTreeWalker(SourceFile *, SourceDependChildren *);
89
90 //cache
91 QString cachefile;
92
93protected:
94 virtual QMakeLocalFileName fixPathForFile(const QMakeLocalFileName &, bool forOpen=false);
95 virtual QMakeLocalFileName findFileForDep(const QMakeLocalFileName &, const QMakeLocalFileName &);
96 virtual QFileInfo findFileInfo(const QMakeLocalFileName &);
97
98public:
99 QMakeSourceFileInfo(const QString &cachefile="");
100 virtual ~QMakeSourceFileInfo();
101
102 QList<QMakeLocalFileName> dependencyPaths() const { return depdirs; }
103 void setDependencyPaths(const QList<QMakeLocalFileName> &);
104
105 enum DependencyMode { Recursive, NonRecursive };
106 inline void setDependencyMode(DependencyMode mode) { dep_mode = mode; }
107 inline DependencyMode dependencyMode() const { return dep_mode; }
108
109 enum SourceFileType { TYPE_UNKNOWN, TYPE_C, TYPE_UI, TYPE_QRC };
110 enum SourceFileSeek { SEEK_DEPS=0x01, SEEK_MOCS=0x02 };
111 void addSourceFiles(const QStringList &, uchar seek, SourceFileType type=TYPE_C);
112 void addSourceFile(const QString &, uchar seek, SourceFileType type=TYPE_C);
113 bool containsSourceFile(const QString &, SourceFileType type=TYPE_C);
114
115 int included(const QString &file);
116 QStringList dependencies(const QString &file);
117
118 bool mocable(const QString &file);
119
120 virtual QMap<QString, QStringList> getCacheVerification();
121 virtual bool verifyCache(const QMap<QString, QStringList> &);
122 void setCacheFile(const QString &cachefile); //auto caching
123 void loadCache(const QString &cf);
124 void saveCache(const QString &cf);
125
126private:
127 DependencyMode dep_mode;
128};
129
130QT_END_NAMESPACE
131
132#endif // MAKEFILEDEPS_H
Note: See TracBrowser for help on using the repository browser.