diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2020-06-19 16:42:22 +0200 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2020-06-19 16:42:22 +0200 |
commit | 804679db852b13664ca351e0ee302cc70e96bf67 (patch) | |
tree | 1b13eefc5f8f49dd30d277ccf5974a50e037e610 /src/messageparser.cc | |
parent | e70410eabf0115819624acd5ca1bd6fb24150887 (diff) |
Recursively create a nodes subtree when being created as consequence of a move command.
Diffstat (limited to 'src/messageparser.cc')
-rw-r--r-- | src/messageparser.cc | 17 |
1 files changed, 16 insertions, 1 deletions
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<std::string> 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) + ";"; |