<div>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).<br> </div>
<div>void getSectionsList(TreeKey tk, list l)<br>{</div>
<div> do {<br> l.append (tk->getText());<br> if (tk->hasChildren())<br> {</div>
<div> TreeKey new_tk = tk.clone();<br> new_tk->firstChild();<br> getSectionsList(new_tk, l);</div>
<div> delete new_tk;</div>
<div> }<br> } while (tk->nextSibling())<br>}</div>
<div> </div>
<div>Untested code, of course...</div>
<div> </div>
<div>God Bless,<br>Ben<br>-------------------------------------------------------------------------------------------<br>Multitudes, multitudes,<br> in the valley of decision!<br>For the day of the LORD is near<br> in the valley of decision.<br>
<br>Giôên 3:14 (ESV)<br> </div>
<div><span class="gmail_quote">On 03/11/2009, <b class="gmail_sendername">Matthew Talbert</b> <<a href="mailto:ransom1982@gmail.com">ransom1982@gmail.com</a>> wrote:</span>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">This might be better. I'm probably still missing some logic.<br><br>void getSectionsList(TreeKey tk, list l)<br>
{<br> l.append (tk->getText());<br> if tk->hasChildren()<br> {<br> tk->firstChild();<br> getSectionsList(tk, l);<br> }<br> while tk->nextSibling()<br> {<br> getSectionsList(tk, l);<br>
}<br> tk->parent();<br>}<br><br>Matthew<br><br>_______________________________________________<br>sword-devel mailing list: <a href="mailto:sword-devel@crosswire.org">sword-devel@crosswire.org</a><br><a href="http://www.crosswire.org/mailman/listinfo/sword-devel">http://www.crosswire.org/mailman/listinfo/sword-devel</a><br>
Instructions to unsubscribe/change your settings at above page<br></blockquote></div><br><br clear="all">