aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlerror.h
blob: 8ca57f1b99689b76107e0040a2d9922e9f8cfcb5 (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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only

#ifndef QQMLERROR_H
#define QQMLERROR_H

#include <QtQml/qtqmlglobal.h>

#include <QtCore/qurl.h>
#include <QtCore/qstring.h>

QT_BEGIN_NAMESPACE

// ### Qt 7: should this be called QQmlMessage, since it can have a message type?
class QDebug;
class QQmlErrorPrivate;
class Q_QML_EXPORT QQmlError
{
public:
    QQmlError();
    QQmlError(const QQmlError &);
    QQmlError(QQmlError &&other) noexcept
        : d(std::exchange(other.d, nullptr))
    {}

    QQmlError &operator=(const QQmlError &);
    QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QQmlError)
    ~QQmlError();

    void swap(QQmlError &other)
    { qt_ptr_swap(d, other.d); }

    bool isValid() const;

    QUrl url() const;
    void setUrl(const QUrl &);
    QString description() const;
    void setDescription(const QString &);
    int line() const;
    void setLine(int);
    int column() const;
    void setColumn(int);

    QObject *object() const;
    void setObject(QObject *);

    QtMsgType messageType() const;
    void setMessageType(QtMsgType messageType);

    QString toString() const;
    friend bool Q_QML_EXPORT operator==(const QQmlError &a, const QQmlError &b);
private:
    QQmlErrorPrivate *d;
};

QDebug Q_QML_EXPORT operator<<(QDebug debug, const QQmlError &error);

Q_DECLARE_TYPEINFO(QQmlError, Q_RELOCATABLE_TYPE);

QT_END_NAMESPACE

#endif // QQMLERROR_H