summaryrefslogtreecommitdiffhomepage
path: root/Private/NewKit/Ref.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/Ref.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/Ref.hpp')
-rw-r--r--Private/NewKit/Ref.hpp89
1 files changed, 0 insertions, 89 deletions
diff --git a/Private/NewKit/Ref.hpp b/Private/NewKit/Ref.hpp
deleted file mode 100644
index b062cf09..00000000
--- a/Private/NewKit/Ref.hpp
+++ /dev/null
@@ -1,89 +0,0 @@
-
-/* -------------------------------------------
-
- Copyright Mahrouss Logic
-
-------------------------------------------- */
-
-#pragma once
-
-#include <NewKit/Defines.hpp>
-#include <NewKit/KernelCheck.hpp>
-
-namespace NewOS
-{
- template <typename T>
- class Ref final
- {
- public:
- Ref() = default;
- ~Ref() = default;
-
- public:
- Ref(T cls, const bool& strong = false)
- : fClass(cls), fStrong(strong)
- {
- }
-
- Ref& operator=(T ref)
- {
- fClass = ref;
- return *this;
- }
-
- public:
- T operator->() const
- {
- return fClass;
- }
-
- T& Leak()
- {
- return fClass;
- }
-
- T operator*()
- {
- return fClass;
- }
-
- bool IsStrong() const
- {
- return fStrong;
- }
-
- operator bool()
- {
- return fStrong;
- }
-
- private:
- T fClass;
- bool fStrong{false};
- };
-
- template <typename T>
- class NonNullRef final
- {
- public:
- NonNullRef() = delete;
- NonNullRef(nullPtr) = delete;
-
- NonNullRef(T* ref)
- : fRef(ref, true)
- {
- }
-
- Ref<T>& operator->()
- {
- MUST_PASS(fRef);
- return fRef;
- }
-
- NonNullRef& operator=(const NonNullRef<T>& ref) = delete;
- NonNullRef(const NonNullRef<T>& ref) = default;
-
- private:
- Ref<T> fRef{nullptr};
- };
-} // namespace NewOS