[sword-devel] Faster searching wanted

Troy A. Griffitts sword-devel@crosswire.org
Mon, 01 Apr 2002 13:21:37 -0700


Nathan,
	Alternative to using books to get chapmax, versemax might be:

VerseKey *key = (VerseKey *)kjvmod.CreateKey();
(*key) = TOP;
while (!key->Error()) {
  cout << "Book: " << key->getBookName() << endl;
  (*key) = MAXCHAPTER;
  int chaps = key->Chapters();
  cout << "Total Chapters: " << chaps;
  for (int i = 1; i <= chaps; i++) {
    key->Chapter(i);
    (*key) = MAXVERSE;
    cout << "\tChapter " << i << "has " << key->Verse() << " total
verses." << endl;
  }
  key->Book(key->Book()+1);
}
delete key;


All VerseKey modules have same data currently, but this might change
soon, so the kjvmod.CreateKey() to get a module specific key should give
you the correct data for the module even in the future.


Nathan wrote:
> 
> >Here's how you'd do it with the books member:
> >
> >VerseKey key = "jn1:1";
> >
> >key.books[key.Testament()-1][key.Book()-1].name;
> 
> I'm using this method to get the number of chapters and verses for
> limiting entries in my interface. Would be nice to have methods for
> those.
> 
> It also worries me a bit - because this method has no reference to a
> particular module. Assuming this information is always the same, I
> suppose it isn't a big deal.
> 
> - n8
> 
> --
> Nathan Youngman
> E-mail: nathany at mac.com
> Web: http://nathany.com