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

@ -13,7 +13,7 @@
#include <LibVT/XtermColors.h>
#ifndef KERNEL
# include <AK/String.h>
# include <AK/DeprecatedString.h>
#endif
namespace VT {
@ -37,8 +37,8 @@ struct Attribute {
Color background_color { default_background_color };
#ifndef KERNEL
String href;
String href_id;
DeprecatedString href;
DeprecatedString href_id;
#endif
enum class Flags : u8 {

View file

@ -1275,12 +1275,12 @@ void Terminal::execute_osc_sequence(OscParameters parameters, u8 last_byte)
dbgln("Attempted to set href but gave too few parameters");
} else if (parameters[1].is_empty() && parameters[2].is_empty()) {
// Clear hyperlink
m_current_state.attribute.href = String();
m_current_state.attribute.href_id = String();
m_current_state.attribute.href = DeprecatedString();
m_current_state.attribute.href_id = DeprecatedString();
} else {
m_current_state.attribute.href = stringview_ify(2);
// FIXME: Respect the provided ID
m_current_state.attribute.href_id = String::number(m_next_href_id++);
m_current_state.attribute.href_id = DeprecatedString::number(m_next_href_id++);
}
#endif
break;

View file

@ -17,7 +17,7 @@
#include <LibVT/Position.h>
#ifndef KERNEL
# include <AK/String.h>
# include <AK/DeprecatedString.h>
# include <LibVT/Attribute.h>
# include <LibVT/Line.h>
#else
@ -436,8 +436,8 @@ protected:
Attribute m_saved_attribute;
#ifndef KERNEL
String m_current_window_title;
Vector<String> m_title_stack;
DeprecatedString m_current_window_title;
Vector<DeprecatedString> m_title_stack;
#endif
#ifndef KERNEL

View file

@ -6,9 +6,9 @@
*/
#include "TerminalWidget.h"
#include <AK/DeprecatedString.h>
#include <AK/LexicalPath.h>
#include <AK/StdLibExtras.h>
#include <AK/String.h>
#include <AK/StringBuilder.h>
#include <AK/TemporaryChange.h>
#include <AK/Utf32View.h>
@ -850,12 +850,12 @@ void TerminalWidget::mousemove_event(GUI::MouseEvent& event)
auto file_name = LexicalPath::basename(path);
if (path == handlers[0]) {
set_tooltip(String::formatted("Execute {}", app_name));
set_tooltip(DeprecatedString::formatted("Execute {}", app_name));
} else {
set_tooltip(String::formatted("Open {} with {}", file_name, app_name));
set_tooltip(DeprecatedString::formatted("Open {} with {}", file_name, app_name));
}
} else {
set_tooltip(String::formatted("Open {} with {}", attribute.href, app_name));
set_tooltip(DeprecatedString::formatted("Open {} with {}", attribute.href, app_name));
}
}
} else {
@ -954,7 +954,7 @@ int TerminalWidget::scroll_length() const
return m_scrollbar->step();
}
String TerminalWidget::selected_text() const
DeprecatedString TerminalWidget::selected_text() const
{
StringBuilder builder;
@ -1105,7 +1105,7 @@ void TerminalWidget::context_menu_event(GUI::ContextMenuEvent& event)
auto af = Desktop::AppFile::get_for_app(LexicalPath::basename(handler));
if (!af->is_valid())
continue;
auto action = GUI::Action::create(String::formatted("&Open in {}", af->name()), af->icon().bitmap_for_size(16), [this, handler](auto&) {
auto action = GUI::Action::create(DeprecatedString::formatted("&Open in {}", af->name()), af->icon().bitmap_for_size(16), [this, handler](auto&) {
Desktop::Launcher::open(m_context_menu_href, handler);
});
@ -1218,7 +1218,7 @@ void TerminalWidget::set_color_scheme(StringView name)
"White"sv
};
auto path = String::formatted("/res/terminal-colors/{}.ini", name);
auto path = DeprecatedString::formatted("/res/terminal-colors/{}.ini", name);
auto color_config_or_error = Core::ConfigFile::open(path);
if (color_config_or_error.is_error()) {
dbgln("Unable to read color scheme file '{}': {}", path, color_config_or_error.error());
@ -1340,7 +1340,7 @@ Optional<VT::CursorShape> TerminalWidget::parse_cursor_shape(StringView cursor_s
return {};
}
String TerminalWidget::stringify_cursor_shape(VT::CursorShape cursor_shape)
DeprecatedString TerminalWidget::stringify_cursor_shape(VT::CursorShape cursor_shape)
{
switch (cursor_shape) {
case VT::CursorShape::Block:

View file

@ -7,7 +7,7 @@
#pragma once
#include <AK/String.h>
#include <AK/DeprecatedString.h>
#include <LibCore/ElapsedTimer.h>
#include <LibCore/Notifier.h>
#include <LibCore/Timer.h>
@ -57,7 +57,7 @@ public:
bool has_selection() const;
bool selection_contains(const VT::Position&) const;
String selected_text() const;
DeprecatedString selected_text() const;
VT::Range normalized_selection() const { return m_selection.normalized(); }
void set_selection(const VT::Range& selection);
VT::Position buffer_position_at(Gfx::IntPoint const&) const;
@ -103,7 +103,7 @@ public:
virtual void set_cursor_shape(CursorShape) override;
static Optional<VT::CursorShape> parse_cursor_shape(StringView);
static String stringify_cursor_shape(VT::CursorShape);
static DeprecatedString stringify_cursor_shape(VT::CursorShape);
private:
TerminalWidget(int ptm_fd, bool automatic_size_policy);
@ -136,7 +136,7 @@ private:
virtual void emit(u8 const*, size_t) override;
// ^GUI::Clipboard::ClipboardClient
virtual void clipboard_content_did_change(String const&) override { update_paste_action(); }
virtual void clipboard_content_did_change(DeprecatedString const&) override { update_paste_action(); }
void send_non_user_input(ReadonlyBytes);
@ -165,21 +165,21 @@ private:
VT::Range m_selection;
String m_hovered_href;
String m_hovered_href_id;
DeprecatedString m_hovered_href;
DeprecatedString m_hovered_href_id;
String m_active_href;
String m_active_href_id;
DeprecatedString m_active_href;
DeprecatedString m_active_href_id;
// Snapshot of m_hovered_href when opening a context menu for a hyperlink.
String m_context_menu_href;
DeprecatedString m_context_menu_href;
unsigned m_colors[256];
Gfx::Color m_default_foreground_color;
Gfx::Color m_default_background_color;
bool m_show_bold_text_as_bright { true };
String m_color_scheme_name;
DeprecatedString m_color_scheme_name;
BellMode m_bell_mode { BellMode::Visible };
bool m_alt_key_held { false };