mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 17:27:46 +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
|
@ -366,7 +366,7 @@ void ChessWidget::keydown_event(GUI::KeyEvent& event)
|
|||
|
||||
static String set_path = String("/res/icons/chess/sets/");
|
||||
|
||||
static RefPtr<Gfx::Bitmap> get_piece(const StringView& set, const StringView& image)
|
||||
static RefPtr<Gfx::Bitmap> get_piece(StringView set, StringView image)
|
||||
{
|
||||
StringBuilder builder;
|
||||
builder.append(set_path);
|
||||
|
@ -376,7 +376,7 @@ static RefPtr<Gfx::Bitmap> get_piece(const StringView& set, const StringView& im
|
|||
return Gfx::Bitmap::try_load_from_file(builder.build()).release_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
|
||||
void ChessWidget::set_piece_set(const StringView& set)
|
||||
void ChessWidget::set_piece_set(StringView set)
|
||||
{
|
||||
m_piece_set = set;
|
||||
m_pieces.set({ Chess::Color::White, Chess::Type::Pawn }, get_piece(set, "white-pawn.png"));
|
||||
|
@ -427,7 +427,7 @@ void ChessWidget::reset()
|
|||
update();
|
||||
}
|
||||
|
||||
void ChessWidget::set_board_theme(const StringView& name)
|
||||
void ChessWidget::set_board_theme(StringView name)
|
||||
{
|
||||
// FIXME: Add some kind of themes.json
|
||||
// The following Colors have been taken from lichess.org, but i'm pretty sure they took them from chess.com.
|
||||
|
@ -520,7 +520,7 @@ String ChessWidget::get_fen() const
|
|||
return m_playback ? m_board_playback.to_fen() : m_board.to_fen();
|
||||
}
|
||||
|
||||
bool ChessWidget::import_pgn(const StringView& import_path)
|
||||
bool ChessWidget::import_pgn(StringView import_path)
|
||||
{
|
||||
auto file_or_error = Core::File::open(import_path, Core::OpenMode::ReadOnly);
|
||||
if (file_or_error.is_error()) {
|
||||
|
@ -625,7 +625,7 @@ bool ChessWidget::import_pgn(const StringView& import_path)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool ChessWidget::export_pgn(const StringView& export_path) const
|
||||
bool ChessWidget::export_pgn(StringView export_path) const
|
||||
{
|
||||
auto file_or_error = Core::File::open(export_path, Core::OpenMode::WriteOnly);
|
||||
if (file_or_error.is_error()) {
|
||||
|
|
|
@ -35,7 +35,7 @@ public:
|
|||
Chess::Color side() const { return m_side; };
|
||||
void set_side(Chess::Color side) { m_side = side; };
|
||||
|
||||
void set_piece_set(const StringView& set);
|
||||
void set_piece_set(StringView set);
|
||||
const String& piece_set() const { return m_piece_set; };
|
||||
|
||||
Chess::Square mouse_to_square(GUI::MouseEvent& event) const;
|
||||
|
@ -48,8 +48,8 @@ public:
|
|||
void set_show_available_moves(bool e) { m_show_available_moves = e; }
|
||||
|
||||
String get_fen() const;
|
||||
bool import_pgn(const StringView& import_path);
|
||||
bool export_pgn(const StringView& export_path) const;
|
||||
bool import_pgn(StringView import_path);
|
||||
bool export_pgn(StringView export_path) const;
|
||||
|
||||
int resign();
|
||||
void flip_board();
|
||||
|
@ -63,7 +63,7 @@ public:
|
|||
|
||||
const BoardTheme& board_theme() const { return m_board_theme; }
|
||||
void set_board_theme(const BoardTheme& theme) { m_board_theme = theme; }
|
||||
void set_board_theme(const StringView& name);
|
||||
void set_board_theme(StringView name);
|
||||
|
||||
enum class PlaybackDirection {
|
||||
First,
|
||||
|
|
|
@ -17,7 +17,7 @@ Engine::~Engine()
|
|||
kill(m_pid, SIGINT);
|
||||
}
|
||||
|
||||
Engine::Engine(const StringView& command)
|
||||
Engine::Engine(StringView command)
|
||||
{
|
||||
int wpipefds[2];
|
||||
int rpipefds[2];
|
||||
|
|
|
@ -15,7 +15,7 @@ class Engine : public Chess::UCI::Endpoint {
|
|||
public:
|
||||
virtual ~Engine() override;
|
||||
|
||||
Engine(const StringView& command);
|
||||
Engine(StringView command);
|
||||
|
||||
Engine(const Engine&) = delete;
|
||||
Engine& operator=(const Engine&) = delete;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue