1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QQMLERROR_H
5#define QQMLERROR_H
6
7#include <QtQml/qtqmlglobal.h>
8
9#include <QtCore/qurl.h>
10#include <QtCore/qstring.h>
11
12QT_BEGIN_NAMESPACE
13
14// ### Qt 7: should this be called QQmlMessage, since it can have a message type?
15class QDebug;
16class QQmlErrorPrivate;
17class Q_QML_EXPORT QQmlError
18{
19public:
20 QQmlError();
21 QQmlError(const QQmlError &);
22 QQmlError(QQmlError &&other) noexcept
23 : d(std::exchange(obj&: other.d, new_val: nullptr))
24 {}
25
26 QQmlError &operator=(const QQmlError &);
27 QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QQmlError)
28 ~QQmlError();
29
30 void swap(QQmlError &other)
31 { qt_ptr_swap(lhs&: d, rhs&: other.d); }
32
33 bool isValid() const;
34
35 QUrl url() const;
36 void setUrl(const QUrl &);
37 QString description() const;
38 void setDescription(const QString &);
39 int line() const;
40 void setLine(int);
41 int column() const;
42 void setColumn(int);
43
44 QObject *object() const;
45 void setObject(QObject *);
46
47 QtMsgType messageType() const;
48 void setMessageType(QtMsgType messageType);
49
50 QString toString() const;
51 friend bool Q_QML_EXPORT operator==(const QQmlError &a, const QQmlError &b);
52private:
53 QQmlErrorPrivate *d;
54};
55
56QDebug Q_QML_EXPORT operator<<(QDebug debug, const QQmlError &error);
57
58Q_DECLARE_TYPEINFO(QQmlError, Q_RELOCATABLE_TYPE);
59
60QT_END_NAMESPACE
61
62#endif // QQMLERROR_H
63

source code of qtdeclarative/src/qml/qml/qqmlerror.h