QSystemError: add a couple of utility methods

Change-Id: Ic7a44d264a01b2ca3f0899f5dad483482153c0c9
Reviewed-by: Rym Bouabid <rym.bouabid@qt.io>
Reviewed-by: Yuhang Zhao <yuhangzhao@deepin.org>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
bb10
Ahmad Samir 2024-03-12 01:18:56 +02:00
parent 76ebf51bc0
commit 305dc14674
1 changed files with 7 additions and 0 deletions

View File

@ -40,12 +40,19 @@ public:
constexpr ErrorScope scope() const { return errorScope; }
constexpr int error() const { return errorCode; }
constexpr bool ok() const noexcept { return errorScope == NoError; }
static constexpr QSystemError stdError(int error)
{ return QSystemError(error, StandardLibraryError); }
static Q_CORE_EXPORT QString string(ErrorScope errorScope, int errorCode);
static Q_CORE_EXPORT QString stdString(int errorCode = -1);
#ifdef Q_OS_WIN
static Q_CORE_EXPORT QString windowsString(int errorCode = -1);
using HRESULT = long;
static Q_CORE_EXPORT QString windowsComString(HRESULT hr);
static constexpr QSystemError nativeError(int error)
{ return QSystemError(error, NativeError); }
#endif
// data members