11 const std::string& identifier,
13 std::optional<irsol::types::protocol_value_t> body)
14 : identifier(utils::validateIdentifier(identifier)), source(source), body(body)
20 std::ostringstream oss;
26 oss <<
"<int> " << std::get<int>(*
body);
28 oss <<
"<double> " << std::get<double>(*
body);
30 oss <<
"<string> \"" << std::get<std::string>(*
body) <<
"\"";
40 return body.has_value();
45 return hasBody() && std::holds_alternative<int>(*
body);
50 return hasBody() && std::holds_alternative<double>(*
body);
55 return hasBody() && std::holds_alternative<std::string>(*
body);
constexpr const char * InMessageKindToString(InMessageKind kind)
Converts an InMessageKind enum to a human-readable string.
InMessageKind
Represents the type of an incoming message.
Utility functions for protocol string handling and validation in the irsol library.
std::string identifier
The identifier associated with the success response.
Success(const std::string &identifier, InMessageKind source, std::optional< irsol::types::protocol_value_t > body=std::nullopt)
std::string toString() const
Converts the success message to a human-readable string.
std::optional< irsol::types::protocol_value_t > body
Optional result or data associated with the response.
InMessageKind source
The kind of the incoming message that triggered this response.
Protocol success message representation.