10 #ifndef PLAYD_IO_RESPONSE_HPP 11 #define PLAYD_IO_RESPONSE_HPP 35 enum class Code : std::uint8_t {
69 std::string
Pack()
const;
84 static Response Invalid(
const std::string &tag,
const std::string &msg);
92 static Response Failure(
const std::string &tag,
const std::string &msg);
100 static const std::array<std::string, CODE_COUNT>
STRINGS;
107 static std::string
EscapeArg(
const std::string &arg);
130 virtual void Respond(
size_t id,
const Response &response)
const;
133 #endif // PLAYD_IO_RESPONSE_HPP Declarations of the playd Error exception set.
std::string Pack() const
Packs the Response, converting it to a BAPS3 protocol message.
std::string string
The current packed form of the response.
static const std::array< std::string, CODE_COUNT > STRINGS
A map from Response::Code codes to their string equivalents.
static constexpr std::uint8_t CODE_COUNT
The number of codes, which should agree with Response::Code.
static const std::string NOREQUEST
The tag for unsolicited messages (not from responses).
static Response Success(const std::string &tag)
Shortcut for constructing a final response to a successful request.
Abstract class for anything that can be sent a response.
Response(const std::string &tag, Response::Code code)
Constructs a Response with no arguments.
The loaded file just changed.
The loaded file is playing.
The loaded file just ended.
The loaded file just ejected.
static Response Failure(const std::string &tag, const std::string &msg)
Shortcut for constructing a final response to a failed request.
static std::string EscapeArg(const std::string &arg)
Escapes a single response argument.
Response & AddArg(const std::string &arg)
Adds an argument to this Response.
Code
Enumeration of all possible response codes.
The loaded file has stopped.
Server sending current song time.
static Response Invalid(const std::string &tag, const std::string &msg)
Shortcut for constructing a final response to a invalid request.