1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 06:17: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

@ -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;

View file

@ -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;

View file

@ -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) {

View file

@ -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);
}

View file

@ -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;

View file

@ -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:

View file

@ -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);