diff options
Diffstat (limited to 'Public/Kits/System.Core/Heap.hxx')
| -rw-r--r-- | Public/Kits/System.Core/Heap.hxx | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/Public/Kits/System.Core/Heap.hxx b/Public/Kits/System.Core/Heap.hxx new file mode 100644 index 00000000..292a1227 --- /dev/null +++ b/Public/Kits/System.Core/Heap.hxx @@ -0,0 +1,62 @@ +/* ------------------------------------------- + + Copyright Mahrouss Logic + +------------------------------------------- */ + +#pragma once + +#include <System.Core/Defs.hxx> +#include <CompilerKit/CompilerKit.hxx> + +namespace System { +class MemoryException; + +typedef PVOID HeapPtr; + +enum { + kHeapExpandable = 2, + kHeapNoExecute = 4, + kHeapShared = 6, + kHeapReadOnly = 8, + kHeapNoFlags = 0 +}; + +class Heap final { + private: + explicit Heap(); + + public: + ~Heap(); + + public: + HCORE_COPY_DEFAULT(Heap); + + public: + static Heap *Shared() noexcept; + + public: + void Delete(HeapPtr me) noexcept; + SizeT Size(HeapPtr me) noexcept; + HeapPtr New(const SizeT &sz, const Int32 flags = kHeapNoFlags); +}; + +class MemoryException final { + public: + explicit MemoryException() = default; + ~MemoryException() = default; + + public: + HCORE_COPY_DEFAULT(MemoryException); + + public: + const char *Name(); + const char *Reason(); + + private: + const char *mReason{"System.Core: Process Heap Exception: Catastrophic failure!"}; + + private: + friend Heap; +}; +} // namespace System
\ No newline at end of file |
