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 | |
12 | QT_BEGIN_NAMESPACE |
13 | |
14 | // ### Qt 7: should this be called QQmlMessage, since it can have a message type? |
15 | class QDebug; |
16 | class QQmlErrorPrivate; |
17 | class Q_QML_EXPORT QQmlError |
18 | { |
19 | public: |
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); |
52 | private: |
53 | QQmlErrorPrivate *d; |
54 | }; |
55 | |
56 | QDebug Q_QML_EXPORT operator<<(QDebug debug, const QQmlError &error); |
57 | |
58 | Q_DECLARE_TYPEINFO(QQmlError, Q_RELOCATABLE_TYPE); |
59 | |
60 | QT_END_NAMESPACE |
61 | |
62 | #endif // QQMLERROR_H |
63 |