1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 06:27:45 +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

@ -6,8 +6,8 @@
*/
#include <AK/Bitmap.h>
#include <AK/ByteString.h>
#include <AK/Checked.h>
#include <AK/DeprecatedString.h>
#include <AK/LexicalPath.h>
#include <AK/Memory.h>
#include <AK/MemoryStream.h>
@ -145,7 +145,7 @@ ErrorOr<NonnullRefPtr<Bitmap>> Bitmap::load_from_file(NonnullOwnPtr<Core::File>
return load_from_bytes(mapped_file->bytes(), ideal_size, mime_type);
}
ErrorOr<NonnullRefPtr<Bitmap>> Bitmap::load_from_bytes(ReadonlyBytes bytes, Optional<IntSize> ideal_size, Optional<DeprecatedString> mine_type)
ErrorOr<NonnullRefPtr<Bitmap>> Bitmap::load_from_bytes(ReadonlyBytes bytes, Optional<IntSize> ideal_size, Optional<ByteString> mine_type)
{
if (auto decoder = ImageDecoder::try_create_for_raw_bytes(bytes, mine_type)) {
auto frame = TRY(decoder->frame(0, ideal_size));
@ -552,7 +552,7 @@ void Bitmap::strip_alpha_channel()
m_format = BitmapFormat::BGRx8888;
}
void Bitmap::set_mmap_name([[maybe_unused]] DeprecatedString const& name)
void Bitmap::set_mmap_name([[maybe_unused]] ByteString const& name)
{
VERIFY(m_needs_munmap);
#ifdef AK_OS_SERENITY
@ -624,7 +624,7 @@ ErrorOr<BackingStore> Bitmap::allocate_backing_store(BitmapFormat format, IntSiz
int map_flags = MAP_ANONYMOUS | MAP_PRIVATE;
#ifdef AK_OS_SERENITY
map_flags |= MAP_PURGEABLE;
void* data = mmap_with_name(nullptr, data_size_in_bytes, PROT_READ | PROT_WRITE, map_flags, 0, 0, DeprecatedString::formatted("GraphicsBitmap [{}]", size).characters());
void* data = mmap_with_name(nullptr, data_size_in_bytes, PROT_READ | PROT_WRITE, map_flags, 0, 0, ByteString::formatted("GraphicsBitmap [{}]", size).characters());
#else
void* data = mmap(nullptr, data_size_in_bytes, PROT_READ | PROT_WRITE, map_flags, -1, 0);
#endif

View file

@ -95,7 +95,7 @@ public:
[[nodiscard]] static ErrorOr<NonnullRefPtr<Bitmap>> create_wrapper(BitmapFormat, IntSize, int intrinsic_scale, size_t pitch, void*);
[[nodiscard]] static ErrorOr<NonnullRefPtr<Bitmap>> load_from_file(StringView path, int scale_factor = 1, Optional<IntSize> ideal_size = {});
[[nodiscard]] static ErrorOr<NonnullRefPtr<Bitmap>> load_from_file(NonnullOwnPtr<Core::File>, StringView path, Optional<IntSize> ideal_size = {});
[[nodiscard]] static ErrorOr<NonnullRefPtr<Bitmap>> load_from_bytes(ReadonlyBytes, Optional<IntSize> ideal_size = {}, Optional<DeprecatedString> mine_type = {});
[[nodiscard]] static ErrorOr<NonnullRefPtr<Bitmap>> load_from_bytes(ReadonlyBytes, Optional<IntSize> ideal_size = {}, Optional<ByteString> mine_type = {});
[[nodiscard]] static ErrorOr<NonnullRefPtr<Bitmap>> create_with_anonymous_buffer(BitmapFormat, Core::AnonymousBuffer, IntSize, int intrinsic_scale);
static ErrorOr<NonnullRefPtr<Bitmap>> create_from_serialized_bytes(ReadonlyBytes);
static ErrorOr<NonnullRefPtr<Bitmap>> create_from_serialized_byte_buffer(ByteBuffer&&);
@ -197,7 +197,7 @@ public:
// Call only for BGRx8888 and BGRA8888 bitmaps.
void strip_alpha_channel();
void set_mmap_name(DeprecatedString const&);
void set_mmap_name(ByteString const&);
[[nodiscard]] static constexpr size_t size_in_bytes(size_t pitch, int physical_height) { return pitch * physical_height; }
[[nodiscard]] size_t size_in_bytes() const { return size_in_bytes(m_pitch, physical_height()); }

View file

@ -6,7 +6,7 @@
*/
#include <AK/Assertions.h>
#include <AK/DeprecatedString.h>
#include <AK/ByteString.h>
#include <AK/FloatingPointStringConversions.h>
#include <AK/Optional.h>
#include <AK/Vector.h>
@ -28,14 +28,14 @@ String Color::to_string_without_alpha() const
return MUST(String::formatted("#{:02x}{:02x}{:02x}", red(), green(), blue()));
}
DeprecatedString Color::to_deprecated_string() const
ByteString Color::to_byte_string() const
{
return to_string().to_deprecated_string();
return to_string().to_byte_string();
}
DeprecatedString Color::to_deprecated_string_without_alpha() const
ByteString Color::to_byte_string_without_alpha() const
{
return to_string_without_alpha().to_deprecated_string();
return to_string_without_alpha().to_byte_string();
}
static Optional<Color> parse_rgb_color(StringView string)
@ -373,5 +373,5 @@ ErrorOr<Gfx::Color> IPC::decode(Decoder& decoder)
ErrorOr<void> AK::Formatter<Gfx::Color>::format(FormatBuilder& builder, Gfx::Color value)
{
return Formatter<StringView>::format(builder, value.to_deprecated_string());
return Formatter<StringView>::format(builder, value.to_byte_string());
}

View file

@ -359,8 +359,8 @@ public:
String to_string() const;
String to_string_without_alpha() const;
DeprecatedString to_deprecated_string() const;
DeprecatedString to_deprecated_string_without_alpha() const;
ByteString to_byte_string() const;
ByteString to_byte_string_without_alpha() const;
static Optional<Color> from_string(StringView);
static Optional<Color> from_named_css_color_string(StringView);

View file

@ -248,7 +248,7 @@ ErrorOr<NonnullRefPtr<BitmapFont>> BitmapFont::try_load_from_uri(StringView uri)
return try_load_from_resource(TRY(Core::Resource::load_from_uri(uri)));
}
ErrorOr<void> BitmapFont::write_to_file(DeprecatedString const& path)
ErrorOr<void> BitmapFont::write_to_file(ByteString const& path)
{
auto stream = TRY(Core::File::open(path, Core::File::OpenMode::Write));
TRY(write_to_file(move(stream)));

View file

@ -6,8 +6,8 @@
#pragma once
#include <AK/ByteString.h>
#include <AK/CharacterTypes.h>
#include <AK/DeprecatedString.h>
#include <AK/RefCounted.h>
#include <AK/RefPtr.h>
#include <AK/Types.h>
@ -36,7 +36,7 @@ public:
static ErrorOr<NonnullRefPtr<BitmapFont>> try_load_from_mapped_file(NonnullOwnPtr<Core::MappedFile>);
static ErrorOr<NonnullRefPtr<BitmapFont>> try_load_from_stream(FixedMemoryStream&);
ErrorOr<void> write_to_file(DeprecatedString const& path);
ErrorOr<void> write_to_file(ByteString const& path);
ErrorOr<void> write_to_file(NonnullOwnPtr<Core::File> file);
~BitmapFont();

View file

@ -26,15 +26,15 @@ FontDatabase& FontDatabase::the()
}
static RefPtr<Font> s_default_font;
static DeprecatedString s_default_font_query;
static ByteString s_default_font_query;
static RefPtr<Font> s_window_title_font;
static DeprecatedString s_window_title_font_query;
static ByteString s_window_title_font_query;
static RefPtr<Font> s_fixed_width_font;
static DeprecatedString s_fixed_width_font_query;
static ByteString s_fixed_width_font_query;
void FontDatabase::set_default_font_query(DeprecatedString query)
void FontDatabase::set_default_font_query(ByteString query)
{
if (s_default_font_query == query)
return;
@ -42,12 +42,12 @@ void FontDatabase::set_default_font_query(DeprecatedString query)
s_default_font = nullptr;
}
DeprecatedString FontDatabase::default_font_query()
ByteString FontDatabase::default_font_query()
{
return s_default_font_query;
}
void FontDatabase::set_window_title_font_query(DeprecatedString query)
void FontDatabase::set_window_title_font_query(ByteString query)
{
if (s_window_title_font_query == query)
return;
@ -55,7 +55,7 @@ void FontDatabase::set_window_title_font_query(DeprecatedString query)
s_window_title_font = nullptr;
}
DeprecatedString FontDatabase::window_title_font_query()
ByteString FontDatabase::window_title_font_query()
{
return s_window_title_font_query;
}
@ -80,7 +80,7 @@ Font& FontDatabase::window_title_font()
return *s_window_title_font;
}
void FontDatabase::set_fixed_width_font_query(DeprecatedString query)
void FontDatabase::set_fixed_width_font_query(ByteString query)
{
if (s_fixed_width_font_query == query)
return;
@ -88,7 +88,7 @@ void FontDatabase::set_fixed_width_font_query(DeprecatedString query)
s_fixed_width_font = nullptr;
}
DeprecatedString FontDatabase::fixed_width_font_query()
ByteString FontDatabase::fixed_width_font_query()
{
return s_fixed_width_font_query;
}
@ -104,7 +104,7 @@ Font& FontDatabase::default_fixed_width_font()
}
struct FontDatabase::Private {
HashMap<DeprecatedString, NonnullRefPtr<Gfx::Font>, CaseInsensitiveStringTraits> full_name_to_font_map;
HashMap<ByteString, NonnullRefPtr<Gfx::Font>, CaseInsensitiveStringTraits> full_name_to_font_map;
HashMap<FlyString, Vector<NonnullRefPtr<Typeface>>, AK::ASCIICaseInsensitiveFlyStringTraits> typefaces;
};
@ -122,7 +122,7 @@ void FontDatabase::load_all_fonts_from_uri(StringView uri)
if (path.has_extension(".font"sv)) {
if (auto font_or_error = Gfx::BitmapFont::try_load_from_resource(resource); !font_or_error.is_error()) {
auto font = font_or_error.release_value();
m_private->full_name_to_font_map.set(font->qualified_name().to_deprecated_string(), *font);
m_private->full_name_to_font_map.set(font->qualified_name().to_byte_string(), *font);
auto typeface = get_or_create_typeface(font->family(), font->variant());
typeface->add_bitmap_font(font);
}

View file

@ -6,7 +6,7 @@
#pragma once
#include <AK/DeprecatedString.h>
#include <AK/ByteString.h>
#include <AK/FlyString.h>
#include <AK/Function.h>
#include <AK/HashMap.h>
@ -39,14 +39,14 @@ public:
static Font& default_fixed_width_font();
static Font& window_title_font();
static DeprecatedString default_font_query();
static DeprecatedString window_title_font_query();
static DeprecatedString fixed_width_font_query();
static ByteString default_font_query();
static ByteString window_title_font_query();
static ByteString fixed_width_font_query();
static DeprecatedString default_fonts_lookup_path();
static void set_default_font_query(DeprecatedString);
static void set_window_title_font_query(DeprecatedString);
static void set_fixed_width_font_query(DeprecatedString);
static ByteString default_fonts_lookup_path();
static void set_default_font_query(ByteString);
static void set_window_title_font_query(ByteString);
static void set_fixed_width_font_query(ByteString);
RefPtr<Gfx::Font> get(FlyString const& family, float point_size, unsigned weight, unsigned width, unsigned slope, Font::AllowInexactSizeMatch = Font::AllowInexactSizeMatch::No);
RefPtr<Gfx::Font> get(FlyString const& family, FlyString const& variant, float point_size, Font::AllowInexactSizeMatch = Font::AllowInexactSizeMatch::No);

View file

@ -9,7 +9,7 @@
#pragma once
#include <AK/DeprecatedString.h>
#include <AK/ByteString.h>
#include <AK/Endian.h>
#include <AK/Error.h>
#include <AK/FixedArray.h>

View file

@ -7,7 +7,7 @@
#pragma once
#include <AK/DeprecatedString.h>
#include <AK/ByteString.h>
#include <AK/Noncopyable.h>
#include <AK/OwnPtr.h>
#include <AK/RefCounted.h>

View file

@ -335,13 +335,13 @@ ErrorOr<void> parse_reserved(ICCHeader const& header)
URL device_manufacturer_url(DeviceManufacturer device_manufacturer)
{
return URL(DeprecatedString::formatted("https://www.color.org/signatureRegistry/?entityEntry={:c}{:c}{:c}{:c}-{:08X}",
return URL(ByteString::formatted("https://www.color.org/signatureRegistry/?entityEntry={:c}{:c}{:c}{:c}-{:08X}",
device_manufacturer.c0(), device_manufacturer.c1(), device_manufacturer.c2(), device_manufacturer.c3(), device_manufacturer.value));
}
URL device_model_url(DeviceModel device_model)
{
return URL(DeprecatedString::formatted("https://www.color.org/signatureRegistry/deviceRegistry/?entityEntry={:c}{:c}{:c}{:c}-{:08X}",
return URL(ByteString::formatted("https://www.color.org/signatureRegistry/deviceRegistry/?entityEntry={:c}{:c}{:c}{:c}-{:08X}",
device_model.c0(), device_model.c1(), device_model.c2(), device_model.c3(), device_model.value));
}

View file

@ -6,8 +6,8 @@
*/
#include <AK/BuiltinWrappers.h>
#include <AK/ByteString.h>
#include <AK/Debug.h>
#include <AK/DeprecatedString.h>
#include <AK/Error.h>
#include <AK/Function.h>
#include <AK/Try.h>
@ -82,7 +82,7 @@ template<typename T>
struct Formatter<Gfx::Endpoint<T>> : Formatter<StringView> {
ErrorOr<void> format(FormatBuilder& builder, Gfx::Endpoint<T> const& value)
{
return Formatter<StringView>::format(builder, DeprecatedString::formatted("({}, {}, {})", value.x, value.y, value.z));
return Formatter<StringView>::format(builder, ByteString::formatted("({}, {}, {})", value.x, value.y, value.z));
}
};

View file

@ -622,7 +622,7 @@ void DDSLoadingContext::dump_debug()
builder.append(" DDS_ALPHA_MODE_CUSTOM"sv);
builder.append("\n"sv);
dbgln("{}", builder.to_deprecated_string());
dbgln("{}", builder.to_byte_string());
}
DDSImageDecoderPlugin::DDSImageDecoderPlugin(FixedMemoryStream stream)

View file

@ -86,7 +86,7 @@ static OwnPtr<ImageDecoderPlugin> probe_and_sniff_for_appropriate_plugin_with_kn
return {};
}
RefPtr<ImageDecoder> ImageDecoder::try_create_for_raw_bytes(ReadonlyBytes bytes, Optional<DeprecatedString> mime_type)
RefPtr<ImageDecoder> ImageDecoder::try_create_for_raw_bytes(ReadonlyBytes bytes, Optional<ByteString> mime_type)
{
if (OwnPtr<ImageDecoderPlugin> plugin = probe_and_sniff_for_appropriate_plugin(bytes); plugin)
return adopt_ref_if_nonnull(new (nothrow) ImageDecoder(plugin.release_nonnull()));

View file

@ -62,7 +62,7 @@ protected:
class ImageDecoder : public RefCounted<ImageDecoder> {
public:
static RefPtr<ImageDecoder> try_create_for_raw_bytes(ReadonlyBytes, Optional<DeprecatedString> mime_type = {});
static RefPtr<ImageDecoder> try_create_for_raw_bytes(ReadonlyBytes, Optional<ByteString> mime_type = {});
~ImageDecoder() = default;
IntSize size() const { return m_plugin->size(); }

View file

@ -6,7 +6,7 @@
#pragma once
#include <AK/DeprecatedString.h>
#include <AK/ByteString.h>
#include <AK/Format.h>
#include <AK/Optional.h>
#include <LibGfx/Forward.h>
@ -166,7 +166,7 @@ public:
return Line<U>(*this);
}
DeprecatedString to_deprecated_string() const;
ByteString to_byte_string() const;
private:
Point<T> m_a;
@ -174,15 +174,15 @@ private:
};
template<>
inline DeprecatedString IntLine::to_deprecated_string() const
inline ByteString IntLine::to_byte_string() const
{
return DeprecatedString::formatted("[{},{} -> {},{}]", m_a.x(), m_a.y(), m_b.x(), m_b.y());
return ByteString::formatted("[{},{} -> {},{}]", m_a.x(), m_a.y(), m_b.x(), m_b.y());
}
template<>
inline DeprecatedString FloatLine::to_deprecated_string() const
inline ByteString FloatLine::to_byte_string() const
{
return DeprecatedString::formatted("[{},{} -> {},{}]", m_a.x(), m_a.y(), m_b.x(), m_b.y());
return ByteString::formatted("[{},{} -> {},{}]", m_a.x(), m_a.y(), m_b.x(), m_b.y());
}
}

View file

@ -2384,10 +2384,10 @@ void Painter::blit_tiled(IntRect const& dst_rect, Gfx::Bitmap const& bitmap, Int
}
}
DeprecatedString parse_ampersand_string(StringView raw_text, Optional<size_t>* underline_offset)
ByteString parse_ampersand_string(StringView raw_text, Optional<size_t>* underline_offset)
{
if (raw_text.is_empty())
return DeprecatedString::empty();
return ByteString::empty();
StringBuilder builder;
@ -2403,7 +2403,7 @@ DeprecatedString parse_ampersand_string(StringView raw_text, Optional<size_t>* u
}
builder.append(raw_text[i]);
}
return builder.to_deprecated_string();
return builder.to_byte_string();
}
void Gfx::Painter::draw_ui_text(Gfx::IntRect const& rect, StringView text, Gfx::Font const& font, Gfx::TextAlignment text_alignment, Gfx::Color color)

View file

@ -232,6 +232,6 @@ private:
Painter& m_painter;
};
DeprecatedString parse_ampersand_string(StringView, Optional<size_t>* underline_offset = nullptr);
ByteString parse_ampersand_string(StringView, Optional<size_t>* underline_offset = nullptr);
}

View file

@ -33,7 +33,7 @@ int PaletteImpl::metric(MetricRole role) const
return theme().metric[(int)role];
}
DeprecatedString PaletteImpl::path(PathRole role) const
ByteString PaletteImpl::path(PathRole role) const
{
VERIFY((int)role < (int)PathRole::__Count);
return theme().path[(int)role];
@ -78,7 +78,7 @@ void Palette::set_metric(MetricRole role, int value)
theme.metric[(int)role] = value;
}
void Palette::set_path(PathRole role, DeprecatedString path)
void Palette::set_path(PathRole role, ByteString path)
{
if (m_impl->ref_count() != 1)
m_impl = m_impl->clone();

View file

@ -45,7 +45,7 @@ public:
}
int metric(MetricRole) const;
DeprecatedString path(PathRole) const;
ByteString path(PathRole) const;
SystemTheme const& theme() const { return *m_theme_buffer.data<SystemTheme>(); }
void replace_internal_buffer(Badge<GUI::Application>, Core::AnonymousBuffer buffer);
@ -175,25 +175,25 @@ public:
int window_title_button_width() const { return metric(MetricRole::TitleButtonWidth); }
int window_title_button_height() const { return metric(MetricRole::TitleButtonHeight); }
DeprecatedString title_button_icons_path() const { return path(PathRole::TitleButtonIcons); }
DeprecatedString active_window_shadow_path() const { return path(PathRole::ActiveWindowShadow); }
DeprecatedString inactive_window_shadow_path() const { return path(PathRole::InactiveWindowShadow); }
DeprecatedString menu_shadow_path() const { return path(PathRole::MenuShadow); }
DeprecatedString taskbar_shadow_path() const { return path(PathRole::TaskbarShadow); }
DeprecatedString tooltip_shadow_path() const { return path(PathRole::TooltipShadow); }
DeprecatedString color_scheme_path() const { return path(PathRole::ColorScheme); }
ByteString title_button_icons_path() const { return path(PathRole::TitleButtonIcons); }
ByteString active_window_shadow_path() const { return path(PathRole::ActiveWindowShadow); }
ByteString inactive_window_shadow_path() const { return path(PathRole::InactiveWindowShadow); }
ByteString menu_shadow_path() const { return path(PathRole::MenuShadow); }
ByteString taskbar_shadow_path() const { return path(PathRole::TaskbarShadow); }
ByteString tooltip_shadow_path() const { return path(PathRole::TooltipShadow); }
ByteString color_scheme_path() const { return path(PathRole::ColorScheme); }
Color color(ColorRole role) const { return m_impl->color(role); }
Gfx::TextAlignment alignment(AlignmentRole role) const { return m_impl->alignment(role); }
bool flag(FlagRole role) const { return m_impl->flag(role); }
int metric(MetricRole role) const { return m_impl->metric(role); }
DeprecatedString path(PathRole role) const { return m_impl->path(role); }
ByteString path(PathRole role) const { return m_impl->path(role); }
void set_color(ColorRole, Color);
void set_alignment(AlignmentRole, Gfx::TextAlignment);
void set_flag(FlagRole, bool);
void set_metric(MetricRole, int);
void set_path(PathRole, DeprecatedString);
void set_path(PathRole, ByteString);
SystemTheme const& theme() const { return m_impl->theme(); }

View file

@ -262,7 +262,7 @@ void Path::close_all_subpaths()
close_previous_subpath();
}
DeprecatedString Path::to_deprecated_string() const
ByteString Path::to_byte_string() const
{
StringBuilder builder;
builder.append("Path { "sv);
@ -289,13 +289,13 @@ DeprecatedString Path::to_deprecated_string() const
switch (segment->type()) {
case Segment::Type::QuadraticBezierCurveTo:
builder.append(", "sv);
builder.append(static_cast<QuadraticBezierCurveSegment const&>(*segment).through().to_deprecated_string());
builder.append(static_cast<QuadraticBezierCurveSegment const&>(*segment).through().to_byte_string());
break;
case Segment::Type::CubicBezierCurveTo:
builder.append(", "sv);
builder.append(static_cast<CubicBezierCurveSegment const&>(*segment).through_0().to_deprecated_string());
builder.append(static_cast<CubicBezierCurveSegment const&>(*segment).through_0().to_byte_string());
builder.append(", "sv);
builder.append(static_cast<CubicBezierCurveSegment const&>(*segment).through_1().to_deprecated_string());
builder.append(static_cast<CubicBezierCurveSegment const&>(*segment).through_1().to_byte_string());
break;
default:
break;
@ -304,7 +304,7 @@ DeprecatedString Path::to_deprecated_string() const
builder.append(") "sv);
}
builder.append('}');
return builder.to_deprecated_string();
return builder.to_byte_string();
}
void Path::segmentize_path()

View file

@ -6,7 +6,7 @@
#pragma once
#include <AK/DeprecatedString.h>
#include <AK/ByteString.h>
#include <AK/HashMap.h>
#include <AK/Optional.h>
#include <AK/Vector.h>
@ -198,7 +198,7 @@ public:
Path copy_transformed(AffineTransform const&) const;
void add_path(Path const&);
void ensure_subpath(FloatPoint point);
DeprecatedString to_deprecated_string() const;
ByteString to_byte_string() const;
Path stroke_to_fill(float thickness) const;

View file

@ -4,7 +4,7 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <AK/DeprecatedString.h>
#include <AK/ByteString.h>
#include <LibGfx/Point.h>
#include <LibGfx/Rect.h>
#include <LibIPC/Decoder.h>
@ -36,15 +36,15 @@ template<typename T>
}
template<>
DeprecatedString IntPoint::to_deprecated_string() const
ByteString IntPoint::to_byte_string() const
{
return DeprecatedString::formatted("[{},{}]", x(), y());
return ByteString::formatted("[{},{}]", x(), y());
}
template<>
DeprecatedString FloatPoint::to_deprecated_string() const
ByteString FloatPoint::to_byte_string() const
{
return DeprecatedString::formatted("[{},{}]", x(), y());
return ByteString::formatted("[{},{}]", x(), y());
}
}

View file

@ -261,7 +261,7 @@ public:
return Point<U>(AK::floor(x()), AK::floor(y()));
}
[[nodiscard]] DeprecatedString to_deprecated_string() const;
[[nodiscard]] ByteString to_byte_string() const;
private:
T m_x { 0 };

View file

@ -4,7 +4,7 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <AK/DeprecatedString.h>
#include <AK/ByteString.h>
#include <AK/Vector.h>
#include <LibGfx/Line.h>
#include <LibGfx/Rect.h>
@ -14,15 +14,15 @@
namespace Gfx {
template<>
DeprecatedString IntRect::to_deprecated_string() const
ByteString IntRect::to_byte_string() const
{
return DeprecatedString::formatted("[{},{} {}x{}]", x(), y(), width(), height());
return ByteString::formatted("[{},{} {}x{}]", x(), y(), width(), height());
}
template<>
DeprecatedString FloatRect::to_deprecated_string() const
ByteString FloatRect::to_byte_string() const
{
return DeprecatedString::formatted("[{},{} {}x{}]", x(), y(), width(), height());
return ByteString::formatted("[{},{} {}x{}]", x(), y(), width(), height());
}
}

View file

@ -1029,7 +1029,7 @@ public:
};
}
[[nodiscard]] DeprecatedString to_deprecated_string() const;
[[nodiscard]] ByteString to_byte_string() const;
private:
Point<T> m_location;

View file

@ -4,7 +4,7 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <AK/DeprecatedString.h>
#include <AK/ByteString.h>
#include <LibGfx/Size.h>
#include <LibIPC/Decoder.h>
#include <LibIPC/Encoder.h>
@ -12,15 +12,15 @@
namespace Gfx {
template<>
DeprecatedString IntSize::to_deprecated_string() const
ByteString IntSize::to_byte_string() const
{
return DeprecatedString::formatted("[{}x{}]", m_width, m_height);
return ByteString::formatted("[{}x{}]", m_width, m_height);
}
template<>
DeprecatedString FloatSize::to_deprecated_string() const
ByteString FloatSize::to_byte_string() const
{
return DeprecatedString::formatted("[{}x{}]", m_width, m_height);
return ByteString::formatted("[{}x{}]", m_width, m_height);
}
}

View file

@ -181,7 +181,7 @@ public:
return Size<U>(*this);
}
[[nodiscard]] DeprecatedString to_deprecated_string() const;
[[nodiscard]] ByteString to_byte_string() const;
template<Integral I>
[[nodiscard]] Size<I> to_rounded() const

View file

@ -31,7 +31,7 @@ void set_system_theme(Core::AnonymousBuffer buffer)
theme_page = theme_buffer.data<SystemTheme>();
}
ErrorOr<Core::AnonymousBuffer> load_system_theme(Core::ConfigFile const& file, Optional<DeprecatedString> const& color_scheme)
ErrorOr<Core::AnonymousBuffer> load_system_theme(Core::ConfigFile const& file, Optional<ByteString> const& color_scheme)
{
auto buffer = TRY(Core::AnonymousBuffer::create_with_size(sizeof(SystemTheme)));
@ -191,7 +191,7 @@ ErrorOr<Core::AnonymousBuffer> load_system_theme(Core::ConfigFile const& file, O
return buffer;
}
ErrorOr<Core::AnonymousBuffer> load_system_theme(DeprecatedString const& path, Optional<DeprecatedString> const& color_scheme)
ErrorOr<Core::AnonymousBuffer> load_system_theme(ByteString const& path, Optional<ByteString> const& color_scheme)
{
auto config_file = TRY(Core::ConfigFile::open(path));
return TRY(load_system_theme(config_file, color_scheme));
@ -203,7 +203,7 @@ ErrorOr<Vector<SystemThemeMetaData>> list_installed_system_themes()
Core::DirIterator dt("/res/themes", Core::DirIterator::SkipDots);
while (dt.has_next()) {
auto theme_name = dt.next_path();
auto theme_path = DeprecatedString::formatted("/res/themes/{}", theme_name);
auto theme_path = ByteString::formatted("/res/themes/{}", theme_name);
TRY(system_themes.try_append({ LexicalPath::title(theme_name), theme_path }));
}
quick_sort(system_themes, [](auto& a, auto& b) { return a.name < b.name; });

View file

@ -8,7 +8,7 @@
#pragma once
#include <AK/DeprecatedString.h>
#include <AK/ByteString.h>
#include <AK/Forward.h>
#include <AK/Types.h>
#include <AK/Vector.h>
@ -291,12 +291,12 @@ struct SystemTheme {
Core::AnonymousBuffer& current_system_theme_buffer();
void set_system_theme(Core::AnonymousBuffer);
ErrorOr<Core::AnonymousBuffer> load_system_theme(Core::ConfigFile const&, Optional<DeprecatedString> const& color_scheme = OptionalNone());
ErrorOr<Core::AnonymousBuffer> load_system_theme(DeprecatedString const& path, Optional<DeprecatedString> const& color_scheme = OptionalNone());
ErrorOr<Core::AnonymousBuffer> load_system_theme(Core::ConfigFile const&, Optional<ByteString> const& color_scheme = OptionalNone());
ErrorOr<Core::AnonymousBuffer> load_system_theme(ByteString const& path, Optional<ByteString> const& color_scheme = OptionalNone());
struct SystemThemeMetaData {
DeprecatedString name;
DeprecatedString path;
ByteString name;
ByteString path;
};
ErrorOr<Vector<SystemThemeMetaData>> list_installed_system_themes();

View file

@ -44,7 +44,7 @@ FloatRect TextLayout::bounding_rect(TextWrapping wrapping) const
return bounding_rect;
}
Vector<DeprecatedString, 32> TextLayout::wrap_lines(TextElision elision, TextWrapping wrapping) const
Vector<ByteString, 32> TextLayout::wrap_lines(TextElision elision, TextWrapping wrapping) const
{
Vector<Block> blocks;
@ -110,14 +110,14 @@ Vector<DeprecatedString, 32> TextLayout::wrap_lines(TextElision elision, TextWra
});
}
Vector<DeprecatedString> lines;
Vector<ByteString> lines;
StringBuilder builder;
float line_width = 0;
size_t current_block = 0;
for (Block& block : blocks) {
switch (block.type) {
case BlockType::Newline: {
lines.append(builder.to_deprecated_string());
lines.append(builder.to_byte_string());
builder.clear();
line_width = 0;
current_block++;
@ -133,7 +133,7 @@ Vector<DeprecatedString, 32> TextLayout::wrap_lines(TextElision elision, TextWra
}
if (wrapping == TextWrapping::Wrap && line_width + block_width > m_rect.width()) {
lines.append(builder.to_deprecated_string());
lines.append(builder.to_byte_string());
builder.clear();
line_width = 0;
}
@ -145,7 +145,7 @@ Vector<DeprecatedString, 32> TextLayout::wrap_lines(TextElision elision, TextWra
}
}
auto last_line = builder.to_deprecated_string();
auto last_line = builder.to_byte_string();
if (!last_line.is_empty())
lines.append(last_line);
@ -161,7 +161,7 @@ Vector<DeprecatedString, 32> TextLayout::wrap_lines(TextElision elision, TextWra
return lines;
}
DeprecatedString TextLayout::elide_text_from_right(Utf8View text) const
ByteString TextLayout::elide_text_from_right(Utf8View text) const
{
float text_width = m_font.width(text);
if (text_width > static_cast<float>(m_rect.width())) {
@ -189,7 +189,7 @@ DeprecatedString TextLayout::elide_text_from_right(Utf8View text) const
StringBuilder builder;
builder.append(text.substring_view(0, offset).as_string());
builder.append("..."sv);
return builder.to_deprecated_string();
return builder.to_byte_string();
}
}

View file

@ -7,8 +7,8 @@
#pragma once
#include <AK/ByteString.h>
#include <AK/CharacterTypes.h>
#include <AK/DeprecatedString.h>
#include <AK/Forward.h>
#include <AK/Utf32View.h>
#include <AK/Utf8View.h>
@ -49,7 +49,7 @@ public:
{
}
Vector<DeprecatedString, 32> lines(TextElision elision, TextWrapping wrapping) const
Vector<ByteString, 32> lines(TextElision elision, TextWrapping wrapping) const
{
return wrap_lines(elision, wrapping);
}
@ -57,8 +57,8 @@ public:
FloatRect bounding_rect(TextWrapping) const;
private:
Vector<DeprecatedString, 32> wrap_lines(TextElision, TextWrapping) const;
DeprecatedString elide_text_from_right(Utf8View) const;
Vector<ByteString, 32> wrap_lines(TextElision, TextWrapping) const;
ByteString elide_text_from_right(Utf8View) const;
Font const& m_font;
FontPixelMetrics m_font_metrics;

View file

@ -5,21 +5,21 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <AK/DeprecatedString.h>
#include <AK/ByteString.h>
#include <LibGfx/Triangle.h>
namespace Gfx {
template<>
DeprecatedString Triangle<int>::to_deprecated_string() const
ByteString Triangle<int>::to_byte_string() const
{
return DeprecatedString::formatted("({},{},{})", m_a, m_b, m_c);
return ByteString::formatted("({},{},{})", m_a, m_b, m_c);
}
template<>
DeprecatedString Triangle<float>::to_deprecated_string() const
ByteString Triangle<float>::to_byte_string() const
{
return DeprecatedString::formatted("({},{},{})", m_a, m_b, m_c);
return ByteString::formatted("({},{},{})", m_a, m_b, m_c);
}
}

View file

@ -49,7 +49,7 @@ public:
return true;
}
DeprecatedString to_deprecated_string() const;
ByteString to_byte_string() const;
private:
T m_determinant { 0 };

View file

@ -29,7 +29,7 @@ template<typename T>
struct Formatter<Gfx::Vector2<T>> : Formatter<StringView> {
ErrorOr<void> format(FormatBuilder& builder, Gfx::Vector2<T> const& value)
{
return Formatter<StringView>::format(builder, value.to_deprecated_string());
return Formatter<StringView>::format(builder, value.to_byte_string());
}
};

View file

@ -29,7 +29,7 @@ template<typename T>
struct Formatter<Gfx::Vector3<T>> : Formatter<StringView> {
ErrorOr<void> format(FormatBuilder& builder, Gfx::Vector3<T> const& value)
{
return Formatter<StringView>::format(builder, value.to_deprecated_string());
return Formatter<StringView>::format(builder, value.to_byte_string());
}
};

View file

@ -29,7 +29,7 @@ template<typename T>
struct Formatter<Gfx::Vector4<T>> : Formatter<StringView> {
ErrorOr<void> format(FormatBuilder& builder, Gfx::Vector4<T> const& value)
{
return Formatter<StringView>::format(builder, value.to_deprecated_string());
return Formatter<StringView>::format(builder, value.to_byte_string());
}
};

View file

@ -9,7 +9,7 @@
#pragma once
#include <AK/Array.h>
#include <AK/DeprecatedString.h>
#include <AK/ByteString.h>
#include <AK/Error.h>
#include <AK/Math.h>
#include <AK/StdLibExtras.h>
@ -262,14 +262,14 @@ public:
return VectorN<3, T>(x(), y(), z());
}
[[nodiscard]] DeprecatedString to_deprecated_string() const
[[nodiscard]] ByteString to_byte_string() const
{
if constexpr (N == 2)
return DeprecatedString::formatted("[{},{}]", x(), y());
return ByteString::formatted("[{},{}]", x(), y());
else if constexpr (N == 3)
return DeprecatedString::formatted("[{},{},{}]", x(), y(), z());
return ByteString::formatted("[{},{},{}]", x(), y(), z());
else
return DeprecatedString::formatted("[{},{},{},{}]", x(), y(), z(), w());
return ByteString::formatted("[{},{},{},{}]", x(), y(), z(), w());
}
template<typename U>