Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
proitems.h
Go to the documentation of this file.
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 PROITEMS_H
5#define PROITEMS_H
6
7#include "qmake_global.h"
8
9#include <qdebug.h>
10#include <qhash.h>
11#include <qlist.h>
12#include <qmap.h>
13#include <qstring.h>
14
16
17class QTextStream;
18
19#ifdef PROPARSER_THREAD_SAFE
20typedef QAtomicInt ProItemRefCount;
21#else
23public:
24 ProItemRefCount(int cnt = 0) : m_cnt(cnt) {}
25 bool ref() { return ++m_cnt != 0; }
26 bool deref() { return --m_cnt != 0; }
27 ProItemRefCount &operator=(int value) { m_cnt = value; return *this; }
28private:
29 int m_cnt;
30};
31#endif
32
33#ifndef QT_BUILD_QMAKE
34# define PROITEM_EXPLICIT explicit
35#else
36# define PROITEM_EXPLICIT
37#endif
38
39class ProKey;
40class ProStringList;
41class ProFile;
42
43class ProString {
44public:
45 ProString();
46 ProString(const ProString &other);
47 ProString &operator=(const ProString &) = default;
48 template<typename A, typename B>
49 ProString &operator=(const QStringBuilder<A, B> &str)
50 { return *this = QString(str); }
51 ProString(const QString &str);
52 PROITEM_EXPLICIT ProString(QStringView str);
53 PROITEM_EXPLICIT ProString(const char *str);
54 template<typename A, typename B>
55 ProString(const QStringBuilder<A, B> &str)
56 : ProString(QString(str))
57 {}
58 ProString(const QString &str, int offset, int length);
59 void setValue(const QString &str);
60 void clear() { m_string.clear(); m_length = 0; }
61 ProString &setSource(const ProString &other) { m_file = other.m_file; return *this; }
62 ProString &setSource(int id) { m_file = id; return *this; }
63 int sourceFile() const { return m_file; }
64
65 ProString &prepend(const ProString &other);
66 ProString &append(const ProString &other, bool *pending = nullptr);
67 ProString &append(const QString &other) { return append(ProString(other)); }
68 template<typename A, typename B>
69 ProString &append(const QStringBuilder<A, B> &other) { return append(QString(other)); }
70 ProString &append(const QLatin1String other);
71 ProString &append(const char *other) { return append(QLatin1String(other)); }
72 ProString &append(QChar other);
73 ProString &append(const ProStringList &other, bool *pending = nullptr, bool skipEmpty1st = false);
74 ProString &operator+=(const ProString &other) { return append(other); }
75 ProString &operator+=(const QString &other) { return append(other); }
76 template<typename A, typename B>
77 ProString &operator+=(const QStringBuilder<A, B> &other) { return append(QString(other)); }
78 ProString &operator+=(const QLatin1String other) { return append(other); }
79 ProString &operator+=(const char *other) { return append(other); }
80 ProString &operator+=(QChar other) { return append(other); }
81
82 void chop(int n) { Q_ASSERT(n <= m_length); m_length -= n; }
83 void chopFront(int n) { Q_ASSERT(n <= m_length); m_offset += n; m_length -= n; }
84
85 bool operator==(const ProString &other) const { return toQStringView() == other.toQStringView(); }
86 bool operator==(const QString &other) const { return toQStringView() == other; }
87 bool operator==(QStringView other) const { return toQStringView() == other; }
88 bool operator==(QLatin1String other) const { return toQStringView() == other; }
89 bool operator==(const char *other) const { return toQStringView() == QLatin1String(other); }
90 bool operator!=(const ProString &other) const { return !(*this == other); }
91 bool operator!=(const QString &other) const { return !(*this == other); }
92 bool operator!=(QLatin1String other) const { return !(*this == other); }
93 bool operator!=(const char *other) const { return !(*this == other); }
94 bool operator<(const ProString &other) const { return toQStringView() < other.toQStringView(); }
95 bool isNull() const { return m_string.isNull(); }
96 bool isEmpty() const { return !m_length; }
97 int length() const { return m_length; }
98 int size() const { return m_length; }
99 QChar at(int i) const { Q_ASSERT((uint)i < (uint)m_length); return constData()[i]; }
100 const QChar *constData() const { return m_string.constData() + m_offset; }
101 ProString mid(int off, int len = -1) const;
102 ProString left(int len) const { return mid(0, len); }
103 ProString right(int len) const { return mid(qMax(0, size() - len)); }
104 ProString trimmed() const;
105 int compare(const ProString &sub, Qt::CaseSensitivity cs = Qt::CaseSensitive) const { return toQStringView().compare(sub.toQStringView(), cs); }
106 int compare(const QString &sub, Qt::CaseSensitivity cs = Qt::CaseSensitive) const { return toQStringView().compare(sub, cs); }
107 int compare(const char *sub, Qt::CaseSensitivity cs = Qt::CaseSensitive) const { return toQStringView().compare(QLatin1String(sub), cs); }
108 bool startsWith(const ProString &sub, Qt::CaseSensitivity cs = Qt::CaseSensitive) const { return toQStringView().startsWith(sub.toQStringView(), cs); }
109 bool startsWith(const QString &sub, Qt::CaseSensitivity cs = Qt::CaseSensitive) const { return toQStringView().startsWith(sub, cs); }
110 bool startsWith(const char *sub, Qt::CaseSensitivity cs = Qt::CaseSensitive) const { return toQStringView().startsWith(QLatin1String(sub), cs); }
111 bool startsWith(QChar c, Qt::CaseSensitivity cs = Qt::CaseSensitive) const { return toQStringView().startsWith(c, cs); }
112 template<typename A, typename B>
113 bool startsWith(const QStringBuilder<A, B> &str) { return startsWith(QString(str)); }
114 bool endsWith(const ProString &sub, Qt::CaseSensitivity cs = Qt::CaseSensitive) const { return toQStringView().endsWith(sub.toQStringView(), cs); }
115 bool endsWith(const QString &sub, Qt::CaseSensitivity cs = Qt::CaseSensitive) const { return toQStringView().endsWith(sub, cs); }
116 bool endsWith(const char *sub, Qt::CaseSensitivity cs = Qt::CaseSensitive) const { return toQStringView().endsWith(QLatin1String(sub), cs); }
117 template<typename A, typename B>
118 bool endsWith(const QStringBuilder<A, B> &str) { return endsWith(QString(str)); }
119 bool endsWith(QChar c, Qt::CaseSensitivity cs = Qt::CaseSensitive) const { return toQStringView().endsWith(c, cs); }
120 int indexOf(const QString &s, int from = 0, Qt::CaseSensitivity cs = Qt::CaseSensitive) const { return toQStringView().indexOf(s, from, cs); }
121 int indexOf(const char *s, int from = 0, Qt::CaseSensitivity cs = Qt::CaseSensitive) const { return toQStringView().indexOf(QLatin1String(s), from, cs); }
122 int indexOf(QChar c, int from = 0, Qt::CaseSensitivity cs = Qt::CaseSensitive) const { return toQStringView().indexOf(c, from, cs); }
123 int lastIndexOf(const QString &s, int from = -1, Qt::CaseSensitivity cs = Qt::CaseSensitive) const { return toQStringView().lastIndexOf(s, from, cs); }
124 int lastIndexOf(const char *s, int from = -1, Qt::CaseSensitivity cs = Qt::CaseSensitive) const { return toQStringView().lastIndexOf(QLatin1String(s), from, cs); }
125 int lastIndexOf(QChar c, int from = -1, Qt::CaseSensitivity cs = Qt::CaseSensitive) const { return toQStringView().lastIndexOf(c, from, cs); }
126 bool contains(const QString &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const { return indexOf(s, 0, cs) >= 0; }
127 bool contains(const char *s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const { return indexOf(QLatin1String(s), 0, cs) >= 0; }
128 bool contains(QChar c, Qt::CaseSensitivity cs = Qt::CaseSensitive) const { return indexOf(c, 0, cs) >= 0; }
129 qlonglong toLongLong(bool *ok = nullptr, int base = 10) const { return toQStringView().toLongLong(ok, base); }
130 int toInt(bool *ok = nullptr, int base = 10) const { return toQStringView().toInt(ok, base); }
131 short toShort(bool *ok = nullptr, int base = 10) const { return toQStringView().toShort(ok, base); }
132
133 size_t hash() const { return m_hash; }
134 static size_t hash(const QChar *p, int n);
135
136 ALWAYS_INLINE QStringView toQStringView() const { return QStringView(m_string).mid(m_offset, m_length); }
137
138 ALWAYS_INLINE ProKey &toKey() { return *(ProKey *)this; }
139 ALWAYS_INLINE const ProKey &toKey() const { return *(const ProKey *)this; }
140
141 QString toQString() const;
142 QString &toQString(QString &tmp) const;
143
144 QByteArray toLatin1() const { return toQStringView().toLatin1(); }
145
146private:
147 ProString(const ProKey &other);
148 ProString &operator=(const ProKey &other);
149
150 enum OmitPreHashing { NoHash };
151 ProString(const ProString &other, OmitPreHashing);
152
153 enum DoPreHashing { DoHash };
154 ALWAYS_INLINE ProString(const QString &str, DoPreHashing);
155 ALWAYS_INLINE ProString(const char *str, DoPreHashing);
156 ALWAYS_INLINE ProString(const QString &str, int offset, int length, DoPreHashing);
157 ALWAYS_INLINE ProString(const QString &str, int offset, int length, uint hash);
158
159 QString m_string;
160 int m_offset, m_length;
161 int m_file;
162 mutable size_t m_hash;
163 size_t updatedHash() const;
164 friend size_t qHash(const ProString &str);
165 friend QString operator+(const ProString &one, const ProString &two);
166 friend class ProKey;
167};
169
170
171class ProKey : public ProString {
172public:
174 explicit ProKey(const QString &str);
175 template<typename A, typename B>
176 ProKey(const QStringBuilder<A, B> &str)
177 : ProString(str)
178 {}
179 PROITEM_EXPLICIT ProKey(const char *str);
180 ProKey(const QString &str, int off, int len);
181 ProKey(const QString &str, int off, int len, uint hash);
182 void setValue(const QString &str);
183
184#ifdef Q_CC_MSVC
185 // Workaround strange MSVC behaviour when exporting classes with ProKey members.
188 {
189 toString() = other.toString();
190 return *this;
191 }
192#endif
193
195 ALWAYS_INLINE const ProString &toString() const { return *(const ProString *)this; }
196
197private:
198 ProKey(const ProString &other);
199};
201
202template <> struct QConcatenable<ProString>
203{
205 typedef QString ConvertTo;
206 enum { ExactSize = true };
207 static int size(const ProString &a) { return a.length(); }
208 static inline void appendTo(const ProString &a, QChar *&out)
209 {
210 const auto n = a.size();
211 if (!n)
212 return;
213 memcpy(out, a.toQStringView().data(), sizeof(QChar) * n);
214 out += n;
215 }
216};
217
218template <> struct QConcatenable<ProKey>
219{
220 typedef ProKey type;
221 typedef QString ConvertTo;
222 enum { ExactSize = true };
223 static int size(const ProKey &a) { return a.length(); }
224 static inline void appendTo(const ProKey &a, QChar *&out)
225 {
226 const auto n = a.size();
227 if (!n)
228 return;
229 memcpy(out, a.toQStringView().data(), sizeof(QChar) * n);
230 out += n;
231 }
232};
233
234
235size_t qHash(const ProString &str);
236
237inline QString &operator+=(QString &that, const ProString &other)
238 { return that += other.toQStringView(); }
239
240QTextStream &operator<<(QTextStream &t, const ProString &str);
241template<typename A, typename B>
242QTextStream &operator<<(QTextStream &t, const QStringBuilder<A, B> &str) { return t << QString(str); }
243
244// This class manages read-only access to a ProString via a raw data QString
245// temporary, ensuring that the latter is accessed exclusively.
247{
248public:
249 ProStringRoUser(QString &rs)
250 {
251 m_rs = &rs;
252 }
253 ProStringRoUser(const ProString &ps, QString &rs)
255 {
256 ps.toQString(rs);
257 }
258 // No destructor, as a RAII pattern cannot be used: references to the
259 // temporary string can legitimately outlive instances of this class
260 // (if they are held by Qt, e.g. in QRegExp).
261 QString &set(const ProString &ps) { return ps.toQString(*m_rs); }
262 QString &str() { return *m_rs; }
263
264protected:
265 QString *m_rs;
266};
267
268// This class manages read-write access to a ProString via a raw data QString
269// temporary, ensuring that the latter is accessed exclusively, and that raw
270// data does not leak outside its source's refcounting.
272{
273public:
274 ProStringRwUser(QString &rs)
275 : ProStringRoUser(rs), m_ps(nullptr) {}
276 ProStringRwUser(const ProString &ps, QString &rs)
277 : ProStringRoUser(ps, rs), m_ps(&ps) {}
278 QString &set(const ProString &ps) { m_ps = &ps; return ProStringRoUser::set(ps); }
279 ProString extract(const QString &s) const
280 { return s.isSharedWith(*m_rs) ? *m_ps : ProString(s).setSource(*m_ps); }
281 ProString extract(const QString &s, const ProStringRwUser &other) const
282 {
283 if (other.m_ps && s.isSharedWith(*other.m_rs))
284 return *other.m_ps;
285 return extract(s);
286 }
287
288private:
289 const ProString *m_ps;
290};
291
293public:
295 ProStringList(const ProString &str) { *this << str; }
296 explicit ProStringList(const QStringList &list);
298
299 ProStringList &operator<<(const ProString &str)
300 { QList<ProString>::operator<<(str); return *this; }
301
302 int length() const { return size(); }
303
304 QString join(const ProString &sep) const;
305 QString join(const QString &sep) const;
306 QString join(QChar sep) const;
307 template<typename A, typename B>
308 QString join(const QStringBuilder<A, B> &str) { return join(QString(str)); }
309
310 void insertUnique(const ProStringList &value);
311
312 void removeAll(const ProString &str);
313 void removeAll(const char *str);
314 void removeEach(const ProStringList &value);
315 void removeAt(int idx) { remove(idx); }
316 void removeEmpty();
317 void removeDuplicates();
318
319 bool contains(const ProString &str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
320 bool contains(QStringView str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
321 bool contains(const QString &str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const
322 { return contains(ProString(str), cs); }
323 bool contains(const char *str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
324};
326
327inline ProStringList operator+(const ProStringList &one, const ProStringList &two)
328 { ProStringList ret = one; ret += two; return ret; }
329
331
332// These token definitions affect both ProFileEvaluator and ProWriter
334 TokTerminator = 0, // end of stream (possibly not included in length; must be zero)
335 TokLine, // line marker:
336 // - line (1)
337 TokAssign, // variable =
338 TokAppend, // variable +=
339 TokAppendUnique, // variable *=
340 TokRemove, // variable -=
341 TokReplace, // variable ~=
342 // previous literal/expansion is a variable manipulation
343 // - lower bound for expected output length (1)
344 // - value expression + TokValueTerminator
345 TokValueTerminator, // assignment value terminator
346 TokLiteral, // literal string (fully dequoted)
347 // - length (1)
348 // - string data (length; unterminated)
349 TokHashLiteral, // literal string with hash (fully dequoted)
350 // - hash (2)
351 // - length (1)
352 // - string data (length; unterminated)
353 TokVariable, // qmake variable expansion
354 // - hash (2)
355 // - name length (1)
356 // - name (name length; unterminated)
357 TokProperty, // qmake property expansion
358 // - hash (2)
359 // - name length (1)
360 // - name (name length; unterminated)
361 TokEnvVar, // environment variable expansion
362 // - name length (1)
363 // - name (name length; unterminated)
364 TokFuncName, // replace function expansion
365 // - hash (2)
366 // - name length (1)
367 // - name (name length; unterminated)
368 // - ((nested expansion + TokArgSeparator)* + nested expansion)?
369 // - TokFuncTerminator
370 TokArgSeparator, // function argument separator
371 TokFuncTerminator, // function argument list terminator
372 TokCondition, // previous literal/expansion is a conditional
373 TokTestCall, // previous literal/expansion is a test function call
374 // - ((nested expansion + TokArgSeparator)* + nested expansion)?
375 // - TokFuncTerminator
376 TokReturn, // previous literal/expansion is a return value
377 TokBreak, // break loop
378 TokNext, // shortcut to next loop iteration
379 TokNot, // '!' operator
380 TokAnd, // ':' operator
381 TokOr, // '|' operator
382 TokBranch, // branch point:
383 // - then block length (2)
384 // - then block + TokTerminator (then block length)
385 // - else block length (2)
386 // - else block + TokTerminator (else block length)
387 TokForLoop, // for loop:
388 // - variable name: hash (2), length (1), chars (length)
389 // - expression: length (2), bytes + TokValueTerminator (length)
390 // - body length (2)
391 // - body + TokTerminator (body length)
392 TokTestDef, // test function definition:
393 TokReplaceDef, // replace function definition:
394 // - function name: hash (2), length (1), chars (length)
395 // - body length (2)
396 // - body + TokTerminator (body length)
397 TokBypassNesting, // escape from function local variable scopes:
398 // - block length (2)
399 // - block + TokTerminator (block length)
400 TokMask = 0xff,
401 TokQuoted = 0x100, // The expression is quoted => join expanded stringlist
402 TokNewStr = 0x200 // Next stringlist element
404
406{
407public:
408 ProFile(int id, const QString &fileName);
409 ~ProFile();
410
411 int id() const { return m_id; }
412 QString fileName() const { return m_fileName; }
413 QString directoryName() const { return m_directoryName; }
414 const QString &items() const { return m_proitems; }
415 QString *itemsRef() { return &m_proitems; }
416 const ushort *tokPtr() const { return (const ushort *)m_proitems.constData(); }
417 const ushort *tokPtrEnd() const { return (const ushort *)m_proitems.constData() + m_proitems.size(); }
418
419 void ref() { m_refCount.ref(); }
420 void deref() { if (!m_refCount.deref()) delete this; }
421
422 bool isOk() const { return m_ok; }
423 void setOk(bool ok) { m_ok = ok; }
424
425 bool isHostBuild() const { return m_hostBuild; }
426 void setHostBuild(bool host_build) { m_hostBuild = host_build; }
427
428 ProString getStr(const ushort *&tPtr);
429 ProKey getHashStr(const ushort *&tPtr);
430
431private:
432 ProItemRefCount m_refCount;
433 QString m_proitems;
434 QString m_fileName;
435 QString m_directoryName;
436 int m_id;
437 bool m_ok;
438 bool m_hostBuild;
439};
440
442public:
443 ProFunctionDef(ProFile *pro, int offset) : m_pro(pro), m_offset(offset) { m_pro->ref(); }
444 ProFunctionDef(const ProFunctionDef &o) : m_pro(o.m_pro), m_offset(o.m_offset) { m_pro->ref(); }
446 : m_pro(other.m_pro), m_offset(other.m_offset) { other.m_pro = nullptr; }
447 ~ProFunctionDef() { if (m_pro) m_pro->deref(); }
449 {
450 if (this != &o) {
451 if (m_pro)
452 m_pro->deref();
453 m_pro = o.m_pro;
454 m_pro->ref();
455 m_offset = o.m_offset;
456 }
457 return *this;
458 }
460 {
461 ProFunctionDef moved(std::move(other));
462 swap(moved);
463 return *this;
464 }
465 void swap(ProFunctionDef &other) noexcept
466 {
467 qSwap(m_pro, other.m_pro);
468 qSwap(m_offset, other.m_offset);
469 }
470
471 ProFile *pro() const { return m_pro; }
472 const ushort *tokPtr() const { return m_pro->tokPtr() + m_offset; }
473private:
474 ProFile *m_pro;
475 int m_offset;
476};
477
479
484
485QDebug operator<<(QDebug debug, const ProString &str);
486
487QT_END_NAMESPACE
488
489#endif // PROITEMS_H
int main(int argc, char *argv[])
[2]
Definition buffer.cpp:77
void message(int type, const QString &msg, const QString &fileName, int lineNo) override
Definition main.cpp:100
void fileMessage(int type, const QString &msg) override
Definition main.cpp:106
void doneWithEval(ProFile *) override
Definition main.cpp:115
void aboutToEval(ProFile *, ProFile *, EvalFileType) override
Definition main.cpp:114
bool verbose
Definition main.cpp:117
ProFileEvaluator::TemplateType templateType() const
ProFileEvaluator(ProFileGlobals *option, QMakeParser *parser, QMakeVfs *vfs, QMakeHandler *handler)
void setExtraConfigs(const QStringList &extraConfigs)
void setExtraVars(const QHash< QString, QStringList > &extraVars)
QStringList values(const QString &variableName, const ProFile *pro) const
QString value(const QString &variableName) const
bool contains(const QString &variableName) const
QString resolvedMkSpec() const
static void initialize()
bool accept(ProFile *pro, QMakeEvaluator::LoadFlags flags=QMakeEvaluator::LoadAll)
QStringList absoluteFileValues(const QString &variable, const QString &baseDirectory, const QStringList &searchDirs, const ProFile *pro) const
void setOutputDir(const QString &dir)
QStringList absolutePathValues(const QString &variable, const QString &baseDirectory) const
QStringList values(const QString &variableName) const
QString propertyValue(const QString &val) const
bool loadNamedSpec(const QString &specDir, bool hostSpec)
void deref()
Definition proitems.h:420
const ushort * tokPtrEnd() const
Definition proitems.h:417
QString fileName() const
Definition proitems.h:412
ProFile(int id, const QString &fileName)
Definition proitems.cpp:428
bool isHostBuild() const
Definition proitems.h:425
const ushort * tokPtr() const
Definition proitems.h:416
QString directoryName() const
Definition proitems.h:413
ProString getStr(const ushort *&tPtr)
Definition proitems.cpp:444
QString * itemsRef()
Definition proitems.h:415
const QString & items() const
Definition proitems.h:414
void ref()
Definition proitems.h:419
ProKey getHashStr(const ushort *&tPtr)
Definition proitems.cpp:453
void setHostBuild(bool host_build)
Definition proitems.h:426
void setOk(bool ok)
Definition proitems.h:423
int id() const
Definition proitems.h:411
bool isOk() const
Definition proitems.h:422
const ushort * tokPtr() const
Definition proitems.h:472
ProFunctionDef(ProFunctionDef &&other) noexcept
Definition proitems.h:445
ProFunctionDef(ProFile *pro, int offset)
Definition proitems.h:443
ProFile * pro() const
Definition proitems.h:471
void swap(ProFunctionDef &other) noexcept
Definition proitems.h:465
ProFunctionDef & operator=(ProFunctionDef &&other) noexcept
Definition proitems.h:459
ProFunctionDef(const ProFunctionDef &o)
Definition proitems.h:444
ProFunctionDef & operator=(const ProFunctionDef &o)
Definition proitems.h:448
ProItemRefCount(int cnt=0)
Definition proitems.h:24
ProItemRefCount & operator=(int value)
Definition proitems.h:27
void setValue(const QString &str)
Definition proitems.cpp:122
ProKey(const QString &str, int off, int len, uint hash)
Definition proitems.cpp:117
ALWAYS_INLINE const ProString & toString() const
Definition proitems.h:195
ProKey(const QStringBuilder< A, B > &str)
Definition proitems.h:176
ProKey(const QString &str)
Definition proitems.cpp:102
ALWAYS_INLINE ProKey()
Definition proitems.h:173
ALWAYS_INLINE ProString & toString()
Definition proitems.h:194
PROITEM_EXPLICIT ProKey(const char *str)
Definition proitems.cpp:107
ProKey(const QString &str, int off, int len)
Definition proitems.cpp:112
void removeAll(const ProString &str)
Definition proitems.cpp:344
bool contains(const QString &str, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Definition proitems.h:321
QString join(QChar sep) const
Definition proitems.cpp:339
void removeAt(int idx)
Definition proitems.h:315
QString join(const ProString &sep) const
Definition proitems.cpp:329
bool contains(const char *str, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Definition proitems.cpp:420
void removeAll(const char *str)
Definition proitems.cpp:351
void insertUnique(const ProStringList &value)
Definition proitems.cpp:381
QString join(const QStringBuilder< A, B > &str)
Definition proitems.h:308
QString join(const QString &sep) const
Definition proitems.cpp:334
int length() const
Definition proitems.h:302
void removeEmpty()
Definition proitems.cpp:368
bool contains(QStringView str, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Definition proitems.cpp:412
void removeEach(const ProStringList &value)
Definition proitems.cpp:358
ProStringList(const ProString &str)
Definition proitems.h:295
ProStringList(const QStringList &list)
Definition proitems.cpp:388
void removeDuplicates()
Definition proitems.cpp:375
bool contains(const ProString &str, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Definition proitems.cpp:404
QStringList toQStringList() const
Definition proitems.cpp:395
ProStringRoUser(const ProString &ps, QString &rs)
Definition proitems.h:253
ProStringRoUser(QString &rs)
Definition proitems.h:249
QString * m_rs
Definition proitems.h:265
QString & str()
Definition proitems.h:262
QString & set(const ProString &ps)
Definition proitems.h:261
ProStringRwUser(QString &rs)
Definition proitems.h:274
ProString extract(const QString &s) const
Definition proitems.h:279
QString & set(const ProString &ps)
Definition proitems.h:278
ProStringRwUser(const ProString &ps, QString &rs)
Definition proitems.h:276
ProString extract(const QString &s, const ProStringRwUser &other) const
Definition proitems.h:281
ProString & operator+=(const QLatin1String other)
Definition proitems.h:78
ProString & setSource(const ProString &other)
Definition proitems.h:61
QString & toQString(QString &tmp) const
Definition proitems.cpp:133
ProString & operator=(const ProString &)=default
bool startsWith(const ProString &sub, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Definition proitems.h:108
ALWAYS_INLINE const ProKey & toKey() const
Definition proitems.h:139
bool startsWith(QChar c, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Definition proitems.h:111
friend size_t qHash(const ProString &str)
Definition proitems.cpp:95
int indexOf(QChar c, int from=0, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Definition proitems.h:122
bool isEmpty() const
Definition proitems.h:96
bool isNull() const
Definition proitems.h:95
bool contains(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Definition proitems.h:126
ProString & append(QChar other)
Definition proitems.cpp:173
ProString & operator=(const QStringBuilder< A, B > &str)
Definition proitems.h:49
QByteArray toLatin1() const
Definition proitems.h:144
bool operator<(const ProString &other) const
Definition proitems.h:94
ProString mid(int off, int len=-1) const
Definition proitems.cpp:268
bool operator==(const ProString &other) const
Definition proitems.h:85
int length() const
Definition proitems.h:97
int lastIndexOf(QChar c, int from=-1, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Definition proitems.h:125
QString toQString() const
Definition proitems.cpp:128
ProString(const QString &str)
Definition proitems.cpp:48
bool operator!=(const QString &other) const
Definition proitems.h:91
bool endsWith(const QStringBuilder< A, B > &str)
Definition proitems.h:118
ProString & append(const QLatin1String other)
Definition proitems.cpp:156
ALWAYS_INLINE QStringView toQStringView() const
Definition proitems.h:136
int toInt(bool *ok=nullptr, int base=10) const
Definition proitems.h:130
int indexOf(const QString &s, int from=0, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Definition proitems.h:120
void setValue(const QString &str)
Definition proitems.cpp:85
int size() const
Definition proitems.h:98
bool operator==(const char *other) const
Definition proitems.h:89
int compare(const QString &sub, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Definition proitems.h:106
ProString(const QString &str, int offset, int length)
Definition proitems.cpp:80
ProString & operator+=(QChar other)
Definition proitems.h:80
void clear()
Definition proitems.h:60
size_t hash() const
Definition proitems.h:133
ProString & operator+=(const ProString &other)
Definition proitems.h:74
int compare(const char *sub, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Definition proitems.h:107
bool operator!=(QLatin1String other) const
Definition proitems.h:92
int compare(const ProString &sub, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Definition proitems.h:105
ProString right(int len) const
Definition proitems.h:103
static size_t hash(const QChar *p, int n)
Definition proitems.cpp:15
ProString & prepend(const ProString &other)
Definition proitems.cpp:139
void chop(int n)
Definition proitems.h:82
ALWAYS_INLINE ProKey & toKey()
Definition proitems.h:138
int indexOf(const char *s, int from=0, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Definition proitems.h:121
qlonglong toLongLong(bool *ok=nullptr, int base=10) const
Definition proitems.h:129
ProString & append(const char *other)
Definition proitems.h:71
PROITEM_EXPLICIT ProString(QStringView str)
Definition proitems.cpp:53
int lastIndexOf(const QString &s, int from=-1, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Definition proitems.h:123
bool endsWith(const QString &sub, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Definition proitems.h:115
bool operator!=(const char *other) const
Definition proitems.h:93
bool contains(QChar c, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Definition proitems.h:128
const QChar * constData() const
Definition proitems.h:100
bool operator==(const QString &other) const
Definition proitems.h:86
int sourceFile() const
Definition proitems.h:63
ProString(const QStringBuilder< A, B > &str)
Definition proitems.h:55
bool startsWith(const QStringBuilder< A, B > &str)
Definition proitems.h:113
void chopFront(int n)
Definition proitems.h:83
bool startsWith(const char *sub, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Definition proitems.h:110
int lastIndexOf(const char *s, int from=-1, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Definition proitems.h:124
friend QString operator+(const ProString &one, const ProString &two)
Definition proitems.cpp:251
ProString & operator+=(const QString &other)
Definition proitems.h:75
ProString trimmed() const
Definition proitems.cpp:280
ProString & operator+=(const char *other)
Definition proitems.h:79
bool endsWith(const char *sub, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Definition proitems.h:116
QChar at(int i) const
Definition proitems.h:99
ProString left(int len) const
Definition proitems.h:102
ProString & append(const ProString &other, bool *pending=nullptr)
Definition proitems.cpp:189
bool endsWith(QChar c, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Definition proitems.h:119
ProString & append(const QString &other)
Definition proitems.h:67
ProString & append(const QStringBuilder< A, B > &other)
Definition proitems.h:69
bool contains(const char *s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Definition proitems.h:127
bool operator!=(const ProString &other) const
Definition proitems.h:90
ProString & operator+=(const QStringBuilder< A, B > &other)
Definition proitems.h:77
PROITEM_EXPLICIT ProString(const char *str)
Definition proitems.cpp:64
bool operator==(QStringView other) const
Definition proitems.h:87
bool endsWith(const ProString &sub, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Definition proitems.h:114
ProString & setSource(int id)
Definition proitems.h:62
ProString & append(const ProStringList &other, bool *pending=nullptr, bool skipEmpty1st=false)
Definition proitems.cpp:214
bool startsWith(const QString &sub, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Definition proitems.h:109
short toShort(bool *ok=nullptr, int base=10) const
Definition proitems.h:131
ProString(const ProString &other)
Definition proitems.cpp:32
\inmodule QtCore
Definition qhash.h:821
QMakeEvaluator * evaluator
QMakeBaseKey(const QString &_root, const QString &_stash, bool _hostBuild)
QString stash
QStringList configs[4]
QMakeCmdLineParserState(const QString &_pwd)
void useEnvironment()
QString user_template_prefix
QString cachefile
QStringList splitPathList(const QString &value) const
QString dir_sep
QString user_template
void setCommandLineArguments(const QString &pwd, const QStringList &args)
QString qtconf
QString qmakespec
void setProperties(const QHash< ProKey, ProString > &props)
void setDirectories(const QString &input_dir, const QString &output_dir)
QStringList qmake_args
QString dirlist_sep
QString expandEnvVars(const QString &str) const
QString xqmakespec
QString extra_cmds[4]
QStringList qmake_extra_args
QString qmake_abslocation
void commitCommandLineArguments(QMakeCmdLineParserState &state)
ArgumentReturn addCommandLineArguments(QMakeCmdLineParserState &state, QStringList &args, int *pos)
QString shadowedPath(const QString &fileName) const
static void parseProperties(const QByteArray &data, QHash< ProKey, ProString > &props)
ProString propertyValue(const ProKey &name) const
ReadResult readFile(int id, QString *contents, QString *errStr)
Definition qmakevfs.cpp:165
@ VfsCumulative
Definition qmakevfs.h:41
Definition qmap.h:189
bool hasError() const
Definition qrcreader.h:17
Combined button and popup list for selecting options.
const QString & asString(const QString &s)
Definition qstring.h:1547
Definition qcompare.h:72
Q_DECLARE_TYPEINFO(ProString, Q_RELOCATABLE_TYPE)
#define PROITEM_EXPLICIT
Definition proitems.h:34
QString & operator+=(QString &that, const ProString &other)
Definition proitems.h:237
QDebug operator<<(QDebug debug, const ProString &str)
Definition proitems.cpp:463
ProToken
Definition proitems.h:333
@ TokAssign
Definition proitems.h:337
@ TokReplaceDef
Definition proitems.h:393
@ TokNewStr
Definition proitems.h:402
@ TokEnvVar
Definition proitems.h:361
@ TokLiteral
Definition proitems.h:346
@ TokFuncTerminator
Definition proitems.h:371
@ TokVariable
Definition proitems.h:353
@ TokAppend
Definition proitems.h:338
@ TokHashLiteral
Definition proitems.h:349
@ TokMask
Definition proitems.h:400
@ TokReplace
Definition proitems.h:341
@ TokBypassNesting
Definition proitems.h:397
@ TokLine
Definition proitems.h:335
@ TokNext
Definition proitems.h:378
@ TokBreak
Definition proitems.h:377
@ TokTestDef
Definition proitems.h:392
@ TokAnd
Definition proitems.h:380
@ TokRemove
Definition proitems.h:340
@ TokNot
Definition proitems.h:379
@ TokTestCall
Definition proitems.h:373
@ TokCondition
Definition proitems.h:372
@ TokBranch
Definition proitems.h:382
@ TokProperty
Definition proitems.h:357
@ TokArgSeparator
Definition proitems.h:370
@ TokTerminator
Definition proitems.h:334
@ TokOr
Definition proitems.h:381
@ TokFuncName
Definition proitems.h:364
@ TokQuoted
Definition proitems.h:401
@ TokAppendUnique
Definition proitems.h:339
@ TokValueTerminator
Definition proitems.h:345
@ TokForLoop
Definition proitems.h:387
@ TokReturn
Definition proitems.h:376
Q_DECLARE_TYPEINFO(ProStringList, Q_RELOCATABLE_TYPE)
Q_DECLARE_TYPEINFO(ProFunctionDef, Q_RELOCATABLE_TYPE)
QMap< ProKey, ProStringList > ProValueMap
Definition proitems.h:330
Q_DECLARE_TYPEINFO(ProKey, Q_RELOCATABLE_TYPE)
ProStringList operator+(const ProStringList &one, const ProStringList &two)
Definition proitems.h:327
#define ALWAYS_INLINE
#define QMAKE_EXPORT
bool operator==(const QMakeBaseKey &one, const QMakeBaseKey &two)
QMakeEvalPhase
@ QMakeEvalBefore
@ QMakeEvalLate
@ QMakeEvalEarly
@ QMakeEvalAfter
size_t qHash(const QMakeBaseKey &key)
#define qPrintable(string)
Definition qstring.h:1552
static void printOut(const QString &out)
Definition main.cpp:29
static void printUsage()
Definition main.cpp:60
QStringList getExcludes(const ProFileEvaluator &visitor, const QString &projectDirPath)
Definition main.cpp:207
static QStringList getSources(const ProFileEvaluator &visitor, const QString &projectDir, QMakeVfs *vfs)
Definition main.cpp:151
static void excludeProjects(const ProFileEvaluator &visitor, QStringList *subProjects)
Definition main.cpp:218
void setValue(QJsonObject &obj, const char *key, T value)
Definition main.cpp:55
static void print(const QString &fileName, int lineNo, const QString &msg)
Definition main.cpp:88
static QJsonValue toJsonValue(const QString &s)
Definition main.cpp:44
static QJsonObject processProject(const QString &proFile, const QStringList &translationsVariables, ProFileGlobals *option, QMakeVfs *vfs, QMakeParser *parser, ProFileEvaluator &visitor)
Definition main.cpp:237
static EvalHandler evalHandler
Definition main.cpp:120
static QJsonValue toJsonValue(const QJsonValue &v)
Definition main.cpp:39
static QStringList getSources(const char *var, const char *vvar, const QStringList &baseVPaths, const QString &projectDir, const ProFileEvaluator &visitor)
Definition main.cpp:142
static QJsonArray processProjects(bool topLevel, const QStringList &proFiles, const QStringList &translationsVariables, const QHash< QString, QString > &outDirMap, ProFileGlobals *option, QMakeVfs *vfs, QMakeParser *parser, bool *fail)
Definition main.cpp:281
static QStringList getResources(const QString &resourceFile, QMakeVfs *vfs)
Definition main.cpp:122
static void printErr(const QString &out)
Definition main.cpp:34
QHash< ProKey, ProFunctionDef > replaceFunctions
Definition proitems.h:482
QHash< ProKey, ProFunctionDef > testFunctions
Definition proitems.h:481
static void appendTo(const ProString &a, QChar *&out)
Definition proitems.h:208
static int size(const ProString &a)
Definition proitems.h:207