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

Everywhere: Rename {Deprecated => Byte}String

This commit un-deprecates DeprecatedString, and repurposes it as a byte
string.
As the null state has already been removed, there are no other
particularly hairy blockers in repurposing this type as a byte string
(what it _really_ is).

This commit is auto-generated:
  $ xs=$(ack -l \bDeprecatedString\b\|deprecated_string AK Userland \
    Meta Ports Ladybird Tests Kernel)
  $ perl -pie 's/\bDeprecatedString\b/ByteString/g;
    s/deprecated_string/byte_string/g' $xs
  $ clang-format --style=file -i \
    $(git diff --name-only | grep \.cpp\|\.h)
  $ gn format $(git ls-files '*.gn' '*.gni')
This commit is contained in:
Ali Mohammad Pur 2023-12-16 17:49:34 +03:30 committed by Ali Mohammad Pur
parent 38d62563b3
commit 5e1499d104
1615 changed files with 10257 additions and 10257 deletions

View file

@ -7,7 +7,7 @@
#pragma once
#include <AK/DeprecatedString.h>
#include <AK/ByteString.h>
#include <AK/Vector.h>
// On Linux distros that use mlibc `basename` is defined as a macro that expands to `__mlibc_gnu_basename` or `__mlibc_gnu_basename_c`, so we undefine it.
@ -24,10 +24,10 @@ public:
Yes
};
explicit LexicalPath(DeprecatedString);
explicit LexicalPath(ByteString);
bool is_absolute() const { return !m_string.is_empty() && m_string[0] == '/'; }
DeprecatedString const& string() const { return m_string; }
ByteString const& string() const { return m_string; }
StringView dirname() const { return m_dirname; }
StringView basename(StripExtension s = StripExtension::No) const { return s == StripExtension::No ? m_basename : m_basename.substring_view(0, m_basename.length() - m_extension.length() - 1); }
@ -35,7 +35,7 @@ public:
StringView extension() const { return m_extension; }
Vector<StringView> const& parts_view() const { return m_parts; }
[[nodiscard]] Vector<DeprecatedString> parts() const;
[[nodiscard]] Vector<ByteString> parts() const;
bool has_extension(StringView) const;
bool is_child_of(LexicalPath const& possible_parent) const;
@ -44,9 +44,9 @@ public:
[[nodiscard]] LexicalPath prepend(StringView) const;
[[nodiscard]] LexicalPath parent() const;
[[nodiscard]] static DeprecatedString canonicalized_path(DeprecatedString);
[[nodiscard]] static DeprecatedString absolute_path(DeprecatedString dir_path, DeprecatedString target);
[[nodiscard]] static DeprecatedString relative_path(StringView absolute_path, StringView prefix);
[[nodiscard]] static ByteString canonicalized_path(ByteString);
[[nodiscard]] static ByteString absolute_path(ByteString dir_path, ByteString target);
[[nodiscard]] static ByteString relative_path(StringView absolute_path, StringView prefix);
template<typename... S>
[[nodiscard]] static LexicalPath join(StringView first, S&&... rest)
@ -55,28 +55,28 @@ public:
builder.append(first);
((builder.append('/'), builder.append(forward<S>(rest))), ...);
return LexicalPath { builder.to_deprecated_string() };
return LexicalPath { builder.to_byte_string() };
}
[[nodiscard]] static DeprecatedString dirname(DeprecatedString path)
[[nodiscard]] static ByteString dirname(ByteString path)
{
auto lexical_path = LexicalPath(move(path));
return lexical_path.dirname();
}
[[nodiscard]] static DeprecatedString basename(DeprecatedString path, StripExtension s = StripExtension::No)
[[nodiscard]] static ByteString basename(ByteString path, StripExtension s = StripExtension::No)
{
auto lexical_path = LexicalPath(move(path));
return lexical_path.basename(s);
}
[[nodiscard]] static DeprecatedString title(DeprecatedString path)
[[nodiscard]] static ByteString title(ByteString path)
{
auto lexical_path = LexicalPath(move(path));
return lexical_path.title();
}
[[nodiscard]] static DeprecatedString extension(DeprecatedString path)
[[nodiscard]] static ByteString extension(ByteString path)
{
auto lexical_path = LexicalPath(move(path));
return lexical_path.extension();
@ -84,7 +84,7 @@ public:
private:
Vector<StringView> m_parts;
DeprecatedString m_string;
ByteString m_string;
StringView m_dirname;
StringView m_basename;
StringView m_title;