test debugger commands

This commit is contained in:
MihailRis
2025-10-06 01:54:35 +03:00
parent 44bf4a2f9e
commit 3fef284a02
4 changed files with 133 additions and 9 deletions
+28 -4
View File
@@ -3,14 +3,38 @@
#include <memory>
#include <string>
#include "typedefs.hpp"
namespace network {
class Server;
class Connection;
class ReadableConnection;
class Network;
}
namespace dv {
class value;
}
class Engine;
namespace devtools {
class ClientConnection {
public:
ClientConnection(network::Network& network, u64id_t connection)
: network(network), connection(connection) {
}
~ClientConnection();
std::string read();
void send(const dv::value& message);
void sendResponse(const std::string& type);
private:
network::Network& network;
size_t messageLength = 0;
u64id_t connection;
};
class DebuggingServer {
public:
DebuggingServer(Engine& engine, const std::string& serverString);
@@ -18,12 +42,12 @@ namespace devtools {
bool update();
void setClient(network::Connection& client) {
this->client = &client;
}
void setClient(u64id_t client);
private:
Engine& engine;
network::Server& server;
network::Connection* client;
std::unique_ptr<ClientConnection> connection;
bool performCommand(const std::string& type, const dv::value& map);
};
}