diff options
| author | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-05-05 21:10:18 +0200 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-05-05 21:10:18 +0200 |
| commit | f95d8bf159d10b5a9521dcaa0bc37aa0e9dfc02b (patch) | |
| tree | bf8186f1a0521a64983bb0bca4f7b54883542195 /Private/CFKit | |
| parent | 5a903c1d8f80ca8d7bc5fbea0aea710ce0133f9d (diff) | |
MHR-23: Add run_format.sh, kernel patches.
Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'Private/CFKit')
| -rw-r--r-- | Private/CFKit/GUIDWizard.hpp | 9 | ||||
| -rw-r--r-- | Private/CFKit/GUIDWrapper.hpp | 73 | ||||
| -rw-r--r-- | Private/CFKit/Property.hpp | 59 | ||||
| -rw-r--r-- | Private/CFKit/URL.hpp | 37 |
4 files changed, 97 insertions, 81 deletions
diff --git a/Private/CFKit/GUIDWizard.hpp b/Private/CFKit/GUIDWizard.hpp index f7cc212e..5790be84 100644 --- a/Private/CFKit/GUIDWizard.hpp +++ b/Private/CFKit/GUIDWizard.hpp @@ -15,7 +15,8 @@ #include <NewKit/Stream.hpp> #include <NewKit/String.hpp> -namespace NewOS::XRN::Version1 { -Ref<GUIDSequence*> make_sequence(const ArrayList<UShort>& seq); -ErrorOr<Ref<NewOS::StringView>> try_guid_to_string(Ref<GUIDSequence*>& guid); -} // namespace NewOS::XRN::Version1 +namespace NewOS::XRN::Version1 +{ + Ref<GUIDSequence*> make_sequence(const ArrayList<UShort>& seq); + ErrorOr<Ref<NewOS::StringView>> try_guid_to_string(Ref<GUIDSequence*>& guid); +} // namespace NewOS::XRN::Version1 diff --git a/Private/CFKit/GUIDWrapper.hpp b/Private/CFKit/GUIDWrapper.hpp index 62bc6d73..fb570e4e 100644 --- a/Private/CFKit/GUIDWrapper.hpp +++ b/Private/CFKit/GUIDWrapper.hpp @@ -15,35 +15,44 @@ #define kXRNNil "@{........-....-M...-N...-............}" // eXtensible Resource Information -namespace NewOS::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 fMs1; - UShort fMs2; - UShort fMs3; - UChar fMs4[8]; - }; -}; - -class GUID final { - public: - explicit GUID() = default; - ~GUID() = default; - - public: - GUID &operator=(const GUID &) = default; - GUID(const GUID &) = default; - - public: - GUIDSequence &operator->() noexcept { return fUUID; } - GUIDSequence &Leak() noexcept { return fUUID; } - - private: - GUIDSequence fUUID; -}; -} // namespace NewOS::XRN +namespace NewOS::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 fMs1; + UShort fMs2; + UShort fMs3; + UChar fMs4[8]; + }; + }; + + class GUID final + { + public: + explicit GUID() = default; + ~GUID() = default; + + public: + GUID& operator=(const GUID&) = default; + GUID(const GUID&) = default; + + public: + GUIDSequence& operator->() noexcept + { + return fUUID; + } + GUIDSequence& Leak() noexcept + { + return fUUID; + } + + private: + GUIDSequence fUUID; + }; +} // namespace NewOS::XRN diff --git a/Private/CFKit/Property.hpp b/Private/CFKit/Property.hpp index 10c8ebf0..c0fcda90 100644 --- a/Private/CFKit/Property.hpp +++ b/Private/CFKit/Property.hpp @@ -12,30 +12,35 @@ #include <NewKit/Function.hpp> #include <NewKit/String.hpp> -namespace NewOS { -using PropertyId = Int; - -/// @brief Kernel property class. -class Property { - public: - explicit Property(const StringView &sw) : fName(sw) {} - - virtual ~Property() = default; - - public: - Property &operator=(const Property &) = default; - Property(const Property &) = default; - - bool StringEquals(StringView &name); - const PropertyId &GetPropertyById(); - - private: - Ref<StringView> fName; - PropertyId fAction; -}; - -template <SSizeT N> -using PropertyArray = Array<Property, N>; -} // namespace NewOS - -#endif // !_INC_PLIST_HPP__ +namespace NewOS +{ + using PropertyId = Int; + + /// @brief Kernel property class. + class Property + { + public: + explicit Property(const StringView& sw) + : fName(sw) + { + } + + virtual ~Property() = default; + + public: + Property& operator=(const Property&) = default; + Property(const Property&) = default; + + bool StringEquals(StringView& name); + const PropertyId& GetPropertyById(); + + private: + Ref<StringView> fName; + PropertyId fAction; + }; + + template <SSizeT N> + using PropertyArray = Array<Property, N>; +} // namespace NewOS + +#endif // !_INC_PLIST_HPP__ diff --git a/Private/CFKit/URL.hpp b/Private/CFKit/URL.hpp index 41693e0e..c9262133 100644 --- a/Private/CFKit/URL.hpp +++ b/Private/CFKit/URL.hpp @@ -10,23 +10,24 @@ #include <NewKit/Defines.hpp> #include <NewKit/String.hpp> -namespace NewOS { -class URL final { - public: - explicit URL(StringView &strUrl); - ~URL(); - - public: - Ref<ErrorOr<StringView>> Location() noexcept; - Ref<ErrorOr<StringView>> Protocol() noexcept; - - private: - Ref<StringView> fUrlView; -}; - -ErrorOr<StringView> url_extract_location(const char *url); -ErrorOr<StringView> url_extract_protocol(const char *url); -} // namespace NewOS - +namespace NewOS +{ + class URL final + { + public: + explicit URL(StringView& strUrl); + ~URL(); + + public: + Ref<ErrorOr<StringView>> Location() noexcept; + Ref<ErrorOr<StringView>> Protocol() noexcept; + + private: + Ref<StringView> fUrlView; + }; + + ErrorOr<StringView> url_extract_location(const char* url); + ErrorOr<StringView> url_extract_protocol(const char* url); +} // namespace NewOS #endif /* ifndef _INC_URL_HPP_ */ |
