[sword-devel] Miscellaneous Sword API Questions
Troy A. Griffitts
scribe at crosswire.org
Tue Apr 19 16:36:49 MST 2005
>>3.) What is the best way to check how many chapters a given book has? Is
>>there a function that returns this, or do I need to deal with the struct
>>that has this information?
Officially, MAXCHAPTER is defined as a position entity, so something like:
Versekey vk("John");
vk = MAXCHAPTER;
cout << vk.Chapter();
You can also investigate the internal structs in versekey, but these are
not guaranteed to remain the same. Maybe a more direct approach needs
exposing?
>>4.) Does Sword use UTF-8 encoding by default? Is there a way to globally
>>force UTF-8 usage, or would I have to manually convert with the functions
>>in the *utf8.h files? (For consistency, I would like the plugins to always
>>use UTF-8 for strings. I plan to use char arrays instead of QStrings so
>>that the plugins might me more generally useful to other programs that just
>>need simple features from Sword or any other interface for which a plugin
>>may be written.)
Joachim is correct regarding verse references and such, but if you mean
Bible texts, then the c-tor of SWMgr is where you want to look. I
believe my example code constructs an SWMgr that will always returns
UTF-8, regardless of the encoding of the source text.
>>6.) Does Sword offer categorizations of the books of the Bible (e.g.
>>"Gospels" and "Prophets")? I know BibleTime has these categorizations
>>available when searching. Is this a BibleTime feature or a Sword feature?
>>If it is a Sword feature, how is it accessed?
>
>
> It's a BibleTime feature. We use a ListKey and pass it to the module search.
Correct that SWORD does not define any of these categories, but it
facilitates defining them yourself. As Joachim stated, the SWORD engine
will return a ListKey (range of verses) from its verse parser which can
be used to limit Bible text output or searches, etc.
Thanks Joachim for hitting the meat of the questions.
More information about the sword-devel
mailing list