Hi Troy!
1) Getting the list of books in a module
vector<string> ModuleHelper::getBookList(string moduleName)
https://github.com/ezra-project/node-sword-interface/blob/master/src/sword_backend/module_helper.cpp#L70
A small comment, there are different styles of book names:
VerseKey::getBookName()
VerseKey::getBookAbbrev()
VerseKey::getOSISBookName()
The first two are localized to whatever language you have set for the
engine, e.g.,
LocaleMgr::getSystemLocaleMgr()->setDefaultLocaleName("fr");
Thanks! I'm actually using my helper method getBookList to get a list of
books that are like "ids". In this case I'm happy with the
getOSISBookName method. In any case there are several usecases, so
thanks for highlighting this!
2) Getting a map with the number of verses per chapter per book
std::map<std::string, std::vector<int>>
getBibleChapterVerseCounts(std::string moduleName);
https://github.com/ezra-project/node-sword-interface/blob/master/src/sword_backend/module_helper.cpp#L92
I am note sure I condone this behavior here :) If you found a need to
do something like this because you couldn't easily use the suggestions
below, please let me know and maybe we can fix something or extend
functionality to meet your needs.
If you ever want to know how many Books, Chapters, Verses, etc. are
available in a reference system, these should serve that purpose:
VerseKey::getTestamentMax()
VerseKey::getBookMax(), once you set the testament
VerseKey::getChapterMax(), once you set the book
VerseKey::getVerseMax(), once you set the chapter
At the time when I wrote that function I didn't realize that I could use
VerseKey to determine max values of chapters/chapter-verses per book.
Thanks! I may actually refactor my code now based on your hint.
To give you some context how I use this function ... in Ezra Project,
this is currently used in three places.
1) NavigationPane => Getting the number of chapters for a book
2) I have a "verse range formatter", that needs the verse count per
chapter to work correctly.
3) In my TagStatistics function I calculate percentages relative to the
total number of verses in a book.
Best regards,
Tobias
_______________________________________________
sword-devel mailing list: sword-devel@crosswire.org
http://crosswire.org/mailman/listinfo/sword-devel
Instructions to unsubscribe/change your settings at above page