aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken6/ApiExtractor/include.h
diff options
context:
space:
mode:
Diffstat (limited to 'sources/shiboken6/ApiExtractor/include.h')
-rw-r--r--sources/shiboken6/ApiExtractor/include.h83
1 files changed, 40 insertions, 43 deletions
diff --git a/sources/shiboken6/ApiExtractor/include.h b/sources/shiboken6/ApiExtractor/include.h
index aa3a38a8f..875a941f9 100644
--- a/sources/shiboken6/ApiExtractor/include.h
+++ b/sources/shiboken6/ApiExtractor/include.h
@@ -1,38 +1,13 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt for Python.
-**
-** $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 INCLUDE_H
#define INCLUDE_H
-#include <qtcompat.h>
-
-#include <QString>
-#include <QList>
+#include <QtCore/QtCompare>
+#include <QtCore/QHashFunctions>
+#include <QtCore/QString>
+#include <QtCore/QList>
QT_BEGIN_NAMESPACE
class QTextStream;
@@ -46,8 +21,7 @@ public:
enum IncludeType {
IncludePath,
LocalPath,
- TargetLangImport,
- InvalidInclude
+ TargetLangImport
};
Include() = default;
@@ -70,23 +44,25 @@ public:
QString toString() const;
- bool operator<(const Include& other) const
+ int compare(const Include &rhs) const;
+
+private:
+ friend size_t qHash(Include &inc, size_t seed = 0) noexcept
{
- return m_name < other.m_name;
+ return qHashMulti(seed, inc.m_type, inc.m_name);
}
-
- bool operator==(const Include& other) const
+ friend bool comparesEqual(const Include &lhs, const Include &rhs) noexcept
{
- return m_type == other.m_type && m_name == other.m_name;
+ return lhs.m_type == rhs.m_type && lhs.m_name == rhs.m_name;
}
+ friend Qt::strong_ordering compareThreeWay(const Include &lhs,
+ const Include &rhs) noexcept;
+ Q_DECLARE_STRONGLY_ORDERED(Include)
- friend QtCompatHashFunctionType qHash(const Include&);
- private:
- IncludeType m_type = IncludePath;
- QString m_name;
+ IncludeType m_type = IncludePath;
+ QString m_name;
};
-QtCompatHashFunctionType qHash(const Include& inc);
QTextStream& operator<<(QTextStream& out, const Include& include);
TextStream& operator<<(TextStream& out, const Include& include);
#ifndef QT_NO_DEBUG_STREAM
@@ -95,4 +71,25 @@ QDebug operator<<(QDebug d, const Include &i);
using IncludeList = QList<Include>;
+struct IncludeGroup
+{
+ QString title;
+ IncludeList includes;
+
+ void append(const Include &include)
+ {
+ IncludeGroup::appendInclude(include, &includes);
+ }
+
+ static void appendInclude(const Include &include, IncludeList *list)
+ {
+ if (include.isValid() && !list->contains(include))
+ list->append(include);
+ }
+};
+
+TextStream& operator<<(TextStream &out, const IncludeGroup& include);
+
+using IncludeGroupList = QList<IncludeGroup>;
+
#endif