It's probably easier to create a new TreeKey along the way, otherwise it won't work properly (going to the parent at the end will lose the place in the sibling iteration).
void getSectionsList(TreeKey tk, list l) { do { l.append (tk->getText()); if (tk->hasChildren()) { TreeKey new_tk = tk.clone(); new_tk->firstChild(); getSectionsList(new_tk, l); delete new_tk; } } while (tk->nextSibling()) } Untested code, of course... God Bless, Ben ------------------------------------------------------------------------------------------- Multitudes, multitudes, in the valley of decision! For the day of the LORD is near in the valley of decision. Giôên 3:14 (ESV) On 03/11/2009, Matthew Talbert <ransom1...@gmail.com> wrote: > > This might be better. I'm probably still missing some logic. > > void getSectionsList(TreeKey tk, list l) > { > l.append (tk->getText()); > if tk->hasChildren() > { > tk->firstChild(); > getSectionsList(tk, l); > } > while tk->nextSibling() > { > getSectionsList(tk, l); > } > tk->parent(); > } > > Matthew > > _______________________________________________ > sword-devel mailing list: sword-devel@crosswire.org > http://www.crosswire.org/mailman/listinfo/sword-devel > Instructions to unsubscribe/change your settings at above page >
_______________________________________________ sword-devel mailing list: sword-devel@crosswire.org http://www.crosswire.org/mailman/listinfo/sword-devel Instructions to unsubscribe/change your settings at above page