aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken6/ApiExtractor/addedfunction_p.h
blob: 40b69a5dfa857ac88548d2a8befc2193502b9fc9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// Copyright (C) 2022 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0

#ifndef ADDEDFUNCTION_P_H
#define ADDEDFUNCTION_P_H

#include <QtCore/QtCompare>
#include <QtCore/QList>
#include <QtCore/QString>
#include <QtCore/QStringView>

QT_BEGIN_NAMESPACE
class QDebug;
QT_END_NAMESPACE

// Helpers to split a parameter list of <add-function>, <declare-function>
// in a separate header for testing purposes

namespace AddedFunctionParser {

struct Argument
{
    QString type;
    QString name;
    QString defaultValue;

    friend bool comparesEqual(const Argument &lhs, const Argument &rhs) noexcept
    {
        return lhs.type == rhs.type && lhs.name == rhs.name
               && lhs.defaultValue == rhs.defaultValue;
    }
    Q_DECLARE_EQUALITY_COMPARABLE(Argument)
};

using Arguments = QList<Argument>;

#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug d, const Argument &a);
#endif

Arguments splitParameters(QStringView paramString, QString *errorMessage = nullptr);

} // namespace AddedFunctionParser

#endif // MODIFICATIONS_P_H