Hi Loren,

This is how I’m doing it in node-sword-interface.

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
 
<https://github.com/ezra-project/node-sword-interface/blob/master/src/sword_backend/module_helper.cpp#L70>

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
 
<https://github.com/ezra-project/node-sword-interface/blob/master/src/sword_backend/module_helper.cpp#L92>

Best regards,
Tobias


> Am 17.11.2020 um 04:43 schrieb Loren Burkholder 
> <computersemiexp...@outlook.com>:
> 
> I was digging into the docs and found that a VerseKey can give some info 
> about the book and chapter that it is in, and the numbers of books and 
> chapters. This could be useful to me because I want to get a list of the 
> books in a module, then load the number of chapters for the book and the 
> number of verses for the selected chapter on-demand. However, I'm not 
> completely sure how I should be doing this. Would the following pseudo-code 
> be appropriate, or is there a different method that I should be using?
> 
> m_books = someVar; // what should this do?
> key.setBook(m_books.currentIndex());
> m_chapters = key.getChapterMax();
> m_verses = key.getVerseMax();
> setCurrentRef(m_books[index], m_chapters[index], m_verses[index]);
> 
> I know that this isn't great pseudo code but it's what I came up with.
> 
> Thanks,
> Loren
> 
> 
> _______________________________________________
> sword-devel mailing list: sword-devel@crosswire.org
> http://crosswire.org/mailman/listinfo/sword-devel
> Instructions to unsubscribe/change your settings at above page

_______________________________________________
sword-devel mailing list: sword-devel@crosswire.org
http://crosswire.org/mailman/listinfo/sword-devel
Instructions to unsubscribe/change your settings at above page

Reply via email to