[sword-devel] Understanding the structure of generic books and their relationship with TreeKey.

Greg Hellings greg.hellings at gmail.com
Sun Nov 1 15:33:37 MST 2009


On Sun, Nov 1, 2009 at 4:01 PM, Rendezvous <junk_and_mail at yahoo.com> wrote:
> Through browsing through some source code i've managed to figure out that you need to convert a SWKey (SWModule::getKey()) to a TreeKey to be able to iterate through the sections/chapters of a GenBook. However, i have yet to figure out how to obtain the children for each section/chapter. Rather than taking a guess with trial and error and searching through more Sword frontends' source code, i would prefer to have a _full_ understanding on how Sword handles GenBooks and how frontends can make use of those methods.
> My questions: Is TreeKey the only way to obtain the sections/chapters of a Genbook? And how do i get a list of the children for each section/chapter? Am i right to assume that i have to use SWModule::setKey() to set the current key to one of the root sections and then  re-cast SWModule::getKey() to a TreeKey and iterate through that? Or is another method required?

You might want to look into the documentation on
http://www.crosswire.org/~ghellings/1_6_0classdocs/ for version 1.6.0
of the engine.  Particularly look under TreeKey::firstChild() and


> _______________________________________________
> sword-devel mailing list: sword-devel at crosswire.org
> http://www.crosswire.org/mailman/listinfo/sword-devel
> Instructions to unsubscribe/change your settings at above page

More information about the sword-devel mailing list