1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 06:47:34 +00:00

Everywhere: Pass AK::StringView by value

This commit is contained in:
Andreas Kling 2021-11-11 00:55:02 +01:00
parent ad5d217e76
commit 8b1108e485
392 changed files with 978 additions and 978 deletions

View file

@ -36,7 +36,7 @@ constexpr u32 ctrl(char c) { return c & 0x3f; }
namespace Line {
Configuration Configuration::from_config(const StringView& libname)
Configuration Configuration::from_config(StringView libname)
{
Configuration configuration;
auto config_file = Core::ConfigFile::open_for_lib(libname);
@ -359,7 +359,7 @@ void Editor::insert(const String& string)
insert(ch);
}
void Editor::insert(const StringView& string_view)
void Editor::insert(StringView string_view)
{
for (auto ch : Utf8View { string_view })
insert(ch);
@ -1190,7 +1190,7 @@ void Editor::cleanup_suggestions()
m_times_tab_pressed = 0; // Safe to say if we get here, the user didn't press TAB
}
bool Editor::search(const StringView& phrase, bool allow_empty, bool from_beginning)
bool Editor::search(StringView phrase, bool allow_empty, bool from_beginning)
{
int last_matching_offset = -1;
bool found = false;
@ -1690,7 +1690,7 @@ void VT::clear_to_end_of_line(OutputStream& stream)
stream.write("\033[K"sv.bytes());
}
StringMetrics Editor::actual_rendered_string_metrics(const StringView& string)
StringMetrics Editor::actual_rendered_string_metrics(StringView string)
{
StringMetrics metrics;
StringMetrics::LineMetrics current_line;

View file

@ -90,7 +90,7 @@ struct Configuration {
enable_bracketed_paste = flags & Flags::BracketedPaste;
}
static Configuration from_config(const StringView& libname = "line");
static Configuration from_config(StringView libname = "line");
RefreshBehavior refresh_behavior { RefreshBehavior::Lazy };
SignalHandler m_signal_mode { SignalHandler::WithSignalHandlers };
@ -159,14 +159,14 @@ public:
void register_key_input_callback(Vector<Key> keys, Function<bool(Editor&)> callback) { m_callback_machine.register_key_input_callback(move(keys), move(callback)); }
void register_key_input_callback(Key key, Function<bool(Editor&)> callback) { register_key_input_callback(Vector<Key> { key }, move(callback)); }
static StringMetrics actual_rendered_string_metrics(const StringView&);
static StringMetrics actual_rendered_string_metrics(StringView);
static StringMetrics actual_rendered_string_metrics(const Utf32View&);
Function<Vector<CompletionSuggestion>(const Editor&)> on_tab_complete;
Function<void()> on_interrupt_handled;
Function<void(Editor&)> on_display_refresh;
static Function<bool(Editor&)> find_internal_function(const StringView& name);
static Function<bool(Editor&)> find_internal_function(StringView name);
enum class CaseChangeOp {
Lowercase,
Uppercase,
@ -207,7 +207,7 @@ public:
void clear_line();
void insert(const String&);
void insert(const StringView&);
void insert(StringView);
void insert(const Utf32View&);
void insert(const u32);
void stylize(const Span&, const Style&);
@ -282,7 +282,7 @@ private:
Style find_applicable_style(size_t offset) const;
bool search(const StringView&, bool allow_empty = false, bool from_beginning = true);
bool search(StringView, bool allow_empty = false, bool from_beginning = true);
inline void end_search()
{
m_is_searching = false;

View file

@ -22,7 +22,7 @@ constexpr u32 ctrl(char c) { return c & 0x3f; }
namespace Line {
Function<bool(Editor&)> Editor::find_internal_function(const StringView& name)
Function<bool(Editor&)> Editor::find_internal_function(StringView name)
{
#define __ENUMERATE(internal_name) \
if (name == #internal_name) \

View file

@ -90,7 +90,7 @@ public:
struct Hyperlink {
bool operator==(const Hyperlink&) const = default;
explicit Hyperlink(const StringView& link)
explicit Hyperlink(StringView link)
: m_link(link)
{
m_has_link = true;

View file

@ -9,7 +9,7 @@
namespace Line {
CompletionSuggestion::CompletionSuggestion(const StringView& completion, const StringView& trailing_trivia, Style style)
CompletionSuggestion::CompletionSuggestion(StringView completion, StringView trailing_trivia, Style style)
: style(style)
, text_string(completion)
, is_valid(true)

View file

@ -36,12 +36,12 @@ public:
{
}
CompletionSuggestion(const StringView& completion, const StringView& trailing_trivia)
CompletionSuggestion(StringView completion, StringView trailing_trivia)
: CompletionSuggestion(completion, trailing_trivia, {})
{
}
CompletionSuggestion(const StringView& completion, const StringView& trailing_trivia, Style style);
CompletionSuggestion(StringView completion, StringView trailing_trivia, Style style);
bool operator==(const CompletionSuggestion& suggestion) const
{