From 804679db852b13664ca351e0ee302cc70e96bf67 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Fri, 19 Jun 2020 16:42:22 +0200 Subject: Recursively create a nodes subtree when being created as consequence of a move command. --- src/message.h | 53 ++++++++++++++++++++++++++++------------------------- 1 file changed, 28 insertions(+), 25 deletions(-) (limited to 'src/message.h') diff --git a/src/message.h b/src/message.h index d5e0590..3a6afdc 100644 --- a/src/message.h +++ b/src/message.h @@ -29,12 +29,12 @@ #include #include +#include #include "node.h" -namespace cmd +enum class cmd { -typedef enum { login, logout, subscribe, @@ -45,58 +45,63 @@ typedef enum { move, update, error, -} cmd_t; }; -typedef struct +using cmd_t = cmd; + +struct login_t { std::string user; std::string password; -} login_t; +}; -typedef struct +struct logout_t { -} logout_t; +}; -typedef struct +struct subscribe_t { nodeid_t id; -} subscribe_t; +}; -typedef struct +struct unsubscribe_t { nodeid_t id; -} unsubscribe_t; +}; -typedef struct +struct create_t { nodeid_t id; nodeid_t parentid; nodeid_t insertbeforeid; -} create_t; -typedef struct + // for create_with_attributes + std::map attributes; + std::vector children; +}; + +struct remove_t { nodeid_t id; -} remove_t; +}; -typedef struct +struct move_t { nodeid_t id; nodeid_t parentid; nodeid_t insertbeforeid; -} move_t; +}; -typedef struct +struct update_t { nodeid_t id; std::string attribute; std::string value; -} update_t; +}; -typedef struct +struct message_t { - cmd::cmd_t cmd; + cmd_t cmd; login_t login; logout_t logout; @@ -107,13 +112,11 @@ typedef struct move_t move; update_t update; - std::map attributes; // for create_with_attributes - NodeIdList nodes; // target node id (subscription node id) used for transmissions only. nodeid_t tid; -} message_t; +}; -typedef std::list MessageList; +using MessageList = std::list; -- cgit v1.2.3