From b3e76bf866b4223390585589786600475c9fdcae Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Fri, 15 Mar 2024 08:03:35 +0100 Subject: API: Inconsitency fix. Signed-off-by: Amlal El Mahrouss --- Public/Kits/System.Core/FileAPI.hxx | 14 ++++++++------ Public/Kits/System.Core/HeapAPI.cxx | 13 +++++++------ Public/Kits/System.Core/HeapAPI.hxx | 34 ++++++++++++++++++---------------- 3 files changed, 33 insertions(+), 28 deletions(-) (limited to 'Public/Kits/System.Core') diff --git a/Public/Kits/System.Core/FileAPI.hxx b/Public/Kits/System.Core/FileAPI.hxx index 66ecef22..2f799330 100644 --- a/Public/Kits/System.Core/FileAPI.hxx +++ b/Public/Kits/System.Core/FileAPI.hxx @@ -7,20 +7,21 @@ #ifndef _SYSTEM_KIT_HCORE_FILE_HPP #define _SYSTEM_KIT_HCORE_FILE_HPP -#include +#include #include using namespace HCore; /// @brief SOM class, translated to C++ -class HFile final { +namespace System { +class File final { public: - explicit HFile(const char *path); - ~HFile(); + explicit File(const char *path); + ~File(); public: - HCORE_COPY_DEFAULT(HFile); + HCORE_COPY_DEFAULT(File); public: voidPtr Read(SizeT off, SizeT sz); @@ -35,6 +36,7 @@ class HFile final { void MIME(const char *mime); }; -typedef HFile *HFilePtr; +typedef File *FilePtr; +} // namespace System #endif // ifndef _SYSTEM_KIT_HCORE_FILE_HPP diff --git a/Public/Kits/System.Core/HeapAPI.cxx b/Public/Kits/System.Core/HeapAPI.cxx index 2dc7338b..232b4927 100644 --- a/Public/Kits/System.Core/HeapAPI.cxx +++ b/Public/Kits/System.Core/HeapAPI.cxx @@ -8,28 +8,29 @@ #include using namespace HCore; +using namespace System; STATIC HcObjectPtr kObjectHeap; -HHeap* HHeap::Shared() noexcept { - static HHeap* heap = nullptr; +Heap* Heap::Shared() noexcept { + static Heap* heap = nullptr; if (!heap) { - heap = new HHeap(); + heap = new Heap(); kObjectHeap = HcGetProcessHeap(); } return heap; } -void HHeap::Delete(HHeapPtr me) noexcept { HcFreeProcessHeap(kObjectHeap, me); } +void Heap::Delete(HeapPtr me) noexcept { HcFreeProcessHeap(kObjectHeap, me); } -SizeT HHeap::Size(HHeapPtr me) noexcept { +SizeT Heap::Size(HeapPtr me) noexcept { CA_MUST_PASS(me); return HcProcessHeapSize(kObjectHeap, me); } -HHeapPtr HHeap::New(const SizeT &sz, const Int32 flags) { +HeapPtr Heap::New(const SizeT &sz, const Int32 flags) { SizeT _sz = sz; if (!_sz) ++_sz; diff --git a/Public/Kits/System.Core/HeapAPI.hxx b/Public/Kits/System.Core/HeapAPI.hxx index 9391bc4f..f50ff6f7 100644 --- a/Public/Kits/System.Core/HeapAPI.hxx +++ b/Public/Kits/System.Core/HeapAPI.hxx @@ -6,16 +6,17 @@ #pragma once -#include +#include #include /// @brief SOM class, translated to C++ using namespace HCore; -class HMemoryException; +namespace System { +class MemoryException; -typedef VoidPtr HHeapPtr; +typedef VoidPtr HeapPtr; enum { kHeapExpandable = 2, @@ -25,32 +26,32 @@ enum { kHeapNoFlags = 0 }; -class HHeap final { +class Heap final { private: - explicit HHeap(); + explicit Heap(); public: - ~HHeap(); + ~Heap(); public: - HCORE_COPY_DEFAULT(HHeap); + HCORE_COPY_DEFAULT(Heap); public: - static HHeap *Shared() noexcept; + static Heap *Shared() noexcept; public: - void Delete(HHeapPtr me) noexcept; - SizeT Size(HHeapPtr me) noexcept; - HHeapPtr New(const SizeT &sz, const Int32 flags = kHeapNoFlags); + void Delete(HeapPtr me) noexcept; + SizeT Size(HeapPtr me) noexcept; + HeapPtr New(const SizeT &sz, const Int32 flags = kHeapNoFlags); }; -class HMemoryException final { +class MemoryException final { public: - explicit HMemoryException() = default; - ~HMemoryException() = default; + explicit MemoryException() = default; + ~MemoryException() = default; public: - HCORE_COPY_DEFAULT(HMemoryException); + HCORE_COPY_DEFAULT(MemoryException); public: const char *Name(); @@ -60,5 +61,6 @@ class HMemoryException final { const char *mReason{"HeapAPI: Memory Exception!"}; private: - friend HHeap; + friend Heap; }; +} // namespace System \ No newline at end of file -- cgit v1.2.3