Zappy Server
C++ game server: world, rules, scheduler, network
Loading...
Searching...
No Matches
GuiParser.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <optional>
4#include <string>
5#include <string_view>
6#include <variant>
7
17namespace Gui {
18 struct Msz {};
19 struct Bct {
20 int x, y;
21 };
22 struct Mct {};
23 struct Tna {};
24 struct Ppo {
25 int id;
26 };
27 struct Plv {
28 int id;
29 };
30 struct Pin {
31 int id;
32 };
33 struct Sgt {};
34 struct Sst {
35 int freq;
36 };
37 struct Stu {};
38
39 using Request = std::variant<Msz, Bct, Mct, Tna, Ppo, Plv, Pin, Sgt, Sst, Stu>;
40} // namespace Gui
41
50class GuiParser {
51 public:
56 static std::optional<Gui::Request> parse(std::string_view line);
57};
Parses a raw GUI client line into a typed Gui::Request.
Definition GuiParser.hpp:50
static std::optional< Gui::Request > parse(std::string_view line)
Parse one line from a GUI client (no trailing newline).
Definition GuiParser.cpp:14
Typed structs for the GUI client request commands.
Definition GuiParser.hpp:17
std::variant< Msz, Bct, Mct, Tna, Ppo, Plv, Pin, Sgt, Sst, Stu > Request
Definition GuiParser.hpp:39