[sword-devel] Sword API Questions / Proposal >> flatapi.cpp / flatapi.h

Simon J Mackenzie smackoz at fastmail.fm
Mon Jun 2 23:45:00 MST 2008


I have been attempting to familiarise myself with flatapi.cpp/h
for a small in house project but have come up with a few
questions about the Sword API, particularly flatapi.cpp/h.

1) The function listkey_getVerselistIterator in flatapi currently
accepts two parameters but I fail to see the difference /
dissimilarity between the two parameters “char * list” and “char
* key”? Could someone please point me in the right direction?
Thank you.
2) Is there any reason why the function
listkey_getVerselistIterator in flatapi.h does not accept a
boolean flag for normalising a bible reference such as "John
6:1,12-16"?
The current call to listkey_getVerselistIterator produces a
“verses” array containing [John 6:1, John 6:12] and not [John
6:1, John 6:12, John 6:13, John 6:14, John 6:15, John 6:16] as
would be expected.
If there is no limiting factors I propose an update to
flatapi.cpp and flatapi.h as set out below.

=== flatapi.h ===========================================
// Existing   // SWHANDLE SWDLLEXPORT
listkey_getVerselistIterator(const char * list, const char * key)
// Proposed // SWHANDLE SWDLLEXPORT
listkey_getVerselistIterator(const char * list, const char * key,
bool expandRange);
=== flatapi.h ===========================================
=== flatapi.cpp =========================================
// Existing   // SWHANDLE listkey_getVerselistIterator(const char
* list, const char * key)
// Proposed // SWHANDLE listkey_getVerselistIterator(const char *
list, const char * key, bool expandRange = false) { // set to
false by default to retain existing function call behaviour.
    VerseKey versekey;
    static ListKey verses;
    versekey.setText(key);
    verses.ClearList();
// Existing   // verses = versekey.ParseVerseList(list,
versekey);
// Proposed // verses = versekey.ParseVerseList(list, versekey,
expandRange);
    return (SWHANDLE)&verses;
}
=== flatapi.cpp =========================================

As I am new to this group if there is a more appropriate
procedure for presenting my proposal and having it incorporated
in the Sword project please let me know.

Any comments would be appreciated.

Regards
Simon
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.crosswire.org/pipermail/sword-devel/attachments/20080603/ab6927e7/attachment.html 


More information about the sword-devel mailing list