Changeset 734
- Timestamp:
- 02/15/18 00:44:00 (7 years ago)
- Location:
- cpp/frams/param
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
cpp/frams/param/paramtree.cpp
r723 r734 1 // This file is a part of Framsticks SDK. http://www.framsticks.com/ 2 // Copyright (C) 1999-2018 Maciej Komosinski and Szymon Ulatowski. 3 // See LICENSE.txt for details. 4 1 5 #include "paramtree.h" 2 6 3 ParamTree::Node *ParamTree::addNode(ParamTree::Node* parent, const SString& name, int group)7 ParamTree::Node *ParamTree::addNode(ParamTree::Node* parent, const string& name, int group) 4 8 { 5 9 std::shared_ptr<Node> new_it(new Node(this, parent, name, group)); … … 21 25 } 22 26 23 ParamTree::Node *ParamTree::findNode(ParamTree::Node *parent, const SString& name)27 ParamTree::Node *ParamTree::findNode(ParamTree::Node *parent, const string& name) 24 28 { 25 29 for (ParamTree::Node *it = parent->first_child.get(); it != NULL; it = it->next_sibling.get()) … … 53 57 if (colons != level) continue; 54 58 55 SString name = grname; // "abc:def:ghi"59 string name = grname; // "abc:def:ghi" 56 60 Node *parentnode = &root; 57 61 int i = 0; … … 59 63 for (int haslevel = 0; haslevel < level; haslevel++) 60 64 { 61 i = name. indexOf(':', 0); // can't fail!65 i = name.find(':'); // always succeeds because we counted the colons before 62 66 // "na:me" -> prefix="na",name="me" 63 SString prefix = name.substr(0, i);67 string prefix = name.substr(0, i); 64 68 // search for parent node in listview ('prefix') 65 69 Node *it = findNode(parentnode, prefix); -
cpp/frams/param/paramtree.h
r728 r734 1 // This file is a part of Framsticks SDK. http://www.framsticks.com/ 2 // Copyright (C) 1999-2018 Maciej Komosinski and Szymon Ulatowski. 3 // See LICENSE.txt for details. 4 1 5 #ifndef _PARAMTREE_H_ 2 6 #define _PARAMTREE_H_ … … 38 42 ParamTree *tree; 39 43 Node *parent; 40 SString name; //path component name44 string name; //path component name 41 45 int group_index; //original group index or -1 for dummy nodes 42 46 NodePtr first_child; 43 47 NodePtr next_sibling; 44 48 45 Node(ParamTree *_tree = NULL, Node *_parent = NULL, const SString &_name = "", int _group_index = -1)49 Node(ParamTree *_tree = NULL, Node *_parent = NULL, const string &_name = "", int _group_index = -1) 46 50 :tree(_tree), parent(_parent), name(_name), group_index(_group_index) {} 47 51 }; … … 49 53 ParamInterface π 50 54 51 Node *addNode(Node* parent, const SString &name, int group);52 Node *findNode(Node *parent, const SString& name);55 Node *addNode(Node* parent, const string &name, int group); 56 Node *findNode(Node *parent, const string& name); 53 57 54 58 ParamTree(ParamInterface &_pi);
Note: See TracChangeset
for help on using the changeset viewer.