summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibChess
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2022-12-06 01:12:49 +0000
committerAndreas Kling <kling@serenityos.org>2022-12-06 08:54:33 +0100
commit57dc179b1fce5d4b7171311b04667debfe693095 (patch)
treea459d1aef92dc4e49bbf03b32621b1e7e30d4e64 /Userland/Libraries/LibChess
parent6e19ab2bbce0b113b628e6f8e9b5c0640053933e (diff)
downloadserenity-57dc179b1fce5d4b7171311b04667debfe693095.zip
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.
Diffstat (limited to 'Userland/Libraries/LibChess')
-rw-r--r--Userland/Libraries/LibChess/Chess.cpp6
-rw-r--r--Userland/Libraries/LibChess/Chess.h4
-rw-r--r--Userland/Libraries/LibChess/UCICommand.cpp26
-rw-r--r--Userland/Libraries/LibChess/UCICommand.h26
-rw-r--r--Userland/Libraries/LibChess/UCIEndpoint.cpp4
5 files changed, 33 insertions, 33 deletions
diff --git a/Userland/Libraries/LibChess/Chess.cpp b/Userland/Libraries/LibChess/Chess.cpp
index d7a5edf4b3..53aeee2501 100644
--- a/Userland/Libraries/LibChess/Chess.cpp
+++ b/Userland/Libraries/LibChess/Chess.cpp
@@ -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:
diff --git a/Userland/Libraries/LibChess/Chess.h b/Userland/Libraries/LibChess/Chess.h
index fd9501e156..abff2180f9 100644
--- a/Userland/Libraries/LibChess/Chess.h
+++ b/Userland/Libraries/LibChess/Chess.h
@@ -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;
diff --git a/Userland/Libraries/LibChess/UCICommand.cpp b/Userland/Libraries/LibChess/UCICommand.cpp
index 7cad448658..3553ca3b69 100644
--- a/Userland/Libraries/LibChess/UCICommand.cpp
+++ b/Userland/Libraries/LibChess/UCICommand.cpp
@@ -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();
diff --git a/Userland/Libraries/LibChess/UCICommand.h b/Userland/Libraries/LibChess/UCICommand.h
index ef2f8f0e5e..f75d22308c 100644
--- a/Userland/Libraries/LibChess/UCICommand.h
+++ b/Userland/Libraries/LibChess/UCICommand.h
@@ -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;
diff --git a/Userland/Libraries/LibChess/UCIEndpoint.cpp b/Userland/Libraries/LibChess/UCIEndpoint.cpp
index 832290403a..286adaa409 100644
--- a/Userland/Libraries/LibChess/UCIEndpoint.cpp
+++ b/Userland/Libraries/LibChess/UCIEndpoint.cpp
@@ -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)