aboutsummaryrefslogtreecommitdiff
path: root/source/lib/include/wanda/message.hpp
diff options
context:
space:
mode:
authorFelix Morgner <felix.morgner@gmail.com>2023-08-17 12:32:50 +0200
committerFelix Morgner <felix.morgner@gmail.com>2023-08-17 12:32:50 +0200
commit375799fa79d1af76f33299acc20a11a167a021f8 (patch)
tree8f91b982ec96225c33a2f4871730ababffe5cab0 /source/lib/include/wanda/message.hpp
parentaf471b9b780869915d3217b228e24d025892de47 (diff)
downloadwanda-375799fa79d1af76f33299acc20a11a167a021f8.tar.xz
wanda-375799fa79d1af76f33299acc20a11a167a021f8.zip
project: restructure libraries and build env
Diffstat (limited to 'source/lib/include/wanda/message.hpp')
-rw-r--r--source/lib/include/wanda/message.hpp93
1 files changed, 0 insertions, 93 deletions
diff --git a/source/lib/include/wanda/message.hpp b/source/lib/include/wanda/message.hpp
deleted file mode 100644
index 0f3034c..0000000
--- a/source/lib/include/wanda/message.hpp
+++ /dev/null
@@ -1,93 +0,0 @@
-/**
- * @file message.hpp
- * @author Felix Morgner (felix.morgner@gmail.com)
- * @since 1.0.0
- */
-
-#ifndef WANDA_MESSAGE_HPP
-#define WANDA_MESSAGE_HPP
-
-#include <cstddef>
-#include <istream>
-#include <optional>
-#include <string>
-#include <fmt/core.h>
-
-namespace wanda
-{
- inline namespace v1
- {
- /**
- * @brief The version argument for the hello message reflecting the current version
- */
- auto constexpr message_argument_hello = "1.0.0";
- } // namespace v1
-
- /**
- * @brief A tag to mark messages originating from the controller
- */
- auto constexpr message_source_controller = "C";
-
- /**
- * @brief A tag to mark messages originating from the daemon
- */
- auto constexpr message_source_daemon = "D";
-
- /**
- * @brief The command of the hello message
- */
- auto constexpr message_command_hello = "HELLO";
-
- /**
- * @brief A control protocol message, consisting of a @p source, @p command, and @p arguments
- */
- struct message
- {
- /**
- * @brief Serialize this message into a string
- */
- explicit operator std::string() const;
-
- /**
- * @brief Get the size of the message as if it was serialized
- */
- std::size_t size() const;
-
- /**
- * @brief The source of the message
- */
- std::string source;
-
- /**
- * @brief The command of the message
- */
- std::string command;
-
- /**
- * @brief The arguments of the message command
- */
- std::optional<std::string> argument;
- };
-
- /**
- * @brief Deserialize a message from the given stream
- */
- std::istream & operator>>(std::istream & in, message & message);
-
- /**
- * @brief Serialize a message to the given stream
- */
- std::ostream & operator<<(std::ostream & out, message const & message);
-
-} // namespace wanda
-
-template<>
-struct fmt::formatter<wanda::message> : fmt::formatter<std::string>
-{
- auto format(wanda::message const & message, format_context & context) const
- {
- return formatter<string_view>::format(static_cast<std::string>(message), context);
- }
-};
-
-#endif \ No newline at end of file