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>
This commit is contained in:
Thiago Macieira 2017-07-06 21:27:47 -07:00
parent f6684ed043
commit 81a3425d15

View File

@ -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