[sword-devel] Counting Keys in a Module

Jeremy Erickson jerickson314 at users.sourceforge.net
Wed Nov 14 10:11:21 MST 2007

	What is the proper way in Sword to quickly determine the number of keys in a 
module?  Currently in BibleTime we use the following code to determine the 
starting and ending indices:

    *m_module = sword::TOP;
    unsigned long verseLowIndex = m_module->Index();
    *m_module = sword::BOTTOM;
    unsigned long verseHighIndex = m_module->Index();

This code works as expected when the module is a Bible, but it does not work 
when the module is a Lexicon.  In this case, the Index() function always 
returns 0.  Is this because StrKey does not reimplement the Index() function?  
In any case, what would the cleanest way for me to count the keys in a module 
be, so that it works with all types of modules?

-Jeremy Erickson

More information about the sword-devel mailing list