diff options
author | Ahmad Samir <a.samirh78@gmail.com> | 2024-03-12 01:18:56 +0200 |
---|---|---|
committer | Ahmad Samir <a.samirh78@gmail.com> | 2024-04-19 21:09:13 +0200 |
commit | 305dc14674adf812a397d6504b8a5011823a5d86 (patch) | |
tree | fb37954c40f746696afc040e062df05b70bafb7e | |
parent | 76ebf51bc08f6af624a8540e7af88b9129b22ae1 (diff) |
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>
-rw-r--r-- | src/corelib/kernel/qsystemerror_p.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/corelib/kernel/qsystemerror_p.h b/src/corelib/kernel/qsystemerror_p.h index 66c434cb13..72ced63dc5 100644 --- a/src/corelib/kernel/qsystemerror_p.h +++ b/src/corelib/kernel/qsystemerror_p.h @@ -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 |