-rw-r--r-- | qmake/meta.h | 93 |
1 files changed, 93 insertions, 0 deletions
diff --git a/qmake/meta.h b/qmake/meta.h new file mode 100644 index 0000000..2edbfca --- a/dev/null +++ b/qmake/meta.h | |||
@@ -0,0 +1,93 @@ | |||
1 | /**************************************************************************** | ||
2 | ** | ||
3 | ** | ||
4 | ** Definition of QMakeMetaInfo class. | ||
5 | ** | ||
6 | ** Copyright (C) 1992-2003 Trolltech AS. All rights reserved. | ||
7 | ** | ||
8 | ** This file is part of qmake. | ||
9 | ** | ||
10 | ** This file may be distributed under the terms of the Q Public License | ||
11 | ** as defined by Trolltech AS of Norway and appearing in the file | ||
12 | ** LICENSE.QPL included in the packaging of this file. | ||
13 | ** | ||
14 | ** This file may be distributed and/or modified under the terms of the | ||
15 | ** GNU General Public License version 2 as published by the Free Software | ||
16 | ** Foundation and appearing in the file LICENSE.GPL included in the | ||
17 | ** packaging of this file. | ||
18 | ** | ||
19 | ** Licensees holding valid Qt Enterprise Edition licenses may use this | ||
20 | ** file in accordance with the Qt Commercial License Agreement provided | ||
21 | ** with the Software. | ||
22 | ** | ||
23 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | ||
24 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | ||
25 | ** | ||
26 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for | ||
27 | ** information about Qt Commercial License Agreements. | ||
28 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. | ||
29 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | ||
30 | ** | ||
31 | ** Contact info@trolltech.com if any conditions of this licensing are | ||
32 | ** not clear to you. | ||
33 | ** | ||
34 | **********************************************************************/ | ||
35 | |||
36 | #ifndef __META_H__ | ||
37 | #define __META_H__ | ||
38 | |||
39 | #include <qmap.h> | ||
40 | #include <qstringlist.h> | ||
41 | #include <qstring.h> | ||
42 | |||
43 | class QMakeMetaInfo | ||
44 | { | ||
45 | bool readLibtoolFile(const QString &f); | ||
46 | bool readPkgCfgFile(const QString &f); | ||
47 | QMap<QString, QStringList> vars; | ||
48 | QString meta_type; | ||
49 | static QMap<QString, QMap<QString, QStringList> > cache_vars; | ||
50 | void clear(); | ||
51 | public: | ||
52 | QMakeMetaInfo(); | ||
53 | |||
54 | bool readLib(const QString &lib); | ||
55 | static QString findLib(const QString &lib); | ||
56 | static bool libExists(const QString &lib); | ||
57 | QString type() const; | ||
58 | |||
59 | bool isEmpty(const QString &v); | ||
60 | QStringList &values(const QString &v); | ||
61 | QString first(const QString &v); | ||
62 | QMap<QString, QStringList> &variables(); | ||
63 | }; | ||
64 | |||
65 | inline bool QMakeMetaInfo::isEmpty(const QString &v) | ||
66 | { return !vars.contains(v) || vars[v].isEmpty(); } | ||
67 | |||
68 | inline QString QMakeMetaInfo::type() const | ||
69 | { return meta_type; } | ||
70 | |||
71 | inline QStringList &QMakeMetaInfo::values(const QString &v) | ||
72 | { return vars[v]; } | ||
73 | |||
74 | inline QString QMakeMetaInfo::first(const QString &v) | ||
75 | { | ||
76 | #if defined(Q_CC_SUN) && (__SUNPRO_CC == 0x500) || defined(Q_CC_HP) | ||
77 | // workaround for Sun WorkShop 5.0 bug fixed in Forte 6 | ||
78 | if (isEmpty(v)) | ||
79 | return QString(""); | ||
80 | else | ||
81 | return vars[v].first(); | ||
82 | #else | ||
83 | return isEmpty(v) ? QString("") : vars[v].first(); | ||
84 | #endif | ||
85 | } | ||
86 | |||
87 | inline QMap<QString, QStringList> &QMakeMetaInfo::variables() | ||
88 | { return vars; } | ||
89 | |||
90 | inline bool QMakeMetaInfo::libExists(const QString &lib) | ||
91 | { return !findLib(lib).isNull(); } | ||
92 | |||
93 | #endif /* __META_H__ */ | ||