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/messageparser.cc | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'src/messageparser.cc') diff --git a/src/messageparser.cc b/src/messageparser.cc index 0f1844e..7393c5c 100644 --- a/src/messageparser.cc +++ b/src/messageparser.cc @@ -352,13 +352,28 @@ std::vector msg_tostring(message_t m) std::to_string(m.create.parentid) + " " + std::to_string(m.create.insertbeforeid) + ";"; msgs.push_back(msg); - for(const auto& attribute : m.attributes) + for(const auto& attribute : m.create.attributes) { msg = "update " + std::to_string(m.create.id) + " \"" + attribute.first + "\" \"" + attribute.second + "\";"; msgs.push_back(msg); } + for(const auto &child : m.create.children) + { + msg = "create " + + std::to_string(child.id) + " " + + std::to_string(child.parentid) + " " + + std::to_string(child.insertbeforeid) + ";"; + msgs.push_back(msg); + for(const auto& attribute : child.attributes) + { + msg = "update " + + std::to_string(child.id) + " \"" + + attribute.first + "\" \"" + attribute.second + "\";"; + msgs.push_back(msg); + } + } break; case cmd::remove: msg = "remove " + std::to_string(m.remove.id) + ";"; -- cgit v1.2.3