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
qsystemerror_p.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// Qt-Security score:significant reason:default
4
5#ifndef QSYSTEMERROR_P_H
6#define QSYSTEMERROR_P_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. It exists purely as an
13// implementation detail. This header file may change from version to
14// version without notice, or even be removed.
15//
16// We mean it.
17//
18
19#include <QtCore/private/qglobal_p.h>
20#include <qstring.h>
21
23
25{
26public:
33
34 constexpr explicit QSystemError(int error, ErrorScope scope)
35 : errorCode(error), errorScope(scope)
36 {
37 }
38 constexpr QSystemError() = default;
39
40 QString toString() const { return string(errorScope, errorCode); }
41 constexpr ErrorScope scope() const { return errorScope; }
42 constexpr int error() const { return errorCode; }
43
44 constexpr bool ok() const noexcept { return errorScope == NoError; }
45 static constexpr QSystemError stdError(int error)
47
48 static Q_CORE_EXPORT QString string(ErrorScope errorScope, int errorCode);
49 static Q_CORE_EXPORT QString stdString(int errorCode = -1);
50#ifdef Q_OS_WIN
52 using HRESULT = long;
54
55 static constexpr QSystemError nativeError(int error)
56 { return QSystemError(error, NativeError); }
57#endif
58
59 // data members
60 int errorCode = 0;
62};
63
64QT_END_NAMESPACE
65
66#endif // QSYSTEMERROR_P_H
constexpr bool ok() const noexcept
constexpr QSystemError(int error, ErrorScope scope)
ErrorScope errorScope
constexpr QSystemError()=default
constexpr int error() const
QString toString() const
constexpr ErrorScope scope() const
static constexpr QSystemError stdError(int error)
Combined button and popup list for selecting options.
QString qt_error_string(int code)
static QString standardLibraryErrorString(int errorCode)