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

Everywhere: Rename to_{string => deprecated_string}() where applicable

This will make it easier to support both string types at the same time
while we convert code, and tracking down remaining uses.

One big exception is Value::to_string() in LibJS, where the name is
dictated by the ToString AO.
This commit is contained in:
Linus Groh 2022-12-06 01:12:49 +00:00 committed by Andreas Kling
parent 6e19ab2bbc
commit 57dc179b1f
597 changed files with 1973 additions and 1972 deletions

View file

@ -333,7 +333,7 @@ DeprecatedString Board::to_fen() const
// 6. Fullmove number
builder.append(DeprecatedString::number(1 + m_moves.size() / 2));
return builder.to_string();
return builder.to_deprecated_string();
}
Piece Board::get_piece(Square const& square) const
@ -886,7 +886,7 @@ void Board::set_resigned(Chess::Color c)
m_resigned = c;
}
DeprecatedString Board::result_to_string(Result result, Color turn)
DeprecatedString Board::result_to_deprecated_string(Result result, Color turn)
{
switch (result) {
case Result::CheckMate:
@ -915,7 +915,7 @@ DeprecatedString Board::result_to_string(Result result, Color turn)
}
}
DeprecatedString Board::result_to_points(Result result, Color turn)
DeprecatedString Board::result_to_points_deprecated_string(Result result, Color turn)
{
switch (result) {
case Result::CheckMate:

View file

@ -145,8 +145,8 @@ public:
NotFinished,
};
static DeprecatedString result_to_string(Result, Color turn);
static DeprecatedString result_to_points(Result, Color turn);
static DeprecatedString result_to_deprecated_string(Result, Color turn);
static DeprecatedString result_to_points_deprecated_string(Result, Color turn);
template<typename Callback>
void generate_moves(Callback callback, Color color = Color::None) const;

View file

@ -17,7 +17,7 @@ UCICommand UCICommand::from_string(StringView command)
return UCICommand();
}
DeprecatedString UCICommand::to_string() const
DeprecatedString UCICommand::to_deprecated_string() const
{
return "uci\n";
}
@ -35,7 +35,7 @@ DebugCommand DebugCommand::from_string(StringView command)
VERIFY_NOT_REACHED();
}
DeprecatedString DebugCommand::to_string() const
DeprecatedString DebugCommand::to_deprecated_string() const
{
if (flag() == Flag::On) {
return "debug on\n";
@ -52,7 +52,7 @@ IsReadyCommand IsReadyCommand::from_string(StringView command)
return IsReadyCommand();
}
DeprecatedString IsReadyCommand::to_string() const
DeprecatedString IsReadyCommand::to_deprecated_string() const
{
return "isready\n";
}
@ -92,10 +92,10 @@ SetOptionCommand SetOptionCommand::from_string(StringView command)
VERIFY(!name.is_empty());
return SetOptionCommand(name.to_string().trim_whitespace(), value.to_string().trim_whitespace());
return SetOptionCommand(name.to_deprecated_string().trim_whitespace(), value.to_deprecated_string().trim_whitespace());
}
DeprecatedString SetOptionCommand::to_string() const
DeprecatedString SetOptionCommand::to_deprecated_string() const
{
StringBuilder builder;
builder.append("setoption name "sv);
@ -126,7 +126,7 @@ PositionCommand PositionCommand::from_string(StringView command)
return PositionCommand(fen, moves);
}
DeprecatedString PositionCommand::to_string() const
DeprecatedString PositionCommand::to_deprecated_string() const
{
StringBuilder builder;
builder.append("position "sv);
@ -190,7 +190,7 @@ GoCommand GoCommand::from_string(StringView command)
return go_command;
}
DeprecatedString GoCommand::to_string() const
DeprecatedString GoCommand::to_deprecated_string() const
{
StringBuilder builder;
builder.append("go"sv);
@ -238,7 +238,7 @@ StopCommand StopCommand::from_string(StringView command)
return StopCommand();
}
DeprecatedString StopCommand::to_string() const
DeprecatedString StopCommand::to_deprecated_string() const
{
return "stop\n";
}
@ -263,7 +263,7 @@ IdCommand IdCommand::from_string(StringView command)
VERIFY_NOT_REACHED();
}
DeprecatedString IdCommand::to_string() const
DeprecatedString IdCommand::to_deprecated_string() const
{
StringBuilder builder;
builder.append("id "sv);
@ -285,7 +285,7 @@ UCIOkCommand UCIOkCommand::from_string(StringView command)
return UCIOkCommand();
}
DeprecatedString UCIOkCommand::to_string() const
DeprecatedString UCIOkCommand::to_deprecated_string() const
{
return "uciok\n";
}
@ -298,7 +298,7 @@ ReadyOkCommand ReadyOkCommand::from_string(StringView command)
return ReadyOkCommand();
}
DeprecatedString ReadyOkCommand::to_string() const
DeprecatedString ReadyOkCommand::to_deprecated_string() const
{
return "readyok\n";
}
@ -311,7 +311,7 @@ BestMoveCommand BestMoveCommand::from_string(StringView command)
return BestMoveCommand(Move(tokens[1]));
}
DeprecatedString BestMoveCommand::to_string() const
DeprecatedString BestMoveCommand::to_deprecated_string() const
{
StringBuilder builder;
builder.append("bestmove "sv);
@ -326,7 +326,7 @@ InfoCommand InfoCommand::from_string([[maybe_unused]] StringView command)
VERIFY_NOT_REACHED();
}
DeprecatedString InfoCommand::to_string() const
DeprecatedString InfoCommand::to_deprecated_string() const
{
// FIXME: Implement this.
VERIFY_NOT_REACHED();

View file

@ -44,7 +44,7 @@ public:
{
}
virtual DeprecatedString to_string() const = 0;
virtual DeprecatedString to_deprecated_string() const = 0;
virtual ~Command() = default;
};
@ -58,7 +58,7 @@ public:
static UCICommand from_string(StringView command);
virtual DeprecatedString to_string() const override;
virtual DeprecatedString to_deprecated_string() const override;
};
class DebugCommand : public Command {
@ -76,7 +76,7 @@ public:
static DebugCommand from_string(StringView command);
virtual DeprecatedString to_string() const override;
virtual DeprecatedString to_deprecated_string() const override;
Flag flag() const { return m_flag; }
@ -93,7 +93,7 @@ public:
static IsReadyCommand from_string(StringView command);
virtual DeprecatedString to_string() const override;
virtual DeprecatedString to_deprecated_string() const override;
};
class SetOptionCommand : public Command {
@ -107,7 +107,7 @@ public:
static SetOptionCommand from_string(StringView command);
virtual DeprecatedString to_string() const override;
virtual DeprecatedString to_deprecated_string() const override;
DeprecatedString const& name() const { return m_name; }
Optional<DeprecatedString> const& value() const { return m_value; }
@ -128,7 +128,7 @@ public:
static PositionCommand from_string(StringView command);
virtual DeprecatedString to_string() const override;
virtual DeprecatedString to_deprecated_string() const override;
Optional<DeprecatedString> const& fen() const { return m_fen; }
Vector<Chess::Move> const& moves() const { return m_moves; }
@ -147,7 +147,7 @@ public:
static GoCommand from_string(StringView command);
virtual DeprecatedString to_string() const override;
virtual DeprecatedString to_deprecated_string() const override;
Optional<Vector<Chess::Move>> searchmoves;
bool ponder { false };
@ -172,7 +172,7 @@ public:
static StopCommand from_string(StringView command);
virtual DeprecatedString to_string() const override;
virtual DeprecatedString to_deprecated_string() const override;
};
class IdCommand : public Command {
@ -191,7 +191,7 @@ public:
static IdCommand from_string(StringView command);
virtual DeprecatedString to_string() const override;
virtual DeprecatedString to_deprecated_string() const override;
Type field_type() const { return m_field_type; }
DeprecatedString const& value() const { return m_value; }
@ -210,7 +210,7 @@ public:
static UCIOkCommand from_string(StringView command);
virtual DeprecatedString to_string() const override;
virtual DeprecatedString to_deprecated_string() const override;
};
class ReadyOkCommand : public Command {
@ -222,7 +222,7 @@ public:
static ReadyOkCommand from_string(StringView command);
virtual DeprecatedString to_string() const override;
virtual DeprecatedString to_deprecated_string() const override;
};
class BestMoveCommand : public Command {
@ -235,7 +235,7 @@ public:
static BestMoveCommand from_string(StringView command);
virtual DeprecatedString to_string() const override;
virtual DeprecatedString to_deprecated_string() const override;
Chess::Move move() const { return m_move; }
@ -252,7 +252,7 @@ public:
static InfoCommand from_string(StringView command);
virtual DeprecatedString to_string() const override;
virtual DeprecatedString to_deprecated_string() const override;
Optional<int> depth;
Optional<int> seldepth;

View file

@ -23,8 +23,8 @@ Endpoint::Endpoint(NonnullRefPtr<Core::IODevice> in, NonnullRefPtr<Core::IODevic
void Endpoint::send_command(Command const& command)
{
dbgln_if(UCI_DEBUG, "{} Sent UCI Command: {}", class_name(), DeprecatedString(command.to_string().characters(), Chomp));
m_out->write(command.to_string());
dbgln_if(UCI_DEBUG, "{} Sent UCI Command: {}", class_name(), DeprecatedString(command.to_deprecated_string().characters(), Chomp));
m_out->write(command.to_deprecated_string());
}
void Endpoint::event(Core::Event& event)