mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2026-06-07 08:24:47 -04:00
Recents list, DataTree rewindAll(), Bookmark view updates
This commit is contained in:
@@ -565,6 +565,7 @@ DataNode *DataNode::getNext(const char *name_in) {
|
||||
|
||||
void DataNode::rewind() {
|
||||
ptr = 0;
|
||||
childmap_ptr.erase(childmap_ptr.begin(),childmap_ptr.end());
|
||||
}
|
||||
|
||||
void DataNode::rewind(const char *name_in) {
|
||||
@@ -1342,6 +1343,38 @@ long DataTree::getSerializedSize(DataElement &de_node_names, bool debug) /* get
|
||||
return total_size;
|
||||
}
|
||||
|
||||
void DataNode::rewindAll() {
|
||||
stack<DataNode *> dn_stack;
|
||||
|
||||
/* start at the root */
|
||||
dn_stack.push(this);
|
||||
|
||||
while (!dn_stack.empty()) {
|
||||
dn_stack.top()->rewind();
|
||||
|
||||
/* if it has children, traverse into them */
|
||||
if (dn_stack.top()->hasAnother()) {
|
||||
dn_stack.push(dn_stack.top()->getNext());
|
||||
dn_stack.top()->rewind();
|
||||
} else {
|
||||
/* no more children, back out until we have children, then add next child to the top */
|
||||
while (!dn_stack.empty()) {
|
||||
if (!dn_stack.top()->hasAnother()) {
|
||||
dn_stack.top()->rewind();
|
||||
dn_stack.pop();
|
||||
} else
|
||||
break;
|
||||
}
|
||||
|
||||
if (!dn_stack.empty()) {
|
||||
dn_stack.push(dn_stack.top()->getNext());
|
||||
dn_stack.top()->rewind();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void DataNode::findAll(const char *name_in, vector<DataNode *> &node_list_out) {
|
||||
stack<DataNode *> dn_stack;
|
||||
|
||||
|
||||
+2
-2
@@ -260,7 +260,8 @@ public:
|
||||
DataNode *getNext(); /* get next child */
|
||||
void rewind(const char *name_in); /* rewind specific */
|
||||
void rewind(); /* rewind generic */
|
||||
|
||||
void rewindAll();
|
||||
|
||||
void findAll(const char *name_in, vector<DataNode *> &node_list_out);
|
||||
|
||||
// operator string () { string s; element()->get(s); return s; }
|
||||
@@ -316,7 +317,6 @@ public:
|
||||
bool operator() () { return hasAnother(); }
|
||||
|
||||
DataNode *operator ^(const char *name_in) { return newChild(name_in); }
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user