diff options
Diffstat (limited to 'src/command.cpp')
| -rw-r--r-- | src/command.cpp | 39 |
1 files changed, 19 insertions, 20 deletions
diff --git a/src/command.cpp b/src/command.cpp index 6831d5e..76cdee7 100644 --- a/src/command.cpp +++ b/src/command.cpp @@ -2,47 +2,46 @@ namespace wanda { - -std::optional<message> command::message() const -{ + std::optional<message> command::message() const + { using namespace std::string_literals; auto const command = [this] { - switch (id) - { + switch (id) + { case command_id::change: - return "CHANGE"s; + return "CHANGE"s; default: - return ""s; - } + return ""s; + } }(); auto argument_string = std::string{}; for (int index = 0ul; index < arguments.size(); ++index) { - argument_string += (index) ? "," + arguments[index] : arguments[index]; + argument_string += (index) ? "," + arguments[index] : arguments[index]; } if (command.empty()) { - return std::nullopt; + return std::nullopt; } return wanda::message{"C", command, argument_string}; -} + } -std::optional<command> make_command(message message) -{ - if(message.command == "CHANGE") + std::optional<command> make_command(message message) + { + if (message.command == "CHANGE") { - return {{command_id::change}}; + return {{command_id::change}}; } return std::nullopt; -} + } -command make_change_command() -{ + command make_change_command() + { return {command_id::change}; -} + } -} // namespace wanda
\ No newline at end of file +} // namespace wanda
\ No newline at end of file |
