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

@ -69,7 +69,7 @@ CharacterMapWidget::CharacterMapWidget()
m_next_glyph_action->set_status_tip("Seek the next visible glyph");
m_go_to_glyph_action = GUI::Action::create("Go to glyph...", { Mod_Ctrl, Key_G }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-to.png"sv).release_value_but_fixme_should_propagate_errors(), [&](auto&) {
String input;
DeprecatedString input;
if (GUI::InputBox::show(window(), input, "Hexadecimal:"sv, "Go to glyph"sv) == GUI::InputBox::ExecResult::OK && !input.is_empty()) {
auto maybe_code_point = AK::StringUtils::convert_to_uint_from_hex(input);
if (!maybe_code_point.has_value())
@ -139,7 +139,7 @@ CharacterMapWidget::CharacterMapWidget()
for (auto& block : unicode_blocks)
m_unicode_block_list.append(block.display_name);
m_unicode_block_model = GUI::ItemListModel<String>::create(m_unicode_block_list);
m_unicode_block_model = GUI::ItemListModel<DeprecatedString>::create(m_unicode_block_list);
m_unicode_block_listview->set_model(*m_unicode_block_model);
m_unicode_block_listview->set_activates_on_selection(true);
m_unicode_block_listview->horizontal_scrollbar().set_visible(false);

View file

@ -42,6 +42,6 @@ private:
RefPtr<GUI::Action> m_go_to_glyph_action;
RefPtr<GUI::Action> m_find_glyphs_action;
Vector<String> m_unicode_block_list;
Vector<DeprecatedString> m_unicode_block_list;
Unicode::CodePointRange m_range { 0x0000, 0x10FFFF };
};

View file

@ -11,8 +11,8 @@
struct SearchResult {
u32 code_point;
String code_point_string;
String display_text;
DeprecatedString code_point_string;
DeprecatedString display_text;
};
class CharacterSearchModel final : public GUI::Model {

View file

@ -6,13 +6,13 @@
#pragma once
#include <AK/String.h>
#include <AK/DeprecatedString.h>
#include <LibUnicode/CharacterTypes.h>
template<typename Callback>
void for_each_character_containing(StringView query, Callback callback)
{
String uppercase_query = query.to_uppercase_string();
DeprecatedString uppercase_query = query.to_uppercase_string();
StringView uppercase_query_view = uppercase_query.view();
constexpr u32 maximum_code_point = 0x10FFFF;
// FIXME: There's probably a better way to do this than just looping, but it still only takes ~150ms to run for me!

View file

@ -17,7 +17,7 @@
#include <LibGfx/Font/FontDatabase.h>
#include <LibMain/Main.h>
static void search_and_print_results(String const& query)
static void search_and_print_results(DeprecatedString const& query)
{
outln("Searching for '{}'", query);
u32 result_count = 0;
@ -52,7 +52,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
TRY(Core::System::unveil("/res", "r"));
TRY(Core::System::unveil(nullptr, nullptr));
String query;
DeprecatedString query;
Core::ArgsParser args_parser;
args_parser.add_option(query, "Search character names using this query, and print them as a list.", "search", 's', "query");
args_parser.parse(arguments);