1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
3
4#ifndef META_H
5#define META_H
6
7#include "project.h"
8
9#include <qhash.h>
10#include <qstringlist.h>
11#include <qstring.h>
12
13QT_BEGIN_NAMESPACE
14
15class QMakeProject;
16
17class QMakeMetaInfo
18{
19 ProValueMap vars;
20 static QHash<QString, ProValueMap> cache_vars;
21public:
22
23 // These functions expect the path to be normalized
24 static QString checkLib(const QString &lib);
25 bool readLib(const QString &meta_file);
26
27 bool isEmpty(const ProKey &v);
28 ProStringList &values(const ProKey &v);
29 ProString first(const ProKey &v);
30 ProValueMap &variables();
31};
32
33inline bool QMakeMetaInfo::isEmpty(const ProKey &v)
34{ return !vars.contains(key: v) || vars[v].isEmpty(); }
35
36inline ProStringList &QMakeMetaInfo::values(const ProKey &v)
37{ return vars[v]; }
38
39inline ProString QMakeMetaInfo::first(const ProKey &v)
40{
41#if defined(Q_CC_SUN) && (__SUNPRO_CC == 0x500) || defined(Q_CC_HP)
42 // workaround for Sun WorkShop 5.0 bug fixed in Forte 6
43 if (isEmpty(v))
44 return ProString("");
45 else
46 return vars[v].first();
47#else
48 return isEmpty(v) ? ProString("") : vars[v].first();
49#endif
50}
51
52inline ProValueMap &QMakeMetaInfo::variables()
53{ return vars; }
54
55QT_END_NAMESPACE
56
57#endif // META_H
58

source code of qtbase/qmake/meta.h