diff options
| author | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-01-26 22:26:48 +0100 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-01-26 22:27:09 +0100 |
| commit | eba8b7ddd0a455d9e49f32dcae712c5612c0093c (patch) | |
| tree | 749a3d34546d055507a920bce4ab10e8a9945719 /Private/CFKit | |
| parent | dd192787a70a973f2474720aea49af3f6ddabb7a (diff) | |
Kernel: Major repository refactor.
Rework the repo into Private and Public modules.
Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'Private/CFKit')
| -rw-r--r-- | Private/CFKit/GUIDWizard.hpp | 25 | ||||
| -rw-r--r-- | Private/CFKit/GUIDWrapper.hpp | 59 | ||||
| -rw-r--r-- | Private/CFKit/Property.hpp | 46 | ||||
| -rw-r--r-- | Private/CFKit/URL.hpp | 35 | ||||
| -rw-r--r-- | Private/CFKit/compile_flags.txt | 5 |
5 files changed, 170 insertions, 0 deletions
diff --git a/Private/CFKit/GUIDWizard.hpp b/Private/CFKit/GUIDWizard.hpp new file mode 100644 index 00000000..d5c6126b --- /dev/null +++ b/Private/CFKit/GUIDWizard.hpp @@ -0,0 +1,25 @@ +/* + * ======================================================== + * + * hCore + * Copyright 2024 Mahrouss Logic, all rights reserved. + * + * ======================================================== + */ + +#pragma once + +#include <CFKit/GUIDWrapper.hpp> +#include <NewKit/Array.hpp> +#include <NewKit/ArrayList.hpp> +#include <NewKit/ErrorOr.hpp> +#include <NewKit/Defines.hpp> +#include <NewKit/Ref.hpp> +#include <NewKit/Stream.hpp> +#include <NewKit/String.hpp> + +namespace hCore::XRN::Version1 +{ + Ref<GUIDSequence*> make_sequence(const ArrayList<UShort>& seq); + ErrorOr<Ref<hCore::StringView>> try_guid_to_string(Ref<GUIDSequence*>& guid); +} // namespace hCore::XRN::Version1 diff --git a/Private/CFKit/GUIDWrapper.hpp b/Private/CFKit/GUIDWrapper.hpp new file mode 100644 index 00000000..f332e119 --- /dev/null +++ b/Private/CFKit/GUIDWrapper.hpp @@ -0,0 +1,59 @@ +/* + * ======================================================== + * + * hCore + * Copyright 2024 Mahrouss Logic, all rights reserved. + * + * ======================================================== + */ + +#pragma once + +#include <NewKit/Defines.hpp> +#include <NewKit/Ref.hpp> +#include <NewKit/Stream.hpp> + +/* GUID for C++ Components */ + +#define NULL_GUID "XRN:{........-....-M...-N...-............}" + +// eXtensible Resource Information +namespace hCore::XRN +{ + union GUIDSequence + { + alignas(8) UShort u8[16]; + alignas(8) UShort u16[8]; + alignas(8) UInt u32[4]; + alignas(8) ULong u64[2]; + + struct + { + alignas(8) UInt m_Ms1; + UShort m_Ms2; + UShort m_Ms3; + UChar m_Ms4[8]; + }; + }; + + class GUID final + { + public: + explicit GUID() = default; + ~GUID() = default; + + public: + GUID &operator=(const GUID &) = default; + GUID(const GUID &) = default; + + public: + GUIDSequence &operator->() + { + return m_UUID; + } + + private: + GUIDSequence m_UUID; + + }; +} // namespace hCore::XRN diff --git a/Private/CFKit/Property.hpp b/Private/CFKit/Property.hpp new file mode 100644 index 00000000..29ff49d4 --- /dev/null +++ b/Private/CFKit/Property.hpp @@ -0,0 +1,46 @@ +/* + * ======================================================== + * + * hCore + * Copyright 2024 Mahrouss Logic, all rights reserved. + * + * ======================================================== + */ + +#ifndef _INC_PLIST_HPP__ +#define _INC_PLIST_HPP__ + +#include <NewKit/Array.hpp> +#include <NewKit/Defines.hpp> +#include <NewKit/Function.hpp> +#include <NewKit/String.hpp> + +namespace hCore +{ + using PropertyId = Int; + + class Property + { + public: + explicit Property(const StringView &sw) + : m_sName(sw) {} + + virtual ~Property() = default; + + public: + Property &operator=(const Property &) = default; + Property(const Property &) = default; + + bool StringEquals(StringView &name); + const PropertyId &GetPropertyById(); + + private: + Ref<StringView> m_sName; + PropertyId m_Action; + + }; + + template<SSizeT N> using PropertyArray = Array<Property, N>; +} // namespace hCore + +#endif // !_INC_PLIST_HPP__ diff --git a/Private/CFKit/URL.hpp b/Private/CFKit/URL.hpp new file mode 100644 index 00000000..88b91c68 --- /dev/null +++ b/Private/CFKit/URL.hpp @@ -0,0 +1,35 @@ +/* + * ======================================================== + * + * hCore + * Copyright 2024 Mahrouss Logic, all rights reserved. + * + * ======================================================== + */ + +#ifndef _INC_URL_HPP__ +#define _INC_URL_HPP__ + +#include <NewKit/Defines.hpp> +#include <NewKit/String.hpp> + +namespace hCore +{ + class Url final + { + public: + explicit Url(StringView &strUrl); + ~Url(); + + public: + Ref<ErrorOr<StringView>> Location() noexcept; + Ref<ErrorOr<StringView>> Protocol() noexcept; + + private: + Ref<StringView> m_urlView; + + }; + +} // namespace hCore + +#endif /* ifndef _INC_URL_HPP__ */
\ No newline at end of file diff --git a/Private/CFKit/compile_flags.txt b/Private/CFKit/compile_flags.txt new file mode 100644 index 00000000..a37ae6bf --- /dev/null +++ b/Private/CFKit/compile_flags.txt @@ -0,0 +1,5 @@ +-nostdlib +-ffreestanding +-std=c++20 +-I./ +-I../ |
