1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 21:17:45 +00:00

Everywhere: Add sv suffix to strings relying on StringView(char const*)

Each of these strings would previously rely on StringView's char const*
constructor overload, which would call __builtin_strlen on the string.
Since we now have operator ""sv, we can replace these with much simpler
versions. This opens the door to being able to remove
StringView(char const*).

No functional changes.
This commit is contained in:
sin-ack 2022-07-11 17:32:29 +00:00 committed by Andreas Kling
parent e5f09ea170
commit 3f3f45580a
762 changed files with 8315 additions and 8316 deletions

View file

@ -37,11 +37,11 @@ CharacterMapWidget::CharacterMapWidget()
m_statusbar = find_descendant_of_type_named<GUI::Statusbar>("statusbar");
m_unicode_block_listview = find_descendant_of_type_named<GUI::ListView>("unicode_block_listview");
m_choose_font_action = GUI::Action::create("Choose Font...", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-font-editor.png").release_value_but_fixme_should_propagate_errors(), [&](auto&) {
m_choose_font_action = GUI::Action::create("Choose Font...", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-font-editor.png"sv).release_value_but_fixme_should_propagate_errors(), [&](auto&) {
auto font_picker = GUI::FontPicker::construct(window(), &font(), false);
if (font_picker->exec() == GUI::Dialog::ExecResult::OK) {
auto& font = *font_picker->font();
Config::write_string("CharacterMap", "History", "Font", font.qualified_name());
Config::write_string("CharacterMap"sv, "History"sv, "Font"sv, font.qualified_name());
set_font(font);
}
});
@ -58,19 +58,19 @@ CharacterMapWidget::CharacterMapWidget()
});
m_copy_selection_action->set_status_tip("Copy the highlighted characters to the clipboard");
m_previous_glyph_action = GUI::Action::create("Previous character", { Mod_Alt, Key_Left }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-back.png").release_value_but_fixme_should_propagate_errors(), [&](auto&) {
m_previous_glyph_action = GUI::Action::create("Previous character", { Mod_Alt, Key_Left }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-back.png"sv).release_value_but_fixme_should_propagate_errors(), [&](auto&) {
m_glyph_map->select_previous_existing_glyph();
});
m_previous_glyph_action->set_status_tip("Seek the previous visible glyph");
m_next_glyph_action = GUI::Action::create("&Next Glyph", { Mod_Alt, Key_Right }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-forward.png").release_value_but_fixme_should_propagate_errors(), [&](auto&) {
m_next_glyph_action = GUI::Action::create("&Next Glyph", { Mod_Alt, Key_Right }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-forward.png"sv).release_value_but_fixme_should_propagate_errors(), [&](auto&) {
m_glyph_map->select_next_existing_glyph();
});
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").release_value_but_fixme_should_propagate_errors(), [&](auto&) {
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;
if (GUI::InputBox::show(window(), input, "Hexadecimal:", "Go to glyph") == GUI::InputBox::ExecResult::OK && !input.is_empty()) {
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())
return;
@ -83,7 +83,7 @@ CharacterMapWidget::CharacterMapWidget()
});
m_go_to_glyph_action->set_status_tip("Go to the specified code point");
m_find_glyphs_action = GUI::Action::create("&Find glyphs...", { Mod_Ctrl, Key_F }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/find.png").release_value_but_fixme_should_propagate_errors(), [&](auto&) {
m_find_glyphs_action = GUI::Action::create("&Find glyphs...", { Mod_Ctrl, Key_F }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/find.png"sv).release_value_but_fixme_should_propagate_errors(), [&](auto&) {
if (m_find_window.is_null()) {
m_find_window = GUI::Window::construct(window());
auto& search_widget = m_find_window->set_main_widget<CharacterSearchWidget>();
@ -91,7 +91,7 @@ CharacterMapWidget::CharacterMapWidget()
m_glyph_map->set_active_glyph(code_point);
m_glyph_map->scroll_to_glyph(code_point);
};
m_find_window->set_icon(GUI::Icon::try_create_default_icon("find").value().bitmap_for_size(16));
m_find_window->set_icon(GUI::Icon::try_create_default_icon("find"sv).value().bitmap_for_size(16));
m_find_window->set_title("Find a character");
m_find_window->resize(300, 400);
}
@ -159,7 +159,7 @@ void CharacterMapWidget::initialize_menubar(GUI::Window& window)
help_menu.add_action(GUI::CommonActions::make_help_action([&](auto&) {
Desktop::Launcher::open(URL::create_with_file_protocol("/usr/share/man/man1/CharacterMap.md"), "/bin/Help");
}));
help_menu.add_action(GUI::CommonActions::make_about_action("Character Map", GUI::Icon::default_icon("app-character-map"), &window));
help_menu.add_action(GUI::CommonActions::make_about_action("Character Map", GUI::Icon::default_icon("app-character-map"sv), &window));
}
void CharacterMapWidget::did_change_font()

View file

@ -24,7 +24,7 @@ static void search_and_print_results(String const& query)
for_each_character_containing(query, [&](auto code_point, auto display_name) {
StringBuilder builder;
builder.append_code_point(code_point);
builder.append(" - ");
builder.append(" - "sv);
builder.append(display_name);
outln(builder.string_view());
result_count++;
@ -62,7 +62,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
return 0;
}
auto app_icon = TRY(GUI::Icon::try_create_default_icon("app-character-map"));
auto app_icon = TRY(GUI::Icon::try_create_default_icon("app-character-map"sv));
auto window = TRY(GUI::Window::try_create());
window->set_title("Character Map");
window->set_icon(app_icon.bitmap_for_size(16));
@ -71,7 +71,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
auto character_map_widget = TRY(window->try_set_main_widget<CharacterMapWidget>());
character_map_widget->initialize_menubar(*window);
auto font_query = Config::read_string("CharacterMap", "History", "Font", Gfx::FontDatabase::the().default_font_query());
auto font_query = Config::read_string("CharacterMap"sv, "History"sv, "Font"sv, Gfx::FontDatabase::the().default_font_query());
character_map_widget->set_font(Gfx::FontDatabase::the().get_by_name(font_query));
window->show();