mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-23 18:02:05 -05:00
1682f0b760
SPDX License Identifiers are a more compact / standardized way of representing file license information. See: https://spdx.dev/resources/use/#identifiers This was done with the `ambr` search and replace tool. ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
60 lines
1.5 KiB
C++
60 lines
1.5 KiB
C++
/*
|
|
* Copyright (c) 2020, the SerenityOS developers.
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <LibChess/UCICommand.h>
|
|
#include <LibCore/IODevice.h>
|
|
#include <LibCore/Notifier.h>
|
|
#include <LibCore/Object.h>
|
|
|
|
namespace Chess::UCI {
|
|
|
|
class Endpoint : public Core::Object {
|
|
C_OBJECT(Endpoint)
|
|
public:
|
|
virtual ~Endpoint() override { }
|
|
|
|
Endpoint() { }
|
|
Endpoint(NonnullRefPtr<Core::IODevice> in, NonnullRefPtr<Core::IODevice> out);
|
|
|
|
virtual void handle_uci() { }
|
|
virtual void handle_debug(const DebugCommand&) { }
|
|
virtual void handle_isready() { }
|
|
virtual void handle_setoption(const SetOptionCommand&) { }
|
|
virtual void handle_position(const PositionCommand&) { }
|
|
virtual void handle_go(const GoCommand&) { }
|
|
virtual void handle_stop() { }
|
|
virtual void handle_id(const IdCommand&) { }
|
|
virtual void handle_uciok() { }
|
|
virtual void handle_readyok() { }
|
|
virtual void handle_bestmove(const BestMoveCommand&) { }
|
|
virtual void handle_info(const InfoCommand&) { }
|
|
|
|
void send_command(const Command&);
|
|
|
|
virtual void event(Core::Event&);
|
|
|
|
Core::IODevice& in() { return *m_in; }
|
|
Core::IODevice& out() { return *m_out; }
|
|
|
|
void set_in(RefPtr<Core::IODevice> in)
|
|
{
|
|
m_in = in;
|
|
set_in_notifier();
|
|
}
|
|
void set_out(RefPtr<Core::IODevice> out) { m_out = out; }
|
|
|
|
private:
|
|
void set_in_notifier();
|
|
NonnullOwnPtr<Command> read_command();
|
|
|
|
RefPtr<Core::IODevice> m_in;
|
|
RefPtr<Core::IODevice> m_out;
|
|
RefPtr<Core::Notifier> m_in_notifier;
|
|
};
|
|
|
|
}
|