From a9ac78b47dd040e04afc4990dace2472df2302e4 Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Tue, 13 Feb 2024 15:41:34 +0100 Subject: HCR-15: fix GApplication class, add static on Shared() function. Signed-off-by: Amlal El Mahrouss --- Private/KernelKit/MSDOS.hpp | 13 +++++++++++++ Private/NewBoot/Source/RuntimeMain.cxx | 20 ++++++-------------- Public/Kits/GKit/Core.hpp | 8 ++++---- 3 files changed, 23 insertions(+), 18 deletions(-) diff --git a/Private/KernelKit/MSDOS.hpp b/Private/KernelKit/MSDOS.hpp index 4f098249..2276f3cb 100644 --- a/Private/KernelKit/MSDOS.hpp +++ b/Private/KernelKit/MSDOS.hpp @@ -16,6 +16,8 @@ #include +#include "PE.hpp" + typedef HCore::UInt32 DosWord; typedef HCore::Long DosLong; @@ -41,4 +43,15 @@ typedef struct _DosHeader { DosLong eLfanew; } DosHeader, *DosHeaderPtr; +namespace HCore { +/// @brief Find the PE header inside the the blob. +inline auto rt_find_exec_header(DosHeaderPtr ptrDos) -> VoidPtr { + if (!ptrDos) return nullptr; + if (ptrDos->eMagic[0] != kMagMz0) return nullptr; + if (ptrDos->eMagic[0] != kMagMz1) return nullptr; + + return (VoidPtr)(&ptrDos->eLfanew + 1); +} +} // namespace HCore + #endif /* ifndef __MSDOS_EXEC__ */ diff --git a/Private/NewBoot/Source/RuntimeMain.cxx b/Private/NewBoot/Source/RuntimeMain.cxx index a520b980..a6e4015c 100644 --- a/Private/NewBoot/Source/RuntimeMain.cxx +++ b/Private/NewBoot/Source/RuntimeMain.cxx @@ -15,15 +15,7 @@ #include #include -namespace Detail { -constexpr Int32 kBufferReadSz = 2048; - -auto FindPEHeader(DosHeaderPtr ptrDos) -> ExecHeaderPtr { - if (!ptrDos) return nullptr; - - return (ExecHeaderPtr)(&ptrDos->eLfanew + 1); -} -} // namespace Detail +#define kBufferReadSz 2048 EFI_EXTERN_C EFI_API Int EfiMain(EfiHandlePtr ImageHandle, EfiSystemTable* SystemTable) { @@ -54,17 +46,17 @@ EFI_EXTERN_C EFI_API Int EfiMain(EfiHandlePtr ImageHandle, BFileReader img(L"HCOREKRNL.EXE", ImageHandle); - img.Size() = Detail::kBufferReadSz; + img.Size() = kBufferReadSz; img.Read(); if (img.Error() == BFileReader::kOperationOkay) { BlobType blob = (BlobType)img.Blob(); - DosHeaderPtr ptrDos = reinterpret_cast(blob); - ExecHeaderPtr ptrHdr = Detail::FindPEHeader(ptrDos); + ExecHeaderPtr ptrHdr = reinterpret_cast( + HCore::rt_find_exec_header(reinterpret_cast(blob))); - if (ptrDos->eMagic[0] == kMagMz0 && ptrDos->eMagic[1] == kMagMz1 && - ptrHdr->mMachine == EFI::Platform() && ptrHdr->mMagic == kPeMagic) { + if (ptrHdr && ptrHdr->mMachine == EFI::Platform() && + ptrHdr->mMagic == kPeMagic) { if (ptrHdr->mNumberOfSections > 1) { UInt64 MapKey = 0; diff --git a/Public/Kits/GKit/Core.hpp b/Public/Kits/GKit/Core.hpp index 00ae524e..39eb341b 100644 --- a/Public/Kits/GKit/Core.hpp +++ b/Public/Kits/GKit/Core.hpp @@ -132,12 +132,12 @@ class G_API GApplication final { GDocument* Document() noexcept { return nullptr; } - GApplication* Shared() noexcept { - STATIC GApplication* gApp = nullptr; + static GApplication* Shared() noexcept { + STATIC GApplication* kApp = nullptr; - if (!gApp) gApp = new GApplication(); + if (!kApp) kApp = new GApplication(); - return gApp; + return kApp; } }; -- cgit v1.2.3 From b75417b44d5f63ea0ead68cbe8f62bd76df62229 Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Tue, 13 Feb 2024 17:20:30 +0100 Subject: HCR-15: Merge to master branch. Important commit and end of ticket. Signed-off-by: Amlal El Mahrouss --- .gitignore | 2 + Private/KernelKit/DebugOutput.hpp | 2 +- Private/KernelKit/Device.hpp | 93 ------------------------------------ Private/KernelKit/DeviceManager.hpp | 93 ++++++++++++++++++++++++++++++++++++ Private/KernelKit/DriveManager.hpp | 2 +- Private/KernelKit/PCI/Dma.hpp | 91 +++++++++++++++++------------------ Private/NetworkKit/NetworkDevice.hpp | 2 +- Private/NewBoot/Source/makefile | 2 +- Private/Root/System/LookAndFeel.css | 46 ++++++++++++++++++ Private/Source/Device.cxx | 10 ---- Private/Source/DeviceManager.cxx | 10 ++++ Private/Source/DriveManager.cxx | 4 +- Private/StorageKit/NVME.hpp | 12 ++++- Public/Kits/GKit/Frame.cxx | 16 +++++++ Public/Kits/GKit/Frame.hpp | 59 +++++++++++++++++++++++ Public/Kits/GKit/GFrame.cxx | 16 ------- Public/Kits/GKit/GFrame.hpp | 59 ----------------------- Public/Kits/GKit/Stylesheet.hxx | 35 ++++++++++++++ 18 files changed, 322 insertions(+), 232 deletions(-) delete mode 100644 Private/KernelKit/Device.hpp create mode 100644 Private/KernelKit/DeviceManager.hpp create mode 100644 Private/Root/System/LookAndFeel.css delete mode 100644 Private/Source/Device.cxx create mode 100644 Private/Source/DeviceManager.cxx create mode 100644 Public/Kits/GKit/Frame.cxx create mode 100644 Public/Kits/GKit/Frame.hpp delete mode 100644 Public/Kits/GKit/GFrame.cxx delete mode 100644 Public/Kits/GKit/GFrame.hpp diff --git a/.gitignore b/.gitignore index 3102b158..ce3034d1 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,8 @@ build.ninja cmake_install.cmake qtcsettings.cmake +LOOK.CSS + x86_64/ *.epm diff --git a/Private/KernelKit/DebugOutput.hpp b/Private/KernelKit/DebugOutput.hpp index dd34df8e..6e651924 100644 --- a/Private/KernelKit/DebugOutput.hpp +++ b/Private/KernelKit/DebugOutput.hpp @@ -9,7 +9,7 @@ #pragma once -#include +#include #include #include diff --git a/Private/KernelKit/Device.hpp b/Private/KernelKit/Device.hpp deleted file mode 100644 index 9a689b26..00000000 --- a/Private/KernelKit/Device.hpp +++ /dev/null @@ -1,93 +0,0 @@ -/* - * ======================================================== - * - * HCore - * Copyright Mahrouss Logic, all rights reserved. - * - * ======================================================== - */ - -/* ------------------------------------------- - - Revision History: - - 31/01/24: Add kDeviceCnt (amlel) - - ------------------------------------------- */ - -#pragma once - -/* HCore */ -/* File: KernelKit/Device.hpp */ -/* Device abstraction and I/O buffer. */ - -#include -#include - -namespace HCore { -template -class DeviceInterface; - -template -class DeviceInterface { - public: - explicit DeviceInterface(void (*Out)(T), void (*In)(T)) - : m_Out(Out), m_In(In) {} - - virtual ~DeviceInterface() = default; - - public: - DeviceInterface &operator=(const DeviceInterface &) = default; - DeviceInterface(const DeviceInterface &) = default; - - public: - DeviceInterface &operator<<(T Data) { - m_Out(Data); - return *this; - } - - DeviceInterface &operator>>(T Data) { - m_In(Data); - return *this; - } - - virtual const char *Name() const { return "DeviceInterface"; } - - operator bool() { return m_Out && m_In; } - bool operator!() { return !m_Out && !m_In; } - - private: - void (*m_Out)(T Data); - void (*m_In)(T Data); -}; - -template -class IOBuf final { - public: - explicit IOBuf(T Dat) : m_Data(Dat) {} - - IOBuf &operator=(const IOBuf &) = default; - IOBuf(const IOBuf &) = default; - - ~IOBuf() = default; - - public: - T operator->() const { return m_Data; } - T &operator[](Size index) const { return m_Data[index]; } - - private: - T m_Data; -}; - -///! @brief Device types enum. -enum { - kDeviceTypeIDE, - kDeviceTypeEthernet, - kDeviceTypeWiFi, - kDeviceTypeRS232, - kDeviceTypeSCSI, - kDeviceTypeSHCI, - kDeviceTypeUSB, - kDeviceTypeCount, -}; -} // namespace HCore diff --git a/Private/KernelKit/DeviceManager.hpp b/Private/KernelKit/DeviceManager.hpp new file mode 100644 index 00000000..9a689b26 --- /dev/null +++ b/Private/KernelKit/DeviceManager.hpp @@ -0,0 +1,93 @@ +/* + * ======================================================== + * + * HCore + * Copyright Mahrouss Logic, all rights reserved. + * + * ======================================================== + */ + +/* ------------------------------------------- + + Revision History: + + 31/01/24: Add kDeviceCnt (amlel) + + ------------------------------------------- */ + +#pragma once + +/* HCore */ +/* File: KernelKit/Device.hpp */ +/* Device abstraction and I/O buffer. */ + +#include +#include + +namespace HCore { +template +class DeviceInterface; + +template +class DeviceInterface { + public: + explicit DeviceInterface(void (*Out)(T), void (*In)(T)) + : m_Out(Out), m_In(In) {} + + virtual ~DeviceInterface() = default; + + public: + DeviceInterface &operator=(const DeviceInterface &) = default; + DeviceInterface(const DeviceInterface &) = default; + + public: + DeviceInterface &operator<<(T Data) { + m_Out(Data); + return *this; + } + + DeviceInterface &operator>>(T Data) { + m_In(Data); + return *this; + } + + virtual const char *Name() const { return "DeviceInterface"; } + + operator bool() { return m_Out && m_In; } + bool operator!() { return !m_Out && !m_In; } + + private: + void (*m_Out)(T Data); + void (*m_In)(T Data); +}; + +template +class IOBuf final { + public: + explicit IOBuf(T Dat) : m_Data(Dat) {} + + IOBuf &operator=(const IOBuf &) = default; + IOBuf(const IOBuf &) = default; + + ~IOBuf() = default; + + public: + T operator->() const { return m_Data; } + T &operator[](Size index) const { return m_Data[index]; } + + private: + T m_Data; +}; + +///! @brief Device types enum. +enum { + kDeviceTypeIDE, + kDeviceTypeEthernet, + kDeviceTypeWiFi, + kDeviceTypeRS232, + kDeviceTypeSCSI, + kDeviceTypeSHCI, + kDeviceTypeUSB, + kDeviceTypeCount, +}; +} // namespace HCore diff --git a/Private/KernelKit/DriveManager.hpp b/Private/KernelKit/DriveManager.hpp index ac39c177..8e6aaefd 100644 --- a/Private/KernelKit/DriveManager.hpp +++ b/Private/KernelKit/DriveManager.hpp @@ -11,7 +11,7 @@ #define __DRIVE_MANAGER__ #include -#include +#include #include #include diff --git a/Private/KernelKit/PCI/Dma.hpp b/Private/KernelKit/PCI/Dma.hpp index 8e027179..0b4b55b8 100644 --- a/Private/KernelKit/PCI/Dma.hpp +++ b/Private/KernelKit/PCI/Dma.hpp @@ -9,73 +9,70 @@ #pragma once -#include +#include #include #include #include #include -namespace HCore -{ -enum class DmaKind -{ - PCI, // Bus mastering is required to be turned on. Basiaclly a request - // control system. 64-Bit access depends on the PAE bit and the device - // (if Double Address Cycle is available) - ISA, // Four DMA channels 0-3; 8 bit transfers and only a megabyte of RAM. - Invalid, +namespace HCore { +enum class DmaKind { + PCI, // Bus mastering is required to be turned on. Basiaclly a request + // control system. 64-Bit access depends on the PAE bit and the device + // (if Double Address Cycle is available) + ISA, // Four DMA channels 0-3; 8 bit transfers and only a megabyte of RAM. + Invalid, }; -class DMAWrapper final -{ - public: - explicit DMAWrapper() = delete; +class DMAWrapper final { + public: + explicit DMAWrapper() = delete; - public: - explicit DMAWrapper(nullPtr) = delete; - explicit DMAWrapper(voidPtr Ptr, DmaKind Kind = DmaKind::PCI) : m_Address(Ptr), m_Kind(Kind) - { - } + public: + explicit DMAWrapper(nullPtr) = delete; + explicit DMAWrapper(voidPtr Ptr, DmaKind Kind = DmaKind::PCI) + : m_Address(Ptr), m_Kind(Kind) {} - public: - DMAWrapper &operator=(voidPtr Ptr); + public: + DMAWrapper &operator=(voidPtr Ptr); - public: - DMAWrapper &operator=(const DMAWrapper &) = default; - DMAWrapper(const DMAWrapper &) = default; + public: + DMAWrapper &operator=(const DMAWrapper &) = default; + DMAWrapper(const DMAWrapper &) = default; - public: - ~DMAWrapper() = default; + public: + ~DMAWrapper() = default; - template T *operator->(); + template + T *operator->(); - template T *Get(const UIntPtr off = 0); + template + T *Get(const UIntPtr off = 0); - public: - operator bool(); - bool operator!(); + public: + operator bool(); + bool operator!(); - public: - bool Write(const UIntPtr &bit, const UIntPtr &offset); - UIntPtr Read(const UIntPtr &offset); - Boolean Check(UIntPtr offset) const; + public: + bool Write(const UIntPtr &bit, const UIntPtr &offset); + UIntPtr Read(const UIntPtr &offset); + Boolean Check(UIntPtr offset) const; - public: - UIntPtr operator[](const UIntPtr &offset); + public: + UIntPtr operator[](const UIntPtr &offset); - private: - voidPtr m_Address{nullptr}; - DmaKind m_Kind{DmaKind::Invalid}; + private: + voidPtr m_Address{nullptr}; + DmaKind m_Kind{DmaKind::Invalid}; - private: - friend class DMAFactory; + private: + friend class DMAFactory; }; -class DMAFactory final -{ - public: - static OwnPtr> Construct(OwnPtr &dma); +class DMAFactory final { + public: + static OwnPtr> Construct(OwnPtr &dma); }; -} // namespace HCore +} // namespace HCore #include diff --git a/Private/NetworkKit/NetworkDevice.hpp b/Private/NetworkKit/NetworkDevice.hpp index a9edb09c..e631e868 100644 --- a/Private/NetworkKit/NetworkDevice.hpp +++ b/Private/NetworkKit/NetworkDevice.hpp @@ -10,7 +10,7 @@ #ifndef _INC_NETWORKDEVICE_HPP__ #define _INC_NETWORKDEVICE_HPP__ -#include +#include #include namespace HCore { diff --git a/Private/NewBoot/Source/makefile b/Private/NewBoot/Source/makefile index 23678e9d..fab7453d 100644 --- a/Private/NewBoot/Source/makefile +++ b/Private/NewBoot/Source/makefile @@ -22,7 +22,7 @@ bootloader-amd64: $(ASM) $(FLAG_ASM) HEl/AMD64/AMD64-VirtualMemory.asm $(LD_GNU) $(OBJ) $(LD_FLAGS) -o HCoreLdr.exe cp HCoreLdr.exe CDROM/EFI/BOOT/BOOTX64.EFI - cp ../../HCoreKrnl.exe CDROM/HCOREKRNL.EXE + cp ../../HCoreKrnl.exe CDROM/HCOREKRNL.EXE && cp ../../Root/System/LookAndFeel.css CDROM/LOOK.CSS .PHONY: run-efi-amd64 run-efi-amd64: diff --git a/Private/Root/System/LookAndFeel.css b/Private/Root/System/LookAndFeel.css new file mode 100644 index 00000000..44e38465 --- /dev/null +++ b/Private/Root/System/LookAndFeel.css @@ -0,0 +1,46 @@ +@layer base { + :root { + --background: 0 0% 100%; + --foreground: 240 10% 3.9%; + --card: 0 0% 100%; + --card-foreground: 240 10% 3.9%; + --popover: 0 0% 100%; + --popover-foreground: 240 10% 3.9%; + --primary: 240 5.9% 10%; + --primary-foreground: 0 0% 98%; + --secondary: 240 4.8% 95.9%; + --secondary-foreground: 240 5.9% 10%; + --muted: 240 4.8% 95.9%; + --muted-foreground: 240 3.8% 46.1%; + --accent: 240 4.8% 95.9%; + --accent-foreground: 240 5.9% 10%; + --destructive: 0 84.2% 60.2%; + --destructive-foreground: 0 0% 98%; + --border: 240 5.9% 90%; + --input: 240 5.9% 90%; + --ring: 240 5.9% 10%; + --radius: 0.5rem; + } + + .dark { + --background: 240 10% 3.9%; + --foreground: 0 0% 98%; + --card: 240 10% 3.9%; + --card-foreground: 0 0% 98%; + --popover: 240 10% 3.9%; + --popover-foreground: 0 0% 98%; + --primary: 0 0% 98%; + --primary-foreground: 240 5.9% 10%; + --secondary: 240 3.7% 15.9%; + --secondary-foreground: 0 0% 98%; + --muted: 240 3.7% 15.9%; + --muted-foreground: 240 5% 64.9%; + --accent: 240 3.7% 15.9%; + --accent-foreground: 0 0% 98%; + --destructive: 0 62.8% 30.6%; + --destructive-foreground: 0 0% 98%; + --border: 240 3.7% 15.9%; + --input: 240 3.7% 15.9%; + --ring: 240 4.9% 83.9%; + } +} diff --git a/Private/Source/Device.cxx b/Private/Source/Device.cxx deleted file mode 100644 index ae72fdad..00000000 --- a/Private/Source/Device.cxx +++ /dev/null @@ -1,10 +0,0 @@ -/* - * ======================================================== - * - * HCore - * Copyright Mahrouss Logic, all rights reserved. - * - * ======================================================== - */ - -#include diff --git a/Private/Source/DeviceManager.cxx b/Private/Source/DeviceManager.cxx new file mode 100644 index 00000000..e5b84bd3 --- /dev/null +++ b/Private/Source/DeviceManager.cxx @@ -0,0 +1,10 @@ +/* + * ======================================================== + * + * HCore + * Copyright Mahrouss Logic, all rights reserved. + * + * ======================================================== + */ + +#include diff --git a/Private/Source/DriveManager.cxx b/Private/Source/DriveManager.cxx index bc100a1a..371758b1 100644 --- a/Private/Source/DriveManager.cxx +++ b/Private/Source/DriveManager.cxx @@ -33,7 +33,7 @@ bool DriveSelector::Mount(DriveTraits *drive) { fDrive = drive; fDrive->fMount(); - kcout << "[Krnl] mounted: " << fDrive->fName << "\n"; + kcout << "Mount: " << fDrive->fName << "\n"; return true; } @@ -49,7 +49,7 @@ DriveTraits *DriveSelector::Unmount() { fDrive->fUnmount(); fDrive = nullptr; - kcout << "[Krnl] unmounted: " << fDrive->fName << "\n"; + kcout << "Unmount: " << fDrive->fName << "\n"; return drivePointer; } diff --git a/Private/StorageKit/NVME.hpp b/Private/StorageKit/NVME.hpp index 1b638989..2e778883 100644 --- a/Private/StorageKit/NVME.hpp +++ b/Private/StorageKit/NVME.hpp @@ -9,7 +9,7 @@ #pragma once -#include +#include #include namespace HCore { @@ -37,4 +37,14 @@ class NVMEDevice : public DeviceInterface { private: void (*fCleanup)(void); }; + +class NVMEPacket { + UIntPtr DataPtr; + SizeT DataSz; + UInt64 DriveID; + + Boolean ErrorSet; + Boolean BusySet; + Boolean ReadySet; +}; } // namespace HCore diff --git a/Public/Kits/GKit/Frame.cxx b/Public/Kits/GKit/Frame.cxx new file mode 100644 index 00000000..939dfc5a --- /dev/null +++ b/Public/Kits/GKit/Frame.cxx @@ -0,0 +1,16 @@ +/* ------------------------------------------- + + Copyright Mahrouss Logic + + File: Frame.cpp + Purpose: + + Revision History: + + 31/01/24: Added file (amlel) + +------------------------------------------- */ + +#include + +namespace HCore {} diff --git a/Public/Kits/GKit/Frame.hpp b/Public/Kits/GKit/Frame.hpp new file mode 100644 index 00000000..f71628a7 --- /dev/null +++ b/Public/Kits/GKit/Frame.hpp @@ -0,0 +1,59 @@ +/* ------------------------------------------- + + Copyright Mahrouss Logic + + File: Frame.hpp + Purpose: + + Revision History: + + 31/01/24: Added file (amlel) + +------------------------------------------- */ + +#pragma once + +#include +#include +#include + +namespace HCore { +class G_API GFrame { + public: + explicit GFrame(GFrame* parent = nullptr) : m_ParentFrame(parent) {} + ~GFrame() {} + + GFrame& operator=(const GFrame&) = default; + GFrame(const GFrame&) = default; + + virtual void Update() { + if (m_Frames.Count() == 0) return; + + for (int x = 0; x < m_Frames.Count(); ++x) { + if (!m_Frames[x]->ShouldBeUpdated()) continue; + + m_Frames[x]->Update(); + } + + this->Paint(); + } + + virtual void UpdateInput() { + if (m_Frames.Count() == 0) return; + + for (int x = 0; x < m_Frames.Count(); ++x) { + if (!m_Frames[x]->ShouldBeUpdated()) continue; + + m_Frames[x]->UpdateInput(); + } + } + + virtual bool ShouldBeUpdated() { return false; } + + virtual void Paint() = 0; + + private: + HCore::MutableArray m_Frames; + GFrame* m_ParentFrame{nullptr}; +}; +} // namespace HCore diff --git a/Public/Kits/GKit/GFrame.cxx b/Public/Kits/GKit/GFrame.cxx deleted file mode 100644 index 427c95ba..00000000 --- a/Public/Kits/GKit/GFrame.cxx +++ /dev/null @@ -1,16 +0,0 @@ -/* ------------------------------------------- - - Copyright Mahrouss Logic - - File: GFrame.cpp - Purpose: - - Revision History: - - 31/01/24: Added file (amlel) - -------------------------------------------- */ - -#include - -namespace HCore {} diff --git a/Public/Kits/GKit/GFrame.hpp b/Public/Kits/GKit/GFrame.hpp deleted file mode 100644 index f70f8f8e..00000000 --- a/Public/Kits/GKit/GFrame.hpp +++ /dev/null @@ -1,59 +0,0 @@ -/* ------------------------------------------- - - Copyright Mahrouss Logic - - File: GFrame.hpp - Purpose: - - Revision History: - - 31/01/24: Added file (amlel) - -------------------------------------------- */ - -#pragma once - -#include -#include -#include - -namespace HCore { -class GFrame { - public: - explicit GFrame(GFrame* parent = nullptr) : m_ParentFrame(parent) {} - ~GFrame() {} - - GFrame& operator=(const GFrame&) = default; - GFrame(const GFrame&) = default; - - virtual void Update() { - if (m_Frames.Count() == 0) return; - - for (int x = 0; x < m_Frames.Count(); ++x) { - if (!m_Frames[x]->ShouldBeUpdated()) continue; - - m_Frames[x]->Update(); - } - - this->Paint(); - } - - virtual void UpdateInput() { - if (m_Frames.Count() == 0) return; - - for (int x = 0; x < m_Frames.Count(); ++x) { - if (!m_Frames[x]->ShouldBeUpdated()) continue; - - m_Frames[x]->UpdateInput(); - } - } - - virtual bool ShouldBeUpdated() { return false; } - - virtual void Paint() = 0; - - private: - HCore::MutableArray m_Frames; - GFrame* m_ParentFrame{nullptr}; -}; -} // namespace HCore diff --git a/Public/Kits/GKit/Stylesheet.hxx b/Public/Kits/GKit/Stylesheet.hxx index bd764fcb..a34dd435 100644 --- a/Public/Kits/GKit/Stylesheet.hxx +++ b/Public/Kits/GKit/Stylesheet.hxx @@ -14,3 +14,38 @@ #pragma once /// TODO: Stylesheets for GUI. + +#include +#include +#include + +#include "NewKit/String.hpp" + +namespace HCore { +class G_API Stylesheet final { + public: + explicit Stylesheet() = default; + ~Stylesheet() = default; + + HCORE_COPY_DEFAULT(Stylesheet); + + MutableArray& Props() { return mProps; } + + private: + MutableArray mProps; +}; + +class StylesheetParser final { + public: + static MutableArray FromBlob(WideChar* Blob, SizeT BlobSz) { + MutableArray stylesheet; + + if (!Blob || BlobSz < 1) return stylesheet; + + for (auto BlobIndex = 0UL; BlobIndex < BlobSz; ++BlobIndex) { + } + + return stylesheet; + } +}; +} // namespace HCore -- cgit v1.2.3