1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 02:07:36 +00:00

AK+Kernel: Implement UUID mixed endianness support

This is being used by GUID partitions so the first three dash-delimited
fields of the GUID are stored in little endian order but the last two
fields are stored in big endian order, hence it's a representation which
is mixed.
This commit is contained in:
Liav A 2022-01-28 20:21:40 +02:00 committed by Idan Horowitz
parent 2d67d141e6
commit 308e54bc19
3 changed files with 47 additions and 6 deletions

View file

@ -15,9 +15,14 @@ namespace AK {
class UUID {
public:
enum class Endianness {
Mixed,
Little
};
UUID() = default;
UUID(Array<u8, 16> uuid_buffer);
UUID(StringView);
UUID(StringView, Endianness endianness = Endianness::Little);
~UUID() = default;
bool operator==(const UUID&) const;
@ -31,7 +36,8 @@ public:
bool is_zero() const;
private:
void convert_string_view_to_uuid(StringView);
void convert_string_view_to_little_endian_uuid(StringView);
void convert_string_view_to_mixed_endian_uuid(StringView);
Array<u8, 16> m_uuid_buffer {};
};