QtBase  v6.3.1
project.h
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2016 The Qt Company Ltd.
4 ** Contact: https://www.qt.io/licensing/
5 **
6 ** This file is part of the qmake application of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:GPL-EXCEPT$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and The Qt Company. For licensing terms
14 ** and conditions see https://www.qt.io/terms-conditions. For further
15 ** information use the contact form at https://www.qt.io/contact-us.
16 **
17 ** GNU General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU
19 ** General Public License version 3 as published by the Free Software
20 ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
21 ** included in the packaging of this file. Please review the following
22 ** information to ensure the GNU General Public License requirements will
23 ** be met: https://www.gnu.org/licenses/gpl-3.0.html.
24 **
25 ** $QT_END_LICENSE$
26 **
27 ****************************************************************************/
28 
29 #ifndef PROJECT_H
30 #define PROJECT_H
31 
32 #include <qmakeevaluator.h>
33 
35 
37 {
38  QString m_projectFile;
39  QString m_projectDir;
40 
41 public:
42  QMakeProject();
44 
45  bool read(const QString &project, LoadFlags what = LoadAll);
46 
47  QString projectFile() const { return m_projectFile; }
48  QString projectDir() const { return m_projectDir; }
50  QString buildRoot() const { return m_buildRoot; }
51  QString confFile() const { return m_conffile; }
52  QString cacheFile() const { return m_cachefile; }
53  QString specDir() const { return m_qmakespec; }
54 
55  ProString expand(const QString &v, const QString &file, int line);
57  bool test(const QString &v, const QString &file, int line)
59  bool test(const ProKey &func, const QList<ProStringList> &args);
60 
61  bool isSet(const ProKey &v) const { return m_valuemapStack.front().contains(v); }
62  bool isEmpty(const ProKey &v) const;
63  ProStringList &values(const ProKey &v) { return valuesRef(v); }
64  int intValue(const ProKey &v, int defaultValue = 0) const;
65  const ProValueMap &variables() const { return m_valuemapStack.front(); }
66  ProValueMap &variables() { return m_valuemapStack.front(); }
67  bool isActiveConfig(const QString &config, bool regex = false)
69 
70  void dump() const;
71 
72  using QMakeEvaluator::LoadFlags;
85 
86 private:
87  static bool boolRet(VisitReturn vr);
88 };
89 
96 inline int QMakeProject::intValue(const ProKey &v, int defaultValue) const
97 {
98  const ProString &str = first(v);
99  if (!str.isEmpty()) {
100  bool ok;
101  int i = str.toInt(&ok, 0);
102  if (ok)
103  return i;
104  }
105  return defaultValue;
106 }
107 
109 
110 #endif // PROJECT_H
small capitals from c petite p scientific i
[1]
Definition: afcover.h:80
Definition: qlist.h:108
VisitReturn evaluateConfigFeatures()
QString m_sourceRoot
ProString first(const ProKey &variableName) const
ProString propertyValue(const ProKey &val) const
VisitReturn evaluateConditional(QStringView cond, const QString &where, int line=-1)
ProStringList & valuesRef(const ProKey &variableName)
VisitReturn evaluateFeatureFile(const QString &fileName, bool silent=false)
void setExtraConfigs(const ProStringList &extraConfigs)
Location m_current
ProString dirSep() const
ProStringList values(const ProKey &variableName) const
void setExtraVars(const ProValueMap &extraVars)
VisitReturn evaluateExpression(const ushort *&tokPtr, ProStringList *ret, bool joined)
ProValueMapStack m_valuemapStack
bool isActiveConfig(QStringView config, bool regex=false)
bool isHostBuild() const
QString cacheFile() const
Definition: project.h:52
QString projectFile() const
Definition: project.h:47
QString sourceRoot() const
Definition: project.h:49
bool isEmpty(const ProKey &v) const
Definition: project.cpp:147
ProValueMap & variables()
Definition: project.h:66
bool isSet(const ProKey &v) const
Definition: project.h:61
bool isActiveConfig(const QString &config, bool regex=false)
Definition: project.h:67
ProString expand(const QString &v, const QString &file, int line)
Definition: project.cpp:128
void dump() const
Definition: project.cpp:153
QString projectDir() const
Definition: project.h:48
QString buildRoot() const
Definition: project.h:50
QString specDir() const
Definition: project.h:53
bool test(const QString &v, const QString &file, int line)
Definition: project.h:57
ProString first(const ProKey &variableName) const
ProStringList & values(const ProKey &v)
Definition: project.h:63
int intValue(const ProKey &v, int defaultValue=0) const
Definition: project.h:96
QString confFile() const
Definition: project.h:51
bool read(const QString &project, LoadFlags what=LoadAll)
Definition: project.cpp:64
const ProValueMap & variables() const
Definition: project.h:65
The QString class provides a Unicode character string.
Definition: qstring.h:388
int toInt(bool *ok=nullptr, int base=10) const
Definition: qstring.h:848
bool isEmpty() const
Definition: qstring.h:1216
The QStringList class provides a list of strings.
The QStringView class provides a unified view on UTF-16 strings with a read-only subset of the QStrin...
Definition: qstringview.h:122
QString str
[2]
GLsizei const GLfloat * v
[13]
GLenum func
Definition: qopenglext.h:663
GLfloat GLfloat p
[1]
Definition: qopenglext.h:12698
QFile file
[0]