diff options
| author | Amlal El Mahrouss <amlal@nekernel.org> | 2025-10-26 17:51:30 +0100 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal@nekernel.org> | 2025-10-26 17:51:30 +0100 |
| commit | 09d50a07349df2a5fc1c62452d0f924549db83e6 (patch) | |
| tree | 6e18e55ad5087973a8fabd28e2ec9c0b25d369ab /dev/CompilerKit/ErrorOr.h | |
| parent | f0ee6dc640d1d1f00c40bc2f58e9d6a8fd94bd2b (diff) | |
feat: new ErrorOr API for NeCTI.
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'dev/CompilerKit/ErrorOr.h')
| -rw-r--r-- | dev/CompilerKit/ErrorOr.h | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/dev/CompilerKit/ErrorOr.h b/dev/CompilerKit/ErrorOr.h index ef6cb84..ba7b883 100644 --- a/dev/CompilerKit/ErrorOr.h +++ b/dev/CompilerKit/ErrorOr.h @@ -9,6 +9,7 @@ #pragma once +#include <CompilerKit/StringKit.h> #include <CompilerKit/Defines.h> #include <CompilerKit/ErrorID.h> #include <CompilerKit/Ref.h> @@ -24,17 +25,15 @@ class ErrorOr final { public: explicit ErrorOr(Int32 err) : mId(err) {} - - explicit ErrorOr(nullPtr Null) {} - - explicit ErrorOr(T Class) : mRef(Class) {} + explicit ErrorOr(nullPtr null) {} + explicit ErrorOr(T klass) : mRef(klass) {} ErrorOr& operator=(const ErrorOr&) = default; ErrorOr(const ErrorOr&) = default; Ref<T> Leak() { return mRef; } - Int32 Error() { return mId; } + ErrorT Error() { return mId; } Bool HasError() { return mId != NECTI_SUCCESS; } @@ -42,9 +41,9 @@ class ErrorOr final { private: Ref<T> mRef; - Int32 mId{0}; + ErrorT mId{0}; }; using ErrorOrAny = ErrorOr<voidPtr>; - +using ErrorOrString = ErrorOr<STLString>; } // namespace CompilerKit |
