diff options
Diffstat (limited to 'qmake/library/proitems.h')
-rw-r--r-- | qmake/library/proitems.h | 58 |
1 files changed, 18 insertions, 40 deletions
diff --git a/qmake/library/proitems.h b/qmake/library/proitems.h index bef93795d2..2de982034c 100644 --- a/qmake/library/proitems.h +++ b/qmake/library/proitems.h @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the qmake application of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #ifndef PROITEMS_H #define PROITEMS_H @@ -32,10 +7,10 @@ #include "qmake_global.h" #include <qdebug.h> -#include <qstring.h> -#include <qvector.h> #include <qhash.h> +#include <qlist.h> #include <qmap.h> +#include <qstring.h> QT_BEGIN_NAMESPACE @@ -155,8 +130,8 @@ public: int toInt(bool *ok = nullptr, int base = 10) const { return toQStringView().toInt(ok, base); } short toShort(bool *ok = nullptr, int base = 10) const { return toQStringView().toShort(ok, base); } - uint hash() const { return m_hash; } - static uint hash(const QChar *p, int n); + size_t hash() const { return m_hash; } + static size_t hash(const QChar *p, int n); ALWAYS_INLINE QStringView toQStringView() const { return QStringView(m_string).mid(m_offset, m_length); } @@ -184,14 +159,13 @@ private: QString m_string; int m_offset, m_length; int m_file; - mutable uint m_hash; - QChar *prepareExtend(int extraLen, int thisTarget, int extraTarget); - uint updatedHash() const; + mutable size_t m_hash; + size_t updatedHash() const; friend size_t qHash(const ProString &str); friend QString operator+(const ProString &one, const ProString &two); friend class ProKey; }; -Q_DECLARE_TYPEINFO(ProString, Q_MOVABLE_TYPE); +Q_DECLARE_TYPEINFO(ProString, Q_RELOCATABLE_TYPE); class ProKey : public ProString { @@ -223,7 +197,7 @@ public: private: ProKey(const ProString &other); }; -Q_DECLARE_TYPEINFO(ProKey, Q_MOVABLE_TYPE); +Q_DECLARE_TYPEINFO(ProKey, Q_RELOCATABLE_TYPE); template <> struct QConcatenable<ProString> : private QAbstractConcatenable { @@ -234,6 +208,8 @@ template <> struct QConcatenable<ProString> : private QAbstractConcatenable static inline void appendTo(const ProString &a, QChar *&out) { const auto n = a.size(); + if (!n) + return; memcpy(out, a.toQStringView().data(), sizeof(QChar) * n); out += n; } @@ -248,6 +224,8 @@ template <> struct QConcatenable<ProKey> : private QAbstractConcatenable static inline void appendTo(const ProKey &a, QChar *&out) { const auto n = a.size(); + if (!n) + return; memcpy(out, a.toQStringView().data(), sizeof(QChar) * n); out += n; } @@ -311,7 +289,7 @@ private: const ProString *m_ps; }; -class ProStringList : public QVector<ProString> { +class ProStringList : public QList<ProString> { public: ProStringList() {} ProStringList(const ProString &str) { *this << str; } @@ -319,7 +297,7 @@ public: QStringList toQStringList() const; ProStringList &operator<<(const ProString &str) - { QVector<ProString>::operator<<(str); return *this; } + { QList<ProString>::operator<<(str); return *this; } int length() const { return size(); } @@ -344,7 +322,7 @@ public: { return contains(ProString(str), cs); } bool contains(const char *str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; }; -Q_DECLARE_TYPEINFO(ProStringList, Q_MOVABLE_TYPE); +Q_DECLARE_TYPEINFO(ProStringList, Q_RELOCATABLE_TYPE); inline ProStringList operator+(const ProStringList &one, const ProStringList &two) { ProStringList ret = one; ret += two; return ret; } @@ -497,7 +475,7 @@ private: int m_offset; }; -Q_DECLARE_TYPEINFO(ProFunctionDef, Q_MOVABLE_TYPE); +Q_DECLARE_TYPEINFO(ProFunctionDef, Q_RELOCATABLE_TYPE); struct ProFunctionDefs { QHash<ProKey, ProFunctionDef> testFunctions; |