Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qerrorinfo_p.h
Go to the documentation of this file.
1// Copyright (C) 2023 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 QERRORINFO_P_H
5#define QERRORINFO_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtMultimedia/qtmultimediaglobal.h>
19#include <QString>
20
22
23template <typename ErrorCode, ErrorCode NoError = ErrorCode::NoError>
25{
26public:
28 : m_code(error), m_description(std::move(description))
29 {
30 }
31
32 template <typename Notifier>
34 {
35 const bool changed = code != m_code || description != m_description;
36
37 m_code = code;
38 m_description = std::move(description);
39
40 if (code != NoError)
41 emit notifier.errorOccurred(m_code, m_description);
42
43 if (changed)
44 emit notifier.errorChanged();
45 }
46
47 ErrorCode code() const { return m_code; }
48 QString description() const { return m_description; };
49
50private:
51 ErrorCode m_code;
52 QString m_description;
53};
54
56
57#endif // QERRORINFO_P_H
DarwinBluetooth::LECBManagerNotifier * notifier
QErrorInfo(ErrorCode error=NoError, QString description={})
void setAndNotify(ErrorCode code, QString description, Notifier &notifier)
ErrorCode code() const
QString description() const
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
Combined button and popup list for selecting options.
DBusConnection const char DBusError * error
ErrorCode
Definition main.cpp:3324
@ NoError
Definition main.cpp:34
#define emit