mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 18:27:36 +00:00
Everywhere: Rename to_{string => deprecated_string}() where applicable
This will make it easier to support both string types at the same time while we convert code, and tracking down remaining uses. One big exception is Value::to_string() in LibJS, where the name is dictated by the ToString AO.
This commit is contained in:
parent
6e19ab2bbc
commit
57dc179b1f
597 changed files with 1973 additions and 1972 deletions
|
@ -18,12 +18,12 @@
|
|||
|
||||
namespace Gfx {
|
||||
|
||||
DeprecatedString Color::to_string() const
|
||||
DeprecatedString Color::to_deprecated_string() const
|
||||
{
|
||||
return DeprecatedString::formatted("#{:02x}{:02x}{:02x}{:02x}", red(), green(), blue(), alpha());
|
||||
}
|
||||
|
||||
DeprecatedString Color::to_string_without_alpha() const
|
||||
DeprecatedString Color::to_deprecated_string_without_alpha() const
|
||||
{
|
||||
return DeprecatedString::formatted("#{:02x}{:02x}{:02x}", red(), green(), blue());
|
||||
}
|
||||
|
@ -384,5 +384,5 @@ ErrorOr<void> IPC::decode(Decoder& decoder, Color& color)
|
|||
|
||||
ErrorOr<void> AK::Formatter<Gfx::Color>::format(FormatBuilder& builder, Gfx::Color const& value)
|
||||
{
|
||||
return Formatter<StringView>::format(builder, value.to_string());
|
||||
return Formatter<StringView>::format(builder, value.to_deprecated_string());
|
||||
}
|
||||
|
|
|
@ -352,8 +352,8 @@ public:
|
|||
return m_value == other.m_value;
|
||||
}
|
||||
|
||||
DeprecatedString to_string() const;
|
||||
DeprecatedString to_string_without_alpha() const;
|
||||
DeprecatedString to_deprecated_string() const;
|
||||
DeprecatedString to_deprecated_string_without_alpha() const;
|
||||
static Optional<Color> from_string(StringView);
|
||||
|
||||
constexpr HSV to_hsv() const
|
||||
|
|
|
@ -930,7 +930,7 @@ void DDSLoadingContext::dump_debug()
|
|||
builder.append(" DDS_ALPHA_MODE_CUSTOM"sv);
|
||||
builder.append("\n"sv);
|
||||
|
||||
dbgln("{}", builder.to_string());
|
||||
dbgln("{}", builder.to_deprecated_string());
|
||||
}
|
||||
|
||||
DDSImageDecoderPlugin::DDSImageDecoderPlugin(u8 const* data, size_t size)
|
||||
|
|
|
@ -380,7 +380,7 @@ DeprecatedString BitmapFont::variant() const
|
|||
builder.append(' ');
|
||||
builder.append(slope_to_name(slope()));
|
||||
}
|
||||
return builder.to_string();
|
||||
return builder.to_deprecated_string();
|
||||
}
|
||||
|
||||
Font const& Font::bold_variant() const
|
||||
|
|
|
@ -141,7 +141,7 @@ public:
|
|||
return Line<U>(*this);
|
||||
}
|
||||
|
||||
DeprecatedString to_string() const;
|
||||
DeprecatedString to_deprecated_string() const;
|
||||
|
||||
private:
|
||||
Point<T> m_a;
|
||||
|
@ -149,13 +149,13 @@ private:
|
|||
};
|
||||
|
||||
template<>
|
||||
inline DeprecatedString IntLine::to_string() const
|
||||
inline DeprecatedString IntLine::to_deprecated_string() const
|
||||
{
|
||||
return DeprecatedString::formatted("[{},{} -> {},{}]", m_a.x(), m_a.y(), m_b.x(), m_b.y());
|
||||
}
|
||||
|
||||
template<>
|
||||
inline DeprecatedString FloatLine::to_string() const
|
||||
inline DeprecatedString FloatLine::to_deprecated_string() const
|
||||
{
|
||||
return DeprecatedString::formatted("[{},{} -> {},{}]", m_a.x(), m_a.y(), m_b.x(), m_b.y());
|
||||
}
|
||||
|
|
|
@ -2417,7 +2417,7 @@ DeprecatedString parse_ampersand_string(StringView raw_text, Optional<size_t>* u
|
|||
}
|
||||
builder.append(raw_text[i]);
|
||||
}
|
||||
return builder.to_string();
|
||||
return builder.to_deprecated_string();
|
||||
}
|
||||
|
||||
void Gfx::Painter::draw_ui_text(Gfx::IntRect const& rect, StringView text, Gfx::Font const& font, Gfx::TextAlignment text_alignment, Gfx::Color color)
|
||||
|
|
|
@ -177,7 +177,7 @@ void Path::close_all_subpaths()
|
|||
}
|
||||
}
|
||||
|
||||
DeprecatedString Path::to_string() const
|
||||
DeprecatedString Path::to_deprecated_string() const
|
||||
{
|
||||
StringBuilder builder;
|
||||
builder.append("Path { "sv);
|
||||
|
@ -207,19 +207,19 @@ DeprecatedString Path::to_string() const
|
|||
switch (segment.type()) {
|
||||
case Segment::Type::QuadraticBezierCurveTo:
|
||||
builder.append(", "sv);
|
||||
builder.append(static_cast<QuadraticBezierCurveSegment const&>(segment).through().to_string());
|
||||
builder.append(static_cast<QuadraticBezierCurveSegment const&>(segment).through().to_deprecated_string());
|
||||
break;
|
||||
case Segment::Type::CubicBezierCurveTo:
|
||||
builder.append(", "sv);
|
||||
builder.append(static_cast<CubicBezierCurveSegment const&>(segment).through_0().to_string());
|
||||
builder.append(static_cast<CubicBezierCurveSegment const&>(segment).through_0().to_deprecated_string());
|
||||
builder.append(", "sv);
|
||||
builder.append(static_cast<CubicBezierCurveSegment const&>(segment).through_1().to_string());
|
||||
builder.append(static_cast<CubicBezierCurveSegment const&>(segment).through_1().to_deprecated_string());
|
||||
break;
|
||||
case Segment::Type::EllipticalArcTo: {
|
||||
auto& arc = static_cast<EllipticalArcSegment const&>(segment);
|
||||
builder.appendff(", {}, {}, {}, {}, {}",
|
||||
arc.radii().to_string().characters(),
|
||||
arc.center().to_string().characters(),
|
||||
arc.radii().to_deprecated_string().characters(),
|
||||
arc.center().to_deprecated_string().characters(),
|
||||
arc.x_axis_rotation(),
|
||||
arc.theta_1(),
|
||||
arc.theta_delta());
|
||||
|
@ -232,7 +232,7 @@ DeprecatedString Path::to_string() const
|
|||
builder.append(") "sv);
|
||||
}
|
||||
builder.append('}');
|
||||
return builder.to_string();
|
||||
return builder.to_deprecated_string();
|
||||
}
|
||||
|
||||
void Path::segmentize_path()
|
||||
|
|
|
@ -245,7 +245,7 @@ public:
|
|||
|
||||
Path copy_transformed(AffineTransform const&) const;
|
||||
|
||||
DeprecatedString to_string() const;
|
||||
DeprecatedString to_deprecated_string() const;
|
||||
|
||||
private:
|
||||
void invalidate_split_lines()
|
||||
|
|
|
@ -36,13 +36,13 @@ template<typename T>
|
|||
}
|
||||
|
||||
template<>
|
||||
DeprecatedString IntPoint::to_string() const
|
||||
DeprecatedString IntPoint::to_deprecated_string() const
|
||||
{
|
||||
return DeprecatedString::formatted("[{},{}]", x(), y());
|
||||
}
|
||||
|
||||
template<>
|
||||
DeprecatedString FloatPoint::to_string() const
|
||||
DeprecatedString FloatPoint::to_deprecated_string() const
|
||||
{
|
||||
return DeprecatedString::formatted("[{},{}]", x(), y());
|
||||
}
|
||||
|
|
|
@ -248,7 +248,7 @@ public:
|
|||
return Point<U>(ceil(x()), ceil(y()));
|
||||
}
|
||||
|
||||
[[nodiscard]] DeprecatedString to_string() const;
|
||||
[[nodiscard]] DeprecatedString to_deprecated_string() const;
|
||||
|
||||
private:
|
||||
T m_x { 0 };
|
||||
|
|
|
@ -45,7 +45,7 @@ static bool read_number(Streamer& streamer, TValue* value)
|
|||
sb.append(byte);
|
||||
}
|
||||
|
||||
auto const opt_value = sb.to_string().to_uint();
|
||||
auto const opt_value = sb.to_deprecated_string().to_uint();
|
||||
if (!opt_value.has_value()) {
|
||||
*value = 0;
|
||||
return false;
|
||||
|
|
|
@ -15,13 +15,13 @@
|
|||
namespace Gfx {
|
||||
|
||||
template<>
|
||||
DeprecatedString IntRect::to_string() const
|
||||
DeprecatedString IntRect::to_deprecated_string() const
|
||||
{
|
||||
return DeprecatedString::formatted("[{},{} {}x{}]", x(), y(), width(), height());
|
||||
}
|
||||
|
||||
template<>
|
||||
DeprecatedString FloatRect::to_string() const
|
||||
DeprecatedString FloatRect::to_deprecated_string() const
|
||||
{
|
||||
return DeprecatedString::formatted("[{},{} {}x{}]", x(), y(), width(), height());
|
||||
}
|
||||
|
|
|
@ -997,7 +997,7 @@ public:
|
|||
};
|
||||
}
|
||||
|
||||
[[nodiscard]] DeprecatedString to_string() const;
|
||||
[[nodiscard]] DeprecatedString to_deprecated_string() const;
|
||||
|
||||
private:
|
||||
Point<T> m_location;
|
||||
|
|
|
@ -12,13 +12,13 @@
|
|||
namespace Gfx {
|
||||
|
||||
template<>
|
||||
DeprecatedString IntSize::to_string() const
|
||||
DeprecatedString IntSize::to_deprecated_string() const
|
||||
{
|
||||
return DeprecatedString::formatted("[{}x{}]", m_width, m_height);
|
||||
}
|
||||
|
||||
template<>
|
||||
DeprecatedString FloatSize::to_string() const
|
||||
DeprecatedString FloatSize::to_deprecated_string() const
|
||||
{
|
||||
return DeprecatedString::formatted("[{}x{}]", m_width, m_height);
|
||||
}
|
||||
|
|
|
@ -182,7 +182,7 @@ public:
|
|||
return Size<U>(*this);
|
||||
}
|
||||
|
||||
[[nodiscard]] DeprecatedString to_string() const;
|
||||
[[nodiscard]] DeprecatedString to_deprecated_string() const;
|
||||
|
||||
template<Integral I>
|
||||
[[nodiscard]] Size<I> to_rounded() const
|
||||
|
|
|
@ -125,7 +125,7 @@ Vector<DeprecatedString, 32> TextLayout::wrap_lines(TextElision elision, TextWra
|
|||
for (Block& block : blocks) {
|
||||
switch (block.type) {
|
||||
case BlockType::Newline: {
|
||||
lines.append(builder.to_string());
|
||||
lines.append(builder.to_deprecated_string());
|
||||
builder.clear();
|
||||
line_width = 0;
|
||||
|
||||
|
@ -147,7 +147,7 @@ Vector<DeprecatedString, 32> TextLayout::wrap_lines(TextElision elision, TextWra
|
|||
}
|
||||
|
||||
if (wrapping == TextWrapping::Wrap && line_width + block_width > static_cast<unsigned>(m_rect.width())) {
|
||||
lines.append(builder.to_string());
|
||||
lines.append(builder.to_deprecated_string());
|
||||
builder.clear();
|
||||
line_width = 0;
|
||||
}
|
||||
|
@ -166,7 +166,7 @@ Vector<DeprecatedString, 32> TextLayout::wrap_lines(TextElision elision, TextWra
|
|||
|
||||
blocks_processed:
|
||||
if (!did_not_finish) {
|
||||
auto last_line = builder.to_string();
|
||||
auto last_line = builder.to_deprecated_string();
|
||||
if (!last_line.is_empty())
|
||||
lines.append(last_line);
|
||||
}
|
||||
|
@ -212,7 +212,7 @@ DeprecatedString TextLayout::elide_text_from_right(Utf8View text, bool force_eli
|
|||
StringBuilder builder;
|
||||
builder.append(text.substring_view(0, offset).as_string());
|
||||
builder.append("..."sv);
|
||||
return builder.to_string();
|
||||
return builder.to_deprecated_string();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -11,13 +11,13 @@
|
|||
namespace Gfx {
|
||||
|
||||
template<>
|
||||
DeprecatedString Triangle<int>::to_string() const
|
||||
DeprecatedString Triangle<int>::to_deprecated_string() const
|
||||
{
|
||||
return DeprecatedString::formatted("({},{},{})", m_a, m_b, m_c);
|
||||
}
|
||||
|
||||
template<>
|
||||
DeprecatedString Triangle<float>::to_string() const
|
||||
DeprecatedString Triangle<float>::to_deprecated_string() const
|
||||
{
|
||||
return DeprecatedString::formatted("({},{},{})", m_a, m_b, m_c);
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ public:
|
|||
return true;
|
||||
}
|
||||
|
||||
DeprecatedString to_string() const;
|
||||
DeprecatedString to_deprecated_string() const;
|
||||
|
||||
private:
|
||||
T m_determinant { 0 };
|
||||
|
|
|
@ -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_string());
|
||||
return Formatter<StringView>::format(builder, value.to_deprecated_string());
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -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_string());
|
||||
return Formatter<StringView>::format(builder, value.to_deprecated_string());
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -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_string());
|
||||
return Formatter<StringView>::format(builder, value.to_deprecated_string());
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -243,7 +243,7 @@ public:
|
|||
return VectorN<3, T>(x(), y(), z());
|
||||
}
|
||||
|
||||
[[nodiscard]] DeprecatedString to_string() const
|
||||
[[nodiscard]] DeprecatedString to_deprecated_string() const
|
||||
{
|
||||
if constexpr (N == 2)
|
||||
return DeprecatedString::formatted("[{},{}]", x(), y());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue