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

AK+Everywhere: Rename String to DeprecatedString

We have a new, improved string type coming up in AK (OOM aware, no null
state), and while it's going to use UTF-8, the name UTF8String is a
mouthful - so let's free up the String name by renaming the existing
class.
Making the old one have an annoying name will hopefully also help with
quick adoption :^)
This commit is contained in:
Linus Groh 2022-12-04 18:02:33 +00:00 committed by Andreas Kling
parent f74251606d
commit 6e19ab2bbc
2006 changed files with 11635 additions and 11636 deletions

View file

@ -7,7 +7,7 @@
#pragma once
#include <AK/String.h>
#include <AK/DeprecatedString.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.
@ -19,10 +19,10 @@ namespace AK {
class LexicalPath {
public:
explicit LexicalPath(String);
explicit LexicalPath(DeprecatedString);
bool is_absolute() const { return !m_string.is_empty() && m_string[0] == '/'; }
String const& string() const { return m_string; }
DeprecatedString const& string() const { return m_string; }
StringView dirname() const { return m_dirname; }
StringView basename() const { return m_basename; }
@ -30,7 +30,7 @@ public:
StringView extension() const { return m_extension; }
Vector<StringView> const& parts_view() const { return m_parts; }
[[nodiscard]] Vector<String> parts() const;
[[nodiscard]] Vector<DeprecatedString> parts() const;
bool has_extension(StringView) const;
@ -38,9 +38,9 @@ public:
[[nodiscard]] LexicalPath prepend(StringView) const;
[[nodiscard]] LexicalPath parent() const;
[[nodiscard]] static String canonicalized_path(String);
[[nodiscard]] static String absolute_path(String dir_path, String target);
[[nodiscard]] static String relative_path(StringView absolute_path, StringView prefix);
[[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);
template<typename... S>
[[nodiscard]] static LexicalPath join(StringView first, S&&... rest)
@ -52,25 +52,25 @@ public:
return LexicalPath { builder.to_string() };
}
[[nodiscard]] static String dirname(String path)
[[nodiscard]] static DeprecatedString dirname(DeprecatedString path)
{
auto lexical_path = LexicalPath(move(path));
return lexical_path.dirname();
}
[[nodiscard]] static String basename(String path)
[[nodiscard]] static DeprecatedString basename(DeprecatedString path)
{
auto lexical_path = LexicalPath(move(path));
return lexical_path.basename();
}
[[nodiscard]] static String title(String path)
[[nodiscard]] static DeprecatedString title(DeprecatedString path)
{
auto lexical_path = LexicalPath(move(path));
return lexical_path.title();
}
[[nodiscard]] static String extension(String path)
[[nodiscard]] static DeprecatedString extension(DeprecatedString path)
{
auto lexical_path = LexicalPath(move(path));
return lexical_path.extension();
@ -78,7 +78,7 @@ public:
private:
Vector<StringView> m_parts;
String m_string;
DeprecatedString m_string;
StringView m_dirname;
StringView m_basename;
StringView m_title;