1 /****************************************************************************
3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
4 ** All rights reserved.
5 ** Contact: Nokia Corporation (qt-info@nokia.com)
7 ** This file is part of the qmake application of the Qt Toolkit.
9 ** $QT_BEGIN_LICENSE:LGPL$
10 ** No Commercial Usage
11 ** This file contains pre-release code and may not be distributed.
12 ** You may use this file in accordance with the terms and conditions
13 ** contained in the Technology Preview License Agreement accompanying
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.
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.
28 ** If you have questions regarding the use of this file, please contact
29 ** Nokia at qt-info@nokia.com.
40 ****************************************************************************/
42 #ifndef MAKEFILEDEPS_H
43 #define MAKEFILEDEPS_H
45 #include <qstringlist.h>
46 #include <qfileinfo.h>
51 struct SourceDependChildren
;
54 class QMakeLocalFileName
{
56 mutable QString real_name
, local_name
;
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;
64 bool operator==(const QMakeLocalFileName
&other
) {
65 return (this->real_name
== other
.real_name
);
67 bool operator!=(const QMakeLocalFileName
&other
) {
68 return !(*this == other
);
72 class QMakeSourceFileInfo
75 //quick project lookups
76 SourceFiles
*files
, *includes
;
78 QList
<QMakeLocalFileName
> depdirs
;
82 int spare_buffer_size
;
83 char *getBuffer(int s
);
86 bool findMocs(SourceFile
*);
87 bool findDeps(SourceFile
*);
88 void dependTreeWalker(SourceFile
*, SourceDependChildren
*);
94 virtual QMakeLocalFileName
fixPathForFile(const QMakeLocalFileName
&, bool forOpen
=false);
95 virtual QMakeLocalFileName
findFileForDep(const QMakeLocalFileName
&, const QMakeLocalFileName
&);
96 virtual QFileInfo
findFileInfo(const QMakeLocalFileName
&);
99 QMakeSourceFileInfo(const QString
&cachefile
="");
100 virtual ~QMakeSourceFileInfo();
102 QList
<QMakeLocalFileName
> dependencyPaths() const { return depdirs
; }
103 void setDependencyPaths(const QList
<QMakeLocalFileName
> &);
105 enum DependencyMode
{ Recursive
, NonRecursive
};
106 inline void setDependencyMode(DependencyMode mode
) { dep_mode
= mode
; }
107 inline DependencyMode
dependencyMode() const { return dep_mode
; }
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
);
115 int included(const QString
&file
);
116 QStringList
dependencies(const QString
&file
);
118 bool mocable(const QString
&file
);
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
);
127 DependencyMode dep_mode
;
132 #endif // MAKEFILEDEPS_H