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

@ -31,7 +31,7 @@ CalculatorWidget::CalculatorWidget()
m_label->set_frame_thickness(2);
for (int i = 0; i < 10; i++) {
m_digit_button[i] = *find_descendant_of_type_named<GUI::Button>(String::formatted("{}_button", i));
m_digit_button[i] = *find_descendant_of_type_named<GUI::Button>(DeprecatedString::formatted("{}_button", i));
add_digit_button(*m_digit_button[i], i);
}
@ -128,7 +128,7 @@ void CalculatorWidget::add_digit_button(GUI::Button& button, int digit)
};
}
String CalculatorWidget::get_entry()
DeprecatedString CalculatorWidget::get_entry()
{
return m_entry->text();
}

View file

@ -19,7 +19,7 @@ class CalculatorWidget final : public GUI::Widget {
C_OBJECT(CalculatorWidget)
public:
virtual ~CalculatorWidget() override = default;
String get_entry();
DeprecatedString get_entry();
void set_entry(Crypto::BigFraction);
void shrink(unsigned);

View file

@ -112,15 +112,15 @@ void Keypad::set_to_0()
m_state = State::External;
}
String Keypad::to_string() const
DeprecatedString Keypad::to_string() const
{
if (m_state == State::External)
return m_internal_value.to_string(m_displayed_fraction_length);
StringBuilder builder;
String const integer_value = m_int_value.to_base(10);
String const frac_value = m_frac_value.to_base(10);
DeprecatedString const integer_value = m_int_value.to_base(10);
DeprecatedString const frac_value = m_frac_value.to_base(10);
unsigned const number_pre_zeros = m_frac_length.to_u64() - (frac_value.length() - 1) - (frac_value == "0" ? 0 : 1);
builder.append(integer_value);

View file

@ -7,7 +7,7 @@
#pragma once
#include <AK/String.h>
#include <AK/DeprecatedString.h>
#include <LibCrypto/BigFraction/BigFraction.h>
#include <LibCrypto/BigInt/UnsignedBigInteger.h>
@ -33,7 +33,7 @@ public:
void set_rounding_length(unsigned);
unsigned rounding_length() const;
String to_string() const;
DeprecatedString to_string() const;
private:
// Internal representation of the current decimal value.

View file

@ -78,7 +78,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
Optional<unsigned> last_rounding_mode = 1;
for (unsigned i {}; i < rounding_modes.size(); ++i) {
auto round_action = GUI::Action::create_checkable(String::formatted("To &{} digits", rounding_modes[i]),
auto round_action = GUI::Action::create_checkable(DeprecatedString::formatted("To &{} digits", rounding_modes[i]),
[&widget, rounding_mode = rounding_modes[i], &last_rounding_mode, i](auto&) {
widget->set_rounding_length(rounding_mode);
last_rounding_mode = i;
@ -89,11 +89,11 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
}
constexpr auto format { "&Custom - {} ..."sv };
auto round_custom = GUI::Action::create_checkable(String::formatted(format, 0), [&](auto& action) {
auto round_custom = GUI::Action::create_checkable(DeprecatedString::formatted(format, 0), [&](auto& action) {
unsigned custom_rounding_length = widget->rounding_length();
if (RoundingDialog::show(window, "Choose custom rounding"sv, custom_rounding_length) == GUI::Dialog::ExecResult::OK) {
action.set_text(String::formatted(format, custom_rounding_length));
action.set_text(DeprecatedString::formatted(format, custom_rounding_length));
widget->set_rounding_length(custom_rounding_length);
last_rounding_mode.clear();
} else if (last_rounding_mode.has_value())
@ -107,7 +107,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
if (RoundingDialog::show(window, "Choose shrinking length"sv, shrink_length) == GUI::Dialog::ExecResult::OK) {
round_custom->set_checked(true);
round_custom->set_text(String::formatted(format, shrink_length));
round_custom->set_text(DeprecatedString::formatted(format, shrink_length));
widget->set_rounding_length(shrink_length);
widget->shrink(shrink_length);
}