mirror of
https://github.com/RPCSX/rpcsx.git
synced 2025-12-06 07:12:14 +01:00
23 lines
500 B
C++
23 lines
500 B
C++
|
|
#pragma once
|
||
|
|
|
||
|
|
namespace orbis {
|
||
|
|
enum class ErrorCode : int;
|
||
|
|
|
||
|
|
class SysResult {
|
||
|
|
int mValue = 0;
|
||
|
|
|
||
|
|
public:
|
||
|
|
SysResult() = default;
|
||
|
|
SysResult(ErrorCode ec) : mValue(-static_cast<int>(ec)){}
|
||
|
|
|
||
|
|
[[nodiscard]] static SysResult notAnError(ErrorCode ec) {
|
||
|
|
SysResult result;
|
||
|
|
result.mValue = static_cast<int>(ec);
|
||
|
|
return result;
|
||
|
|
}
|
||
|
|
|
||
|
|
[[nodiscard]] int value() const { return mValue < 0 ? -mValue : mValue; }
|
||
|
|
[[nodiscard]] bool isError() const { return mValue < 0; }
|
||
|
|
};
|
||
|
|
} // namespace orbis
|