[sword-devel] Faster searching wanted

Troy A. Griffitts sword-devel@crosswire.org
Mon, 01 Apr 2002 14:10:00 -0700


> Oh. Hm. That looks like a lot of code. I currently go like this: -)
> 
> VerseKey key = [bookName cString];
> maxChapters = key.books[key.Testament()-1][key.Book()-1].chapmax;
> 
> So I should use CreateKey:
> VerseKey *key = (VerseKey *)kjvmod.CreateKey();
> then some SetKey() function to set the book.
> then my maxChapters code
> then delete the key.
> 
> Or, I suppose I could set the key to MAXCHAPTER and then get what it
> is with Chapters() like you do. (Except I'm only grabbing info on one
> at a time).
> 
> But it would be kind of nice to have a MaxChapters() method in the
> API, don't you think :-).

Ok, point taken :)  look for it in CVS soon.


> Now - if I understand correctly - the module doesn't control the
> locale used by getBookName() - but I can specify the the locale in
> the key I create, and I can retrieve the locale used by the module -
> depending if the user wants the interface text to match the module in
> use, or use their system-wide preferences.

Yeah, the logic for this was that I probably don't want Hebrew book
names in BHS or Greek book names in TR.  Some users might, but my hunch
is that the majority of them will not.  Locales are mostly used appWide
with something like: 
LocalMgr::systemLocalMgr.setDefaultLocaleName("de");

after a call like this, all new objects will obtain a 'de' locale. (this
is usually done at the very beginning of an app to set to a user
preferred locale).


> Naturally I encapsulated the code I need in a SwordBible Objective-C
> class - so it's pretty easy to change things like how maximum chapter
> counts are retrieved.
> 
> - n8
> 
> --
> Nathan Youngman
> E-mail: nathany at mac.com
> Web: http://nathany.com