mirror of
https://github.com/RPCSX/rpcsx.git
synced 2026-04-04 22:19:02 +00:00
Merge orbis-kernel submodule
This commit is contained in:
parent
91f48cdf77
commit
1ee6b7c970
97 changed files with 8134 additions and 1 deletions
22
orbis-kernel/include/orbis/error/SysResult.hpp
Normal file
22
orbis-kernel/include/orbis/error/SysResult.hpp
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
#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
|
||||
Loading…
Add table
Add a link
Reference in a new issue