summaryrefslogtreecommitdiffhomepage
path: root/Private/NewKit/ErrorOr.hpp
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-05-08 12:32:41 +0200
committerAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-05-08 12:32:41 +0200
commit09dd11ddf800898c00ecb04a65fb5cd10fb481fa (patch)
treeeda0b4e23d6a71da7de3a78f0bb76ec3201dd2f9 /Private/NewKit/ErrorOr.hpp
parentca83108fd138cc0398f900e6a6c0a53ad51aee31 (diff)
MHR-23: :boom: changes, reworked project tree.
Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'Private/NewKit/ErrorOr.hpp')
-rw-r--r--Private/NewKit/ErrorOr.hpp72
1 files changed, 0 insertions, 72 deletions
diff --git a/Private/NewKit/ErrorOr.hpp b/Private/NewKit/ErrorOr.hpp
deleted file mode 100644
index a2b5da62..00000000
--- a/Private/NewKit/ErrorOr.hpp
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
-* ========================================================
-*
-* NewOS
-* Copyright Mahrouss Logic, all rights reserved.
-*
-* ========================================================
-*/
-
-#pragma once
-
-#include <NewKit/Defines.hpp>
-#include <NewKit/Ref.hpp>
-
-namespace NewOS
-{
- 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)
- {
- }
-
- 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 NewOS