From 75d85549c6d2a5284593e20c21d61fc5d6200bca Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Mon, 8 Jun 2020 18:24:49 +0200 Subject: Add 'insert before id' to create and move commands. --- src/nodemanager.cc | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src/nodemanager.cc') diff --git a/src/nodemanager.cc b/src/nodemanager.cc index 32a93b4..8c7cb56 100644 --- a/src/nodemanager.cc +++ b/src/nodemanager.cc @@ -81,23 +81,23 @@ void NodeManager::init(std::string filename) t.attributes["title"] = "root"; t.id = ROOT_ID; - tree.insertAsChild(0, ROOT_ID, t); + tree.insertAsChild(0, ROOT_ID, t, -1); t.attributes["title"] = "Finished"; t.id = FINISHED_ID; - tree.insertAsChild(ROOT_ID, FINISHED_ID, t); + tree.insertAsChild(ROOT_ID, FINISHED_ID, t, -1); t.attributes["title"] = "Backlog"; t.id = BACKLOG_ID; - tree.insertAsChild(ROOT_ID, BACKLOG_ID, t); + tree.insertAsChild(ROOT_ID, BACKLOG_ID, t, -1); t.attributes["title"] = "Lost+Found"; t.id = LOSTFOUND_ID; - tree.insertAsChild(ROOT_ID, LOSTFOUND_ID, t); + tree.insertAsChild(ROOT_ID, LOSTFOUND_ID, t, -1); t.attributes["title"] = "Projects"; t.id = PROJECTS_ID; - tree.insertAsChild(ROOT_ID, PROJECTS_ID, t); + tree.insertAsChild(ROOT_ID, PROJECTS_ID, t, -1); } tree.toStdOut(); @@ -113,7 +113,7 @@ nodeid_t NodeManager::createId() return tree.createId(); } -NodeIdListPair NodeManager::moveNode(nodeid_t id, nodeid_t to) +NodeIdListPair NodeManager::moveNode(nodeid_t id, nodeid_t to, nodeid_t beforeId) throw (std::exception) { if(isProtected(id)) @@ -145,7 +145,7 @@ NodeIdListPair NodeManager::moveNode(nodeid_t id, nodeid_t to) ancestors = tree.ancestorList(to); tilcreate.insert(tilcreate.end(), ancestors.begin(), ancestors.end()); - tree.move(id, to); + tree.move(id, to, beforeId); NodeIdListPair tilpair; tilpair.first = tilremove; @@ -210,7 +210,7 @@ NodeIdList NodeManager::updateNode(nodeid_t id, const std::string &name, return affectedNodes; } -NodeIdList NodeManager::createNode(nodeid_t parentid, nodeid_t *pid) +NodeIdList NodeManager::createNode(nodeid_t parentid, nodeid_t *pid, nodeid_t insertbeforeid) throw (std::exception) { NodeIdList affectedNodes; @@ -226,7 +226,7 @@ NodeIdList NodeManager::createNode(nodeid_t parentid, nodeid_t *pid) try { - affectedNodes = tree.insertAsChild(parentid, id, t); + affectedNodes = tree.insertAsChild(parentid, id, t, insertbeforeid); } catch(std::exception& e) { -- cgit v1.2.3