summaryrefslogtreecommitdiffhomepage
path: root/dev/Kernel/NewKit/ErrorOr.hxx
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-08-18 21:39:29 +0200
committerAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-08-18 21:39:29 +0200
commitda70596895d8135e08f8caac6978117697b4c021 (patch)
tree2516785b5434df8453687f05dc8dd877438901ab /dev/Kernel/NewKit/ErrorOr.hxx
parent005de79004c9d30e64bdee6e14e06f9d47d1f2ab (diff)
[REFACTOR]
Improved project structure. Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'dev/Kernel/NewKit/ErrorOr.hxx')
-rw-r--r--dev/Kernel/NewKit/ErrorOr.hxx72
1 files changed, 0 insertions, 72 deletions
diff --git a/dev/Kernel/NewKit/ErrorOr.hxx b/dev/Kernel/NewKit/ErrorOr.hxx
deleted file mode 100644
index ae2763b2..00000000
--- a/dev/Kernel/NewKit/ErrorOr.hxx
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * ========================================================
- *
- * Kernel
- * Copyright ZKA Technologies., all rights reserved.
- *
- * ========================================================
- */
-
-#pragma once
-
-#include <NewKit/Defines.hxx>
-#include <NewKit/Ref.hxx>
-
-namespace Kernel
-{
- using ErrorT = UInt;
-
- template <typename T>
- class ErrorOr final
- {
- public:
- ErrorOr() = default;
- ~ErrorOr() = default;
-
- public:
- explicit ErrorOr(Int32 err)
- : mId(err)
- {
- }
-
- explicit ErrorOr(nullPtr Null)
- {
- }
-
- explicit ErrorOr(T Class)
- : mRef(Class, true)
- {
- }
-
- ErrorOr& operator=(const ErrorOr&) = default;
- ErrorOr(const ErrorOr&) = default;
-
- ErrorOr& operator=(const Ref<T>& refErr)
- {
- mRef = refErr;
- return *this;
- }
-
- Ref<T>& Leak()
- {
- return mRef;
- }
-
- Int32 Error()
- {
- return mId;
- }
-
- operator bool()
- {
- return mRef;
- }
-
- private:
- Ref<T> mRef;
- Int32 mId{0};
- };
-
- using ErrorOrAny = ErrorOr<voidPtr>;
-
-} // namespace Kernel