diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2017-07-06 21:27:47 -0700 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2017-11-30 08:30:46 +0000 |
commit | 81a3425d15c00a20eaf987baf995571d97aca323 (patch) | |
tree | 118e277bfe3edbfabfb2e0be80fbd7e7702cc671 /src/corelib/kernel | |
parent | f6684ed043320c49c299e089580b4c013818c38e (diff) |
QSystemError: move inline methods to class body
Makes the code smaller and neater. Take this opportunity to mark some of
them constexpr.
Change-Id: Idaa189413f404cffb1eafffd14cef1df599c9ab7
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'src/corelib/kernel')
-rw-r--r-- | src/corelib/kernel/qsystemerror_p.h | 44 |
1 files changed, 10 insertions, 34 deletions
diff --git a/src/corelib/kernel/qsystemerror_p.h b/src/corelib/kernel/qsystemerror_p.h index 1d8c253f53..3554ae5636 100644 --- a/src/corelib/kernel/qsystemerror_p.h +++ b/src/corelib/kernel/qsystemerror_p.h @@ -66,12 +66,15 @@ public: NativeError }; - inline QSystemError(int error, ErrorScope scope); - inline QSystemError(); + Q_DECL_CONSTEXPR explicit QSystemError(int error, ErrorScope scope) + : errorCode(error), errorScope(scope) + { + } + Q_DECL_CONSTEXPR QSystemError() = default; - inline QString toString() const; - inline ErrorScope scope() const; - inline int error() const; + QString toString() const { return string(errorScope, errorCode); } + Q_DECL_CONSTEXPR ErrorScope scope() const { return errorScope; } + Q_DECL_CONSTEXPR int error() const { return errorCode; } static QString string(ErrorScope errorScope, int errorCode); static QString stdString(int errorCode = -1); @@ -80,37 +83,10 @@ public: #endif //data members - int errorCode; - ErrorScope errorScope; + int errorCode = 0; + ErrorScope errorScope = NoError; }; -QSystemError::QSystemError(int error, QSystemError::ErrorScope scope) -: errorCode(error), errorScope(scope) -{ - -} - -QSystemError::QSystemError() -: errorCode(0), errorScope(NoError) -{ - -} - -QString QSystemError::toString() const -{ - return string(errorScope, errorCode); -} - -QSystemError::ErrorScope QSystemError::scope() const -{ - return errorScope; -} - -int QSystemError::error() const -{ - return errorCode; -} - QT_END_NAMESPACE #endif // QSYSTEMERROR_P_H |