-rw-r--r-- | qmake/project.h | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/qmake/project.h b/qmake/project.h index ec19f0c..0ca2a92 100644 --- a/qmake/project.h +++ b/qmake/project.h | |||
@@ -1,114 +1,121 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** $Id$ | 2 | ** |
3 | ** | 3 | ** |
4 | ** Definition of ________ class. | 4 | ** Definition of QMakeProject class. |
5 | ** | 5 | ** |
6 | ** Created : 970521 | 6 | ** Copyright (C) 1992-2003 Trolltech AS. All rights reserved. |
7 | ** | 7 | ** |
8 | ** Copyright (C) 1992-2002 Trolltech AS. All rights reserved. | 8 | ** This file is part of qmake. |
9 | ** | ||
10 | ** This file is part of the network module of the Qt GUI Toolkit. | ||
11 | ** | 9 | ** |
12 | ** This file may be distributed under the terms of the Q Public License | 10 | ** This file may be distributed under the terms of the Q Public License |
13 | ** as defined by Trolltech AS of Norway and appearing in the file | 11 | ** as defined by Trolltech AS of Norway and appearing in the file |
14 | ** LICENSE.QPL included in the packaging of this file. | 12 | ** LICENSE.QPL included in the packaging of this file. |
15 | ** | 13 | ** |
16 | ** This file may be distributed and/or modified under the terms of the | 14 | ** This file may be distributed and/or modified under the terms of the |
17 | ** GNU General Public License version 2 as published by the Free Software | 15 | ** GNU General Public License version 2 as published by the Free Software |
18 | ** Foundation and appearing in the file LICENSE.GPL included in the | 16 | ** Foundation and appearing in the file LICENSE.GPL included in the |
19 | ** packaging of this file. | 17 | ** packaging of this file. |
20 | ** | 18 | ** |
21 | ** Licensees holding valid Qt Enterprise Edition licenses may use this | 19 | ** Licensees holding valid Qt Enterprise Edition licenses may use this |
22 | ** file in accordance with the Qt Commercial License Agreement provided | 20 | ** file in accordance with the Qt Commercial License Agreement provided |
23 | ** with the Software. | 21 | ** with the Software. |
24 | ** | 22 | ** |
25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 23 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 24 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
27 | ** | 25 | ** |
28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for | 26 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for |
29 | ** information about Qt Commercial License Agreements. | 27 | ** information about Qt Commercial License Agreements. |
30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. | 28 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. |
31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 29 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
32 | ** | 30 | ** |
33 | ** Contact info@trolltech.com if any conditions of this licensing are | 31 | ** Contact info@trolltech.com if any conditions of this licensing are |
34 | ** not clear to you. | 32 | ** not clear to you. |
35 | ** | 33 | ** |
36 | **********************************************************************/ | 34 | **********************************************************************/ |
35 | |||
37 | #ifndef __PROJECT_H__ | 36 | #ifndef __PROJECT_H__ |
38 | #define __PROJECT_H__ | 37 | #define __PROJECT_H__ |
39 | 38 | ||
40 | #include <qstringlist.h> | 39 | #include <qstringlist.h> |
41 | #include <qstring.h> | 40 | #include <qstring.h> |
42 | #include <qmap.h> | 41 | #include <qmap.h> |
43 | 42 | ||
43 | class QMakeProperty; | ||
44 | |||
44 | class QMakeProject | 45 | class QMakeProject |
45 | { | 46 | { |
46 | enum TestStatus { TestNone, TestFound, TestSeek } test_status; | 47 | enum TestStatus { TestNone, TestFound, TestSeek } test_status; |
47 | int scope_block, scope_flag; | 48 | int scope_block, scope_flag; |
48 | 49 | ||
49 | QString pfile, cfile; | 50 | QString pfile, cfile; |
51 | QMakeProperty *prop; | ||
52 | void reset(); | ||
50 | QMap<QString, QStringList> vars, base_vars, cache; | 53 | QMap<QString, QStringList> vars, base_vars, cache; |
51 | bool parse(const QString &text, QMap<QString, QStringList> &place); | 54 | bool parse(const QString &text, QMap<QString, QStringList> &place); |
52 | bool doProjectTest(const QString &func, const QString ¶ms, QMap<QString, QStringList> &place); | 55 | bool doProjectTest(const QString &func, const QString ¶ms, QMap<QString, QStringList> &place); |
53 | bool doProjectTest(const QString &func, QStringList args, QMap<QString, QStringList> &place); | 56 | bool doProjectTest(const QString &func, QStringList args, QMap<QString, QStringList> &place); |
54 | bool doProjectCheckReqs(const QStringList &deps, QMap<QString, QStringList> &place); | 57 | bool doProjectCheckReqs(const QStringList &deps, QMap<QString, QStringList> &place); |
55 | QString doVariableReplace(QString &str, const QMap<QString, QStringList> &place); | 58 | QString doVariableReplace(QString &str, const QMap<QString, QStringList> &place); |
56 | 59 | ||
57 | public: | 60 | public: |
58 | QMakeProject(); | 61 | QMakeProject(); |
62 | QMakeProject(QMakeProperty *); | ||
63 | |||
64 | enum { ReadCache=0x01, ReadConf=0x02, ReadCmdLine=0x04, ReadProFile=0x08, ReadPostFiles=0x10, ReadAll=0xFF }; | ||
65 | bool read(const QString &project, const QString &pwd, uchar cmd=ReadAll); | ||
66 | bool read(uchar cmd=ReadAll); | ||
59 | 67 | ||
60 | bool read(const QString &project, const QString &pwd, bool just_project=FALSE); | ||
61 | QString projectFile(); | 68 | QString projectFile(); |
62 | QString configFile(); | 69 | QString configFile(); |
63 | 70 | ||
64 | bool isEmpty(const QString &v); | 71 | bool isEmpty(const QString &v); |
65 | QStringList &values(const QString &v); | 72 | QStringList &values(const QString &v); |
66 | QString first(const QString &v); | 73 | QString first(const QString &v); |
67 | QMap<QString, QStringList> &variables(); | 74 | QMap<QString, QStringList> &variables(); |
68 | bool isActiveConfig(const QString &x, bool regex=FALSE); | 75 | bool isActiveConfig(const QString &x, bool regex=FALSE, QMap<QString, QStringList> *place=NULL); |
69 | 76 | ||
70 | protected: | 77 | protected: |
71 | friend class MakefileGenerator; | 78 | friend class MakefileGenerator; |
72 | bool read(const QString &file, QMap<QString, QStringList> &place); | 79 | bool read(const QString &file, QMap<QString, QStringList> &place); |
73 | 80 | ||
74 | }; | 81 | }; |
75 | 82 | ||
76 | inline QString QMakeProject::projectFile() | 83 | inline QString QMakeProject::projectFile() |
77 | { | 84 | { |
78 | #if defined(Q_CC_SUN) && (__SUNPRO_CC == 0x500) || defined(Q_CC_HP) | 85 | #if defined(Q_CC_SUN) && (__SUNPRO_CC == 0x500) || defined(Q_CC_HP) |
79 | // workaround for Sun WorkShop 5.0 bug fixed in Forte 6 | 86 | // workaround for Sun WorkShop 5.0 bug fixed in Forte 6 |
80 | if (pfile == "-") | 87 | if (pfile == "-") |
81 | return QString("(stdin)"); | 88 | return QString("(stdin)"); |
82 | else | 89 | else |
83 | return pfile; | 90 | return pfile; |
84 | #else | 91 | #else |
85 | return pfile == "-" ? QString("(stdin)") : pfile; | 92 | return pfile == "-" ? QString("(stdin)") : pfile; |
86 | #endif | 93 | #endif |
87 | } | 94 | } |
88 | 95 | ||
89 | inline QString QMakeProject::configFile() | 96 | inline QString QMakeProject::configFile() |
90 | { return cfile; } | 97 | { return cfile; } |
91 | 98 | ||
92 | inline bool QMakeProject::isEmpty(const QString &v) | 99 | inline bool QMakeProject::isEmpty(const QString &v) |
93 | { return !vars.contains(v) || vars[v].isEmpty(); } | 100 | { return !vars.contains(v) || vars[v].isEmpty(); } |
94 | 101 | ||
95 | inline QStringList &QMakeProject::values(const QString &v) | 102 | inline QStringList &QMakeProject::values(const QString &v) |
96 | { return vars[v]; } | 103 | { return vars[v]; } |
97 | 104 | ||
98 | inline QString QMakeProject::first(const QString &v) | 105 | inline QString QMakeProject::first(const QString &v) |
99 | { | 106 | { |
100 | #if defined(Q_CC_SUN) && (__SUNPRO_CC == 0x500) || defined(Q_CC_HP) | 107 | #if defined(Q_CC_SUN) && (__SUNPRO_CC == 0x500) || defined(Q_CC_HP) |
101 | // workaround for Sun WorkShop 5.0 bug fixed in Forte 6 | 108 | // workaround for Sun WorkShop 5.0 bug fixed in Forte 6 |
102 | if (isEmpty(v)) | 109 | if (isEmpty(v)) |
103 | return QString(""); | 110 | return QString(""); |
104 | else | 111 | else |
105 | return vars[v].first(); | 112 | return vars[v].first(); |
106 | #else | 113 | #else |
107 | return isEmpty(v) ? QString("") : vars[v].first(); | 114 | return isEmpty(v) ? QString("") : vars[v].first(); |
108 | #endif | 115 | #endif |
109 | } | 116 | } |
110 | 117 | ||
111 | inline QMap<QString, QStringList> &QMakeProject::variables() | 118 | inline QMap<QString, QStringList> &QMakeProject::variables() |
112 | { return vars; } | 119 | { return vars; } |
113 | 120 | ||
114 | #endif /* __PROJECT_H__ */ | 121 | #endif /* __PROJECT_H__ */ |