mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-22 09:19:03 +00:00
AK: Stop using DeprecatedString in UUID
This commit is contained in:
committed by
Andreas Kling
parent
f050a426f5
commit
99c1b634fc
23
AK/UUID.cpp
23
AK/UUID.cpp
@@ -97,19 +97,20 @@ ErrorOr<NonnullOwnPtr<Kernel::KString>> UUID::to_string() const
|
|||||||
return Kernel::KString::try_create(builder.string_view());
|
return Kernel::KString::try_create(builder.string_view());
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
DeprecatedString UUID::to_deprecated_string() const
|
ErrorOr<String> UUID::to_string() const
|
||||||
{
|
{
|
||||||
|
auto buffer_span = m_uuid_buffer.span();
|
||||||
StringBuilder builder(36);
|
StringBuilder builder(36);
|
||||||
builder.append(encode_hex(m_uuid_buffer.span().trim(4)).view());
|
TRY(builder.try_append(encode_hex(buffer_span.trim(4)).view()));
|
||||||
builder.append('-');
|
TRY(builder.try_append('-'));
|
||||||
builder.append(encode_hex(m_uuid_buffer.span().slice(4).trim(2)).view());
|
TRY(builder.try_append(encode_hex(buffer_span.slice(4, 2)).view()));
|
||||||
builder.append('-');
|
TRY(builder.try_append('-'));
|
||||||
builder.append(encode_hex(m_uuid_buffer.span().slice(6).trim(2)).view());
|
TRY(builder.try_append(encode_hex(buffer_span.slice(6, 2)).view()));
|
||||||
builder.append('-');
|
TRY(builder.try_append('-'));
|
||||||
builder.append(encode_hex(m_uuid_buffer.span().slice(8).trim(2)).view());
|
TRY(builder.try_append(encode_hex(buffer_span.slice(8, 2)).view()));
|
||||||
builder.append('-');
|
TRY(builder.try_append('-'));
|
||||||
builder.append(encode_hex(m_uuid_buffer.span().slice(10).trim(6)).view());
|
TRY(builder.try_append(encode_hex(buffer_span.slice(10, 6)).view()));
|
||||||
return builder.to_deprecated_string();
|
return builder.to_string();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
#ifdef KERNEL
|
#ifdef KERNEL
|
||||||
# include <Kernel/KString.h>
|
# include <Kernel/KString.h>
|
||||||
#else
|
#else
|
||||||
# include <AK/DeprecatedString.h>
|
# include <AK/String.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace AK {
|
namespace AK {
|
||||||
@@ -36,7 +36,7 @@ public:
|
|||||||
#ifdef KERNEL
|
#ifdef KERNEL
|
||||||
ErrorOr<NonnullOwnPtr<Kernel::KString>> to_string() const;
|
ErrorOr<NonnullOwnPtr<Kernel::KString>> to_string() const;
|
||||||
#else
|
#else
|
||||||
DeprecatedString to_deprecated_string() const;
|
ErrorOr<String> to_string() const;
|
||||||
#endif
|
#endif
|
||||||
bool is_zero() const;
|
bool is_zero() const;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user