lib/error: Move definitions of constructors of ErrorOr<> inside class definition.

Soda
BodgeMaster 2022-08-24 01:19:59 +02:00
parent 327ad9a9b5
commit 4934a78aaa
1 changed files with 21 additions and 27 deletions

View File

@ -23,37 +23,31 @@ struct ErrorOr {
uint8_t errorCode;
T value;
ErrorOr();
ErrorOr(T);
ErrorOr(bool, uint8_t);
ErrorOr(bool, uint8_t, T);
ErrorOr() {
this->isError = false;
this->errorCode = 0;
}
ErrorOr(T value) {
this->isError = false;
this->errorCode = 0;
this->value = value;
}
ErrorOr(bool isError, uint8_t errorCode) {
this->isError = isError;
this->errorCode = errorCode;
}
ErrorOr(bool isError, uint8_t errorCode, T value) {
this->isError = isError;
this->errorCode = errorCode;
this->value = value;
}
};
template <typename T>
ErrorOr<T>::ErrorOr() {
this->isError = false;
this->errorCode = 0;
}
template <typename T>
ErrorOr<T>::ErrorOr(T value) {
this->isError = false;
this->errorCode = 0;
this->value = value;
}
template <typename T>
ErrorOr<T>::ErrorOr(bool isError, uint8_t errorCode) {
this->isError = isError;
this->errorCode = errorCode;
}
template <typename T>
ErrorOr<T>::ErrorOr(bool isError, uint8_t errorCode, T value) {
this->isError = isError;
this->errorCode = errorCode;
this->value = value;
}
namespace ErrorCodes {
// These are all arbitrary values used to assign error codes to different