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
4#ifndef QSYSTEMERROR_P_H
5#define QSYSTEMERROR_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 <QtCore/private/qglobal_p.h>
19#include <qstring.h>
20
22
24{
25public:
32
33 constexpr explicit QSystemError(int error, ErrorScope scope)
34 : errorCode(error), errorScope(scope)
35 {
36 }
37 constexpr QSystemError() = default;
38
39 QString toString() const { return string(errorScope, errorCode); }
40 constexpr ErrorScope scope() const { return errorScope; }
41 constexpr int error() const { return errorCode; }
42
43 constexpr bool ok() const noexcept { return errorScope == NoError; }
44 static constexpr QSystemError stdError(int error)
46
47 static Q_CORE_EXPORT QString string(ErrorScope errorScope, int errorCode);
48 static Q_CORE_EXPORT QString stdString(int errorCode = -1);
49#ifdef Q_OS_WIN
51 using HRESULT = long;
53
54 static constexpr QSystemError nativeError(int error)
55 { return QSystemError(error, NativeError); }
56#endif
57
58 // data members
59 int errorCode = 0;
61};
62
63QT_END_NAMESPACE
64
65#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)
QString qt_error_string(int code)
static QString standardLibraryErrorString(int errorCode)