diff options
| author | Amlal <amlal.elmahrouss@icloud.com> | 2025-02-16 18:18:35 +0100 |
|---|---|---|
| committer | Amlal <amlal.elmahrouss@icloud.com> | 2025-02-16 18:18:35 +0100 |
| commit | 384710f48befc0e68d9fd8e70926b4ab8163119d (patch) | |
| tree | d27ee80549c5accafaec71bb7252daeb8dc95547 /dev | |
| parent | 87645d4773baf51c50b1d05803c85630c199790b (diff) | |
Refactor LibCF's Ref to CFRef.
Signed-off-by: Amlal <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'dev')
| -rw-r--r-- | dev/Usr/LibCF/Ref.h | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/dev/Usr/LibCF/Ref.h b/dev/Usr/LibCF/Ref.h index bc3c26f4..5ad694a8 100644 --- a/dev/Usr/LibCF/Ref.h +++ b/dev/Usr/LibCF/Ref.h @@ -13,29 +13,29 @@ namespace LibCF { template <typename T> - class Ref final + class CFRef final { public: - Ref() = default; + CFRef() = default; - ~Ref() + ~CFRef() { if (MmGetHeapFlags(fClass) != -1) delete fClass; } public: - Ref(T* cls) + CFRef(T* cls) : fClass(cls) { } - Ref(T cls) + CFRef(T cls) : fClass(&cls) { } - Ref& operator=(T ref) + CFRef& operator=(T ref) { if (!fClass) return *this; @@ -77,29 +77,29 @@ namespace LibCF }; template <typename T> - class NonNullRef final + class CFNonNullRef final { public: - NonNullRef() = delete; - NonNullRef(nullPtr) = delete; + CFNonNullRef() = delete; + CFNonNullRef(nullPtr) = delete; - NonNullRef(T* ref) + CFNonNullRef(T* ref) : fRef(ref) { MUST_PASS(ref); } - Ref<T>& operator->() + CFRef<T>& operator->() { MUST_PASS(fRef); return fRef; } - NonNullRef& operator=(const NonNullRef<T>& ref) = delete; - NonNullRef(const NonNullRef<T>& ref) = default; + CFNonNullRef& operator=(const CFNonNullRef<T>& ref) = delete; + CFNonNullRef(const CFNonNullRef<T>& ref) = default; private: - Ref<T> fRef{nullptr}; + CFRef<T> fRef{nullptr}; }; } // namespace LibCF |
