35 STRINGS[
static_cast<uint8_t
>(code)];
57 const std::string &msg)
63 const std::string &msg)
70 bool escaping =
false;
77 bool is_escaper = c ==
'"' || c ==
'\'' || c ==
'\\';
78 if (isspace(c) || is_escaper) escaping =
true;
84 escaped += (c ==
'\'') ? R
"('\'')" : std::string(1, c); 89 if (escaping)
return "'" + escaped +
"'";
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.
virtual void Respond(size_t id, const Response &response) const
Outputs a response.
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.
Response(const std::string &tag, Response::Code code)
Constructs a Response with no arguments.
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.
Declaration of classes pertaining to responses to the client.
Response & AddArg(const std::string &arg)
Adds an argument to this Response.
Code
Enumeration of all possible response codes.
static Response Invalid(const std::string &tag, const std::string &msg)
Shortcut for constructing a final response to a invalid request.