[sword-devel] Getting info about books, chapters, and verses in a module

Loren Burkholder computersemiexpert at outlook.com
Mon Nov 16 22:43:00 EST 2020


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




More information about the sword-devel mailing list