Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qexception.h
Go to the documentation of this file.
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 QTCORE_QEXCEPTION_H
5#define QTCORE_QEXCEPTION_H
6
7#include <QtCore/qatomic.h>
8#include <QtCore/qshareddata.h>
9
10#ifndef QT_NO_EXCEPTIONS
11# include <exception>
12#endif
13
15
17
18
19#if !defined(QT_NO_EXCEPTIONS) || defined(Q_QDOC)
20
21class Q_CORE_EXPORT QException : public std::exception
22{
23public:
24 QException() = default;
25 ~QException() noexcept;
26 QException(const QException &) = default;
27 QException &operator=(const QException &) = default;
28 virtual void raise() const;
29 virtual QException *clone() const;
30};
31
33class Q_CORE_EXPORT QUnhandledException final : public QException
34{
35public:
36 QUnhandledException(std::exception_ptr exception = nullptr) noexcept;
37 ~QUnhandledException() noexcept override;
38
39 QUnhandledException(QUnhandledException &&other) noexcept;
40 QUnhandledException(const QUnhandledException &other) noexcept;
41
42 void swap(QUnhandledException &other) noexcept { d.swap(other.d); }
43
44 QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QUnhandledException)
45 QUnhandledException &operator=(const QUnhandledException &other) noexcept;
46
47 void raise() const override;
48 QUnhandledException *clone() const override;
49
50 std::exception_ptr exception() const;
51
52private:
53 QSharedDataPointer<QUnhandledExceptionPrivate> d;
54};
55
56namespace QtPrivate {
57
58class Q_CORE_EXPORT ExceptionStore
59{
60public:
61 void setException(const QException &e);
63 bool hasException() const;
66 Q_NORETURN void rethrowException() const;
68};
69
70} // namespace QtPrivate
71
72#else // QT_NO_EXCEPTIONS
73
74namespace QtPrivate {
75
76class Q_CORE_EXPORT ExceptionStore
77{
78public:
79 ExceptionStore() { }
80 inline void throwPossibleException() {}
81 inline void rethrowException() const { }
82};
83
84} // namespace QtPrivate
85
86#endif // QT_NO_EXCEPTIONS
87
88QT_END_NAMESPACE
89
90#endif
\inmodule QtCore
Definition qexception.h:22
QUnhandledExceptionPrivate(std::exception_ptr exception) noexcept
std::exception_ptr exceptionPtr
Combined button and popup list for selecting options.
QFuture< void > future
[5]