[sword-devel] search function?

Kevin Field kev at brantaero.com
Fri Oct 1 18:24:38 MST 2004

Hi Troy,

Okay, I'm surely not understanding this correctly, but I'll half-
propose a solution anyway and hopefully in telling me why it's no good 
I'll understand better.  :)  But first:

> 	Sure!  We'd always love the help.  Briefly, (this assumes you 
> understand the SWModule/SWKey construct in the API) a key has the 
> concept of a numeric index().  Basically, the current modus opperandi 
> in 
> SWModule::search is to set the module to the end, check the module's 
> key->index() and use that as the high value.  Then, set the module to 
> the beginning and start the search.  After performing the search for 
> an 
> individual entry, the key->index() is checked to see where we're at, 
> do 
> the math, and report the %.

I get the concept, but I don't understand exactly how it's breaking 
down when there's a scope, or what's with all the 'KLUDGE' comments in 
the code and whatnot.  Anyway, carrying on:

> 	A different way to do this would be to add an 
> SWModule::entryCount(), 
> use that as the high count, and merely have an int pos that we pos++ 
> while iterating during the search.

Couldn't we just make SWModule::search() take SWListKey *scope instead 
of SWKey *scope?  Then we can just use ListKey::Count().  I don't 
really get how you can provide a range with just an SWKey and not an 
SWListKey.  In Scripture Guide we're passing it an SWListKey we make 
using 'parse' anyway.  Is there other software out there that doesn't?  
How does that work?



Kevin Field
Today's matchup:  The Great I AM versus the great I
Food for thought:

"I have a very firm grasp on reality!  I can reach out and strangle it
any time!"

More information about the sword-devel mailing list