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

@ -29,11 +29,11 @@ AvailableSize AvailableSize::make_max_content()
return AvailableSize { Type::MaxContent, INFINITY };
}
String AvailableSize::to_string() const
DeprecatedString AvailableSize::to_string() const
{
switch (m_type) {
case Type::Definite:
return String::formatted("definite({})", m_value);
return DeprecatedString::formatted("definite({})", m_value);
case Type::Indefinite:
return "indefinite";
case Type::MinContent:
@ -44,9 +44,9 @@ String AvailableSize::to_string() const
VERIFY_NOT_REACHED();
}
String AvailableSpace::to_string() const
DeprecatedString AvailableSpace::to_string() const
{
return String::formatted("{} x {}", width, height);
return DeprecatedString::formatted("{} x {}", width, height);
}
AvailableSize::AvailableSize(Type type, float value)

View file

@ -6,8 +6,8 @@
#pragma once
#include <AK/DeprecatedString.h>
#include <AK/Format.h>
#include <AK/String.h>
#include <LibWeb/Forward.h>
namespace Web::Layout {
@ -44,7 +44,7 @@ public:
return m_value;
}
String to_string() const;
DeprecatedString to_string() const;
private:
AvailableSize(Type type, float);
@ -64,7 +64,7 @@ public:
AvailableSize width;
AvailableSize height;
String to_string() const;
DeprecatedString to_string() const;
};
}

View file

@ -1835,7 +1835,7 @@ float GridFormattingContext::get_free_space_y(Box const& box)
return -1;
}
int GridFormattingContext::get_line_index_by_line_name(String const& needle, CSS::GridTrackSizeList grid_track_size_list)
int GridFormattingContext::get_line_index_by_line_name(DeprecatedString const& needle, CSS::GridTrackSizeList grid_track_size_list)
{
if (grid_track_size_list.track_list().size() == 0)
return -1;

View file

@ -69,7 +69,7 @@ private:
float get_free_space_x(AvailableSpace const& available_space);
float get_free_space_y(Box const&);
int get_line_index_by_line_name(String const& line_name, CSS::GridTrackSizeList);
int get_line_index_by_line_name(DeprecatedString const& line_name, CSS::GridTrackSizeList);
};
class OccupationGrid {

View file

@ -21,25 +21,25 @@ ListItemMarkerBox::ListItemMarkerBox(DOM::Document& document, CSS::ListStyleType
case CSS::ListStyleType::Disc:
break;
case CSS::ListStyleType::Decimal:
m_text = String::formatted("{}.", m_index);
m_text = DeprecatedString::formatted("{}.", m_index);
break;
case CSS::ListStyleType::DecimalLeadingZero:
// This is weird, but in accordance to spec.
m_text = m_index < 10 ? String::formatted("0{}.", m_index) : String::formatted("{}.", m_index);
m_text = m_index < 10 ? DeprecatedString::formatted("0{}.", m_index) : DeprecatedString::formatted("{}.", m_index);
break;
case CSS::ListStyleType::LowerAlpha:
case CSS::ListStyleType::LowerLatin:
m_text = String::bijective_base_from(m_index - 1).to_lowercase();
m_text = DeprecatedString::bijective_base_from(m_index - 1).to_lowercase();
break;
case CSS::ListStyleType::UpperAlpha:
case CSS::ListStyleType::UpperLatin:
m_text = String::bijective_base_from(m_index - 1);
m_text = DeprecatedString::bijective_base_from(m_index - 1);
break;
case CSS::ListStyleType::LowerRoman:
m_text = String::roman_number_from(m_index).to_lowercase();
m_text = DeprecatedString::roman_number_from(m_index).to_lowercase();
break;
case CSS::ListStyleType::UpperRoman:
m_text = String::roman_number_from(m_index);
m_text = DeprecatedString::roman_number_from(m_index);
break;
case CSS::ListStyleType::None:
break;

View file

@ -18,7 +18,7 @@ public:
explicit ListItemMarkerBox(DOM::Document&, CSS::ListStyleType, size_t index, NonnullRefPtr<CSS::StyleProperties>);
virtual ~ListItemMarkerBox() override;
String const& text() const { return m_text; }
DeprecatedString const& text() const { return m_text; }
virtual RefPtr<Painting::Paintable> create_paintable() const override;
@ -31,7 +31,7 @@ private:
CSS::ListStyleType m_list_style_type { CSS::ListStyleType::None };
size_t m_index;
String m_text {};
DeprecatedString m_text {};
};
template<>

View file

@ -585,7 +585,7 @@ bool Node::is_root_element() const
return is<HTML::HTMLHtmlElement>(*dom_node());
}
String Node::debug_description() const
DeprecatedString Node::debug_description() const
{
StringBuilder builder;
builder.append(class_name());

View file

@ -66,7 +66,7 @@ public:
bool is_root_element() const;
String debug_description() const;
DeprecatedString debug_description() const;
bool has_style() const { return m_has_style; }

View file

@ -37,7 +37,7 @@ void TextNode::compute_text_for_rendering(bool collapse)
auto& data = dom_node().data();
if (dom_node().is_password_input()) {
m_text_for_rendering = String::repeated('*', data.length());
m_text_for_rendering = DeprecatedString::repeated('*', data.length());
return;
}
@ -49,7 +49,7 @@ void TextNode::compute_text_for_rendering(bool collapse)
// NOTE: A couple fast returns to avoid unnecessarily allocating a StringBuilder.
if (data.length() == 1) {
if (is_ascii_space(data[0])) {
static String s_single_space_string = " ";
static DeprecatedString s_single_space_string = " ";
m_text_for_rendering = s_single_space_string;
} else {
m_text_for_rendering = data;

View file

@ -23,7 +23,7 @@ public:
const DOM::Text& dom_node() const { return static_cast<const DOM::Text&>(*Node::dom_node()); }
String const& text_for_rendering() const { return m_text_for_rendering; }
DeprecatedString const& text_for_rendering() const { return m_text_for_rendering; }
struct Chunk {
Utf8View view;
@ -55,7 +55,7 @@ public:
private:
virtual bool is_text_node() const final { return true; }
String m_text_for_rendering;
DeprecatedString m_text_for_rendering;
};
template<>