mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 03:14:59 +00:00
AK: Stop using DeprecatedString
in UUID
This commit is contained in:
parent
f050a426f5
commit
99c1b634fc
2 changed files with 14 additions and 13 deletions
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());
|
||||
}
|
||||
#else
|
||||
DeprecatedString UUID::to_deprecated_string() const
|
||||
ErrorOr<String> UUID::to_string() const
|
||||
{
|
||||
auto buffer_span = m_uuid_buffer.span();
|
||||
StringBuilder builder(36);
|
||||
builder.append(encode_hex(m_uuid_buffer.span().trim(4)).view());
|
||||
builder.append('-');
|
||||
builder.append(encode_hex(m_uuid_buffer.span().slice(4).trim(2)).view());
|
||||
builder.append('-');
|
||||
builder.append(encode_hex(m_uuid_buffer.span().slice(6).trim(2)).view());
|
||||
builder.append('-');
|
||||
builder.append(encode_hex(m_uuid_buffer.span().slice(8).trim(2)).view());
|
||||
builder.append('-');
|
||||
builder.append(encode_hex(m_uuid_buffer.span().slice(10).trim(6)).view());
|
||||
return builder.to_deprecated_string();
|
||||
TRY(builder.try_append(encode_hex(buffer_span.trim(4)).view()));
|
||||
TRY(builder.try_append('-'));
|
||||
TRY(builder.try_append(encode_hex(buffer_span.slice(4, 2)).view()));
|
||||
TRY(builder.try_append('-'));
|
||||
TRY(builder.try_append(encode_hex(buffer_span.slice(6, 2)).view()));
|
||||
TRY(builder.try_append('-'));
|
||||
TRY(builder.try_append(encode_hex(buffer_span.slice(8, 2)).view()));
|
||||
TRY(builder.try_append('-'));
|
||||
TRY(builder.try_append(encode_hex(buffer_span.slice(10, 6)).view()));
|
||||
return builder.to_string();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
#ifdef KERNEL
|
||||
# include <Kernel/KString.h>
|
||||
#else
|
||||
# include <AK/DeprecatedString.h>
|
||||
# include <AK/String.h>
|
||||
#endif
|
||||
|
||||
namespace AK {
|
||||
|
@ -36,7 +36,7 @@ public:
|
|||
#ifdef KERNEL
|
||||
ErrorOr<NonnullOwnPtr<Kernel::KString>> to_string() const;
|
||||
#else
|
||||
DeprecatedString to_deprecated_string() const;
|
||||
ErrorOr<String> to_string() const;
|
||||
#endif
|
||||
bool is_zero() const;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue