mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 18:17:34 +00:00
Everywhere: Pass AK::StringView by value
This commit is contained in:
parent
ad5d217e76
commit
8b1108e485
392 changed files with 978 additions and 978 deletions
|
@ -25,7 +25,7 @@ namespace LaunchServer {
|
|||
static Launcher* s_the;
|
||||
static bool spawn(String executable, const Vector<String>& arguments);
|
||||
|
||||
String Handler::name_from_executable(const StringView& executable)
|
||||
String Handler::name_from_executable(StringView executable)
|
||||
{
|
||||
auto separator = executable.find_last('/');
|
||||
if (separator.has_value()) {
|
||||
|
|
|
@ -27,7 +27,7 @@ struct Handler {
|
|||
HashTable<String> file_types {};
|
||||
HashTable<String> protocols {};
|
||||
|
||||
static String name_from_executable(const StringView&);
|
||||
static String name_from_executable(StringView);
|
||||
void from_executable(Type, const String&);
|
||||
String to_details_str() const;
|
||||
};
|
||||
|
|
|
@ -20,10 +20,10 @@ public:
|
|||
Function<void()> on_submit;
|
||||
|
||||
String username() const { return m_username->text(); }
|
||||
void set_username(StringView const& username) { m_username->set_text(username); }
|
||||
void set_username(StringView username) { m_username->set_text(username); }
|
||||
|
||||
String password() const { return m_password->text(); }
|
||||
void set_password(StringView const& password) { m_password->set_text(password); }
|
||||
void set_password(StringView password) { m_password->set_text(password); }
|
||||
|
||||
private:
|
||||
LoginWindow(GUI::Window* parent = nullptr);
|
||||
|
|
|
@ -280,7 +280,7 @@ void Service::did_exit(int exit_code)
|
|||
activate();
|
||||
}
|
||||
|
||||
Service::Service(const Core::ConfigFile& config, const StringView& name)
|
||||
Service::Service(const Core::ConfigFile& config, StringView name)
|
||||
: Core::Object(nullptr)
|
||||
{
|
||||
VERIFY(config.has_group(name));
|
||||
|
|
|
@ -27,7 +27,7 @@ public:
|
|||
void save_to(JsonObject&);
|
||||
|
||||
private:
|
||||
Service(const Core::ConfigFile&, const StringView& name);
|
||||
Service(const Core::ConfigFile&, StringView name);
|
||||
|
||||
void spawn(int socket_fd = -1);
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ void TaskbarButton::resize_event(GUI::ResizeEvent& event)
|
|||
return GUI::Button::resize_event(event);
|
||||
}
|
||||
|
||||
static void paint_custom_progressbar(GUI::Painter& painter, const Gfx::IntRect& rect, const Gfx::IntRect& text_rect, const Palette& palette, int min, int max, int value, const StringView& text, const Gfx::Font& font, Gfx::TextAlignment text_alignment)
|
||||
static void paint_custom_progressbar(GUI::Painter& painter, const Gfx::IntRect& rect, const Gfx::IntRect& text_rect, const Palette& palette, int min, int max, int value, StringView text, const Gfx::Font& font, Gfx::TextAlignment text_alignment)
|
||||
{
|
||||
float range_size = max - min;
|
||||
float progress = (value - min) / range_size;
|
||||
|
|
|
@ -25,7 +25,7 @@ Client::Client(int id, RefPtr<Core::TCPSocket> socket, int ptm_fd)
|
|||
m_socket->on_ready_to_read = [this] { drain_socket(); };
|
||||
m_ptm_notifier->on_ready_to_read = [this] { drain_pty(); };
|
||||
m_parser.on_command = [this](const Command& command) { handle_command(command); };
|
||||
m_parser.on_data = [this](const StringView& data) { handle_data(data); };
|
||||
m_parser.on_data = [this](StringView data) { handle_data(data); };
|
||||
m_parser.on_error = [this]() { handle_error(); };
|
||||
send_commands({
|
||||
{ CMD_WILL, SUB_SUPPRESS_GO_AHEAD },
|
||||
|
@ -66,7 +66,7 @@ void Client::drain_pty()
|
|||
send_data(StringView(buffer, (size_t)nread));
|
||||
}
|
||||
|
||||
void Client::handle_data(const StringView& data)
|
||||
void Client::handle_data(StringView data)
|
||||
{
|
||||
write(m_ptm_fd, data.characters_without_null_termination(), data.length());
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ protected:
|
|||
|
||||
void drain_socket();
|
||||
void drain_pty();
|
||||
void handle_data(const StringView&);
|
||||
void handle_data(StringView);
|
||||
void handle_command(const Command& command);
|
||||
void handle_error();
|
||||
void send_data(StringView str);
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
#include "Parser.h"
|
||||
|
||||
void Parser::write(const StringView& data)
|
||||
void Parser::write(StringView data)
|
||||
{
|
||||
for (size_t i = 0; i < data.length(); i++) {
|
||||
u8 ch = data[i];
|
||||
|
|
|
@ -18,10 +18,10 @@
|
|||
class Parser {
|
||||
public:
|
||||
Function<void(const Command&)> on_command;
|
||||
Function<void(const StringView&)> on_data;
|
||||
Function<void(StringView)> on_data;
|
||||
Function<void()> on_error;
|
||||
|
||||
void write(const StringView&);
|
||||
void write(StringView);
|
||||
|
||||
protected:
|
||||
enum State {
|
||||
|
|
|
@ -33,7 +33,7 @@ NonnullRefPtr<Cursor> Cursor::create(NonnullRefPtr<Gfx::Bitmap>&& bitmap, int sc
|
|||
return adopt_ref(*new Cursor(move(bitmap), scale_factor, Gfx::CursorParams(hotspot)));
|
||||
}
|
||||
|
||||
RefPtr<Cursor> Cursor::create(const StringView& filename, const StringView& default_filename)
|
||||
RefPtr<Cursor> Cursor::create(StringView filename, StringView default_filename)
|
||||
{
|
||||
auto cursor = adopt_ref(*new Cursor());
|
||||
if (cursor->load(filename, default_filename))
|
||||
|
@ -41,11 +41,11 @@ RefPtr<Cursor> Cursor::create(const StringView& filename, const StringView& defa
|
|||
return {};
|
||||
}
|
||||
|
||||
bool Cursor::load(const StringView& filename, const StringView& default_filename)
|
||||
bool Cursor::load(StringView filename, StringView default_filename)
|
||||
{
|
||||
bool did_load_any = false;
|
||||
|
||||
auto load_bitmap = [&](const StringView& path, int scale_factor) {
|
||||
auto load_bitmap = [&](StringView path, int scale_factor) {
|
||||
auto bitmap_or_error = Gfx::Bitmap::try_load_from_file(path, scale_factor);
|
||||
if (bitmap_or_error.is_error())
|
||||
return;
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace WindowServer {
|
|||
|
||||
class Cursor : public RefCounted<Cursor> {
|
||||
public:
|
||||
static RefPtr<Cursor> create(const StringView&, const StringView&);
|
||||
static RefPtr<Cursor> create(StringView, StringView);
|
||||
static NonnullRefPtr<Cursor> create(NonnullRefPtr<Gfx::Bitmap>&&, int);
|
||||
static RefPtr<Cursor> create(Gfx::StandardCursor);
|
||||
~Cursor() = default;
|
||||
|
@ -49,7 +49,7 @@ private:
|
|||
Cursor() { }
|
||||
Cursor(NonnullRefPtr<Gfx::Bitmap>&&, int, const Gfx::CursorParams&);
|
||||
|
||||
bool load(const StringView&, const StringView&);
|
||||
bool load(StringView, StringView);
|
||||
void update_rect_if_animated();
|
||||
|
||||
HashMap<int, NonnullRefPtr<Gfx::Bitmap>> m_bitmaps;
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
namespace WindowServer {
|
||||
|
||||
u32 find_ampersand_shortcut_character(const StringView& string)
|
||||
u32 find_ampersand_shortcut_character(StringView string)
|
||||
{
|
||||
Utf8View utf8_view { string };
|
||||
for (auto it = utf8_view.begin(); it != utf8_view.end(); ++it) {
|
||||
|
|
|
@ -164,6 +164,6 @@ private:
|
|||
HashMap<u32, Vector<size_t>> m_alt_shortcut_character_to_item_indices;
|
||||
};
|
||||
|
||||
u32 find_ampersand_shortcut_character(const StringView&);
|
||||
u32 find_ampersand_shortcut_character(StringView);
|
||||
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ RefPtr<MultiScaleBitmaps> MultiScaleBitmaps::create_empty()
|
|||
return adopt_ref(*new MultiScaleBitmaps());
|
||||
}
|
||||
|
||||
RefPtr<MultiScaleBitmaps> MultiScaleBitmaps::create(StringView const& filename, StringView const& default_filename)
|
||||
RefPtr<MultiScaleBitmaps> MultiScaleBitmaps::create(StringView filename, StringView default_filename)
|
||||
{
|
||||
auto per_scale_bitmap = adopt_ref(*new MultiScaleBitmaps());
|
||||
if (per_scale_bitmap->load(filename, default_filename))
|
||||
|
@ -44,14 +44,14 @@ RefPtr<MultiScaleBitmaps> MultiScaleBitmaps::create(StringView const& filename,
|
|||
return {};
|
||||
}
|
||||
|
||||
bool MultiScaleBitmaps::load(StringView const& filename, StringView const& default_filename)
|
||||
bool MultiScaleBitmaps::load(StringView filename, StringView default_filename)
|
||||
{
|
||||
Optional<Gfx::BitmapFormat> bitmap_format;
|
||||
bool did_load_any = false;
|
||||
|
||||
m_bitmaps.clear(); // If we're reloading the bitmaps get rid of the old ones
|
||||
|
||||
auto add_bitmap = [&](StringView const& path, int scale_factor) {
|
||||
auto add_bitmap = [&](StringView path, int scale_factor) {
|
||||
auto bitmap_or_error = Gfx::Bitmap::try_load_from_file(path, scale_factor);
|
||||
if (bitmap_or_error.is_error())
|
||||
return;
|
||||
|
|
|
@ -16,13 +16,13 @@ namespace WindowServer {
|
|||
class MultiScaleBitmaps : public RefCounted<MultiScaleBitmaps> {
|
||||
public:
|
||||
static RefPtr<MultiScaleBitmaps> create_empty();
|
||||
static RefPtr<MultiScaleBitmaps> create(StringView const& filename, StringView const& default_filename = {});
|
||||
static RefPtr<MultiScaleBitmaps> create(StringView filename, StringView default_filename = {});
|
||||
|
||||
Gfx::Bitmap const& default_bitmap() const { return bitmap(1); }
|
||||
Gfx::Bitmap const& bitmap(int scale_factor) const;
|
||||
Gfx::Bitmap const* find_bitmap(int scale_factor) const;
|
||||
Gfx::BitmapFormat format() const { return m_format; }
|
||||
bool load(StringView const& filename, StringView const& default_filename = {});
|
||||
bool load(StringView filename, StringView default_filename = {});
|
||||
void add_bitmap(int scale_factor, NonnullRefPtr<Gfx::Bitmap>&&);
|
||||
|
||||
private:
|
||||
|
|
|
@ -125,7 +125,7 @@ void WindowFrame::reload_config()
|
|||
{
|
||||
String icons_path = WindowManager::the().palette().title_button_icons_path();
|
||||
|
||||
auto reload_icon = [&](RefPtr<MultiScaleBitmaps>& icon, StringView const& path, StringView const& default_path) {
|
||||
auto reload_icon = [&](RefPtr<MultiScaleBitmaps>& icon, StringView path, StringView default_path) {
|
||||
StringBuilder full_path;
|
||||
full_path.append(icons_path);
|
||||
full_path.append(path);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue