Changeset 755
- Timestamp:
- 03/14/18 23:52:40 (7 years ago)
- Location:
- cpp/frams
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
cpp/frams/_demos/paramtree_print.cpp
r723 r755 20 20 #endif 21 21 22 static void printLines(ParamTree:: Node *n, bool first = true)22 static void printLines(ParamTree::ParamTreeNode *n, bool first = true) 23 23 { 24 24 if (n->parent) … … 29 29 } 30 30 31 void printTree(ParamTree:: Node *n)31 void printTree(ParamTree::ParamTreeNode *n) 32 32 { 33 33 while (n != NULL) -
cpp/frams/_demos/paramtree_print.h
r723 r755 4 4 #include <frams/param/paramtree.h> 5 5 6 void printTree(ParamTree:: Node *n);6 void printTree(ParamTree::ParamTreeNode *n); 7 7 8 8 #endif -
cpp/frams/param/paramtree.cpp
r744 r755 5 5 #include "paramtree.h" 6 6 7 ParamTree:: Node *ParamTree::addNode(ParamTree::Node* parent, const string& name, int group)7 ParamTree::ParamTreeNode *ParamTree::addNode(ParamTree::ParamTreeNode* parent, const string& name, int group) 8 8 { 9 std::shared_ptr< Node> new_it(newNode(this, parent, name, group));10 Node *last = parent->first_child.get();9 std::shared_ptr<ParamTreeNode> new_it(new ParamTreeNode(this, parent, name, group)); 10 ParamTreeNode *last = parent->first_child.get(); 11 11 if (last) 12 12 { 13 Node *next;13 ParamTreeNode *next; 14 14 while (true) 15 15 { … … 25 25 } 26 26 27 ParamTree:: Node *ParamTree::findNode(ParamTree::Node *parent, const string& name)27 ParamTree::ParamTreeNode *ParamTree::findNode(ParamTree::ParamTreeNode *parent, const string& name) 28 28 { 29 for (ParamTree:: Node *it = parent->first_child.get(); it != NULL; it = it->next_sibling.get())29 for (ParamTree::ParamTreeNode *it = parent->first_child.get(); it != NULL; it = it->next_sibling.get()) 30 30 if (it->name == name) return it; 31 31 return NULL; … … 58 58 59 59 string name = grname; // "abc:def:ghi" 60 Node *parentnode = &root;60 ParamTreeNode *parentnode = &root; 61 61 int i = 0; 62 62 // search for parentnode for level 'level' … … 67 67 string prefix = name.substr(0, i); 68 68 // search for parent node in listview ('prefix') 69 Node *it = findNode(parentnode, prefix);69 ParamTreeNode *it = findNode(parentnode, prefix); 70 70 name = name.substr(i + 1); 71 71 if (it) parentnode = it; -
cpp/frams/param/paramtree.h
r744 r755 35 35 { 36 36 public: 37 class Node;38 typedef std::shared_ptr< Node> NodePtr;39 class Node37 class ParamTreeNode; 38 typedef std::shared_ptr<ParamTreeNode> NodePtr; 39 class ParamTreeNode 40 40 { 41 41 public: 42 42 ParamTree *tree; 43 Node *parent;43 ParamTreeNode *parent; 44 44 string name; //path component name 45 45 int group_index; //original group index or -1 for dummy nodes … … 47 47 NodePtr next_sibling; 48 48 49 Node(ParamTree *_tree = NULL,Node *_parent = NULL, const string &_name = "", int _group_index = -1)49 ParamTreeNode(ParamTree *_tree = NULL, ParamTreeNode *_parent = NULL, const string &_name = "", int _group_index = -1) 50 50 :tree(_tree), parent(_parent), name(_name), group_index(_group_index) {} 51 51 }; 52 Node root;52 ParamTreeNode root; 53 53 ParamInterface π 54 54 55 Node *addNode(Node* parent, const string &name, int group);56 Node *findNode(Node *parent, const string& name);55 ParamTreeNode *addNode(ParamTreeNode* parent, const string &name, int group); 56 ParamTreeNode *findNode(ParamTreeNode *parent, const string& name); 57 57 58 58 ParamTree(ParamInterface *_pi);
Note: See TracChangeset
for help on using the changeset viewer.