<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p>Hi Troy!<br>
</p>
<blockquote type="cite"
cite="mid:f655b595-327d-e3ad-d581-8daa5cf4fe30@crosswire.org">
<blockquote type="cite"
cite="mid:D80E7A5A-B1E9-49F6-AF16-1DC3D72A8418@tklein.info">
<div class=""><br class="">
</div>
<div class="">1) Getting the list of books in a module</div>
<div class=""><br class="">
</div>
<div class=""><span style="color: rgb(36, 41, 46); font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace; font-variant-ligatures: normal; orphans: 2; white-space: pre; widows: 2; background-color: rgb(255, 255, 255);" class="">vector<string> </span><span class="pl-en" style="box-sizing: border-box; color: rgb(111, 66, 193); font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace; font-variant-ligatures: normal; orphans: 2; white-space: pre; widows: 2; background-color: rgb(255, 255, 255);">ModuleHelper::getBookList</span><span style="color: rgb(36, 41, 46); font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace; font-variant-ligatures: normal; orphans: 2; white-space: pre; widows: 2; background-color: rgb(255, 255, 255);" class="">(string moduleName)</span></div>
<div class=""><a
href="https://github.com/ezra-project/node-sword-interface/blob/master/src/sword_backend/module_helper.cpp#L70"
class="" moz-do-not-send="true">https://github.com/ezra-project/node-sword-interface/blob/master/src/sword_backend/module_helper.cpp#L70</a></div>
<div class=""><br class="">
</div>
</blockquote>
<p>A small comment, there are different styles of book names:</p>
<p>VerseKey::getBookName()</p>
<p>VerseKey::getBookAbbrev()</p>
<p>VerseKey::getOSISBookName()</p>
<p>The first two are localized to whatever language you have set
for the engine, e.g.,</p>
<p>LocaleMgr::getSystemLocaleMgr()->setDefaultLocaleName("fr");</p>
</blockquote>
<p>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!</p>
<blockquote type="cite"
cite="mid:f655b595-327d-e3ad-d581-8daa5cf4fe30@crosswire.org">
<blockquote type="cite"
cite="mid:D80E7A5A-B1E9-49F6-AF16-1DC3D72A8418@tklein.info">
<div class="">2) Getting a map with the number of verses per
chapter per book</div>
<div class=""><br class="">
</div>
<div class=""><span style="color: rgb(36, 41, 46); font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace; font-variant-ligatures: normal; orphans: 2; white-space: pre; widows: 2; background-color: rgb(255, 255, 255);" class="">std::map<std::string, std::vector<</span><span class="pl-k" style="box-sizing: border-box; color: rgb(215, 58, 73); font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace; font-variant-ligatures: normal; orphans: 2; white-space: pre; widows: 2; background-color: rgb(255, 255, 255);">int</span><span style="color: rgb(36, 41, 46); font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace; font-variant-ligatures: normal; orphans: 2; white-space: pre; widows: 2; background-color: rgb(255, 255, 255);" class="">>> </span><span class="pl-en" style="box-sizing: border-box; color: rgb(111, 66, 193); font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace; font-variant-ligatures: normal; orphans: 2; white-space: pre; widows: 2; background-color: rgb(255, 255, 255);">getBibleChapterVerseCounts</span><span style="color: rgb(36, 41, 46); font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace; font-variant-ligatures: normal; orphans: 2; white-space: pre; widows: 2; background-color: rgb(255, 255, 255);" class="">(std::string moduleName);</span></div>
<div class="">
<div><a
href="https://github.com/ezra-project/node-sword-interface/blob/master/src/sword_backend/module_helper.cpp#L92"
class="" moz-do-not-send="true">https://github.com/ezra-project/node-sword-interface/blob/master/src/sword_backend/module_helper.cpp#L92</a></div>
</div>
</blockquote>
<p>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.<br>
</p>
<p>If you ever want to know how many Books, Chapters, Verses, etc.
are available in a reference system, these should serve that
purpose:<br>
</p>
<p>VerseKey::getTestamentMax()</p>
<p>VerseKey::getBookMax(), once you set the testament<br>
</p>
<p>VerseKey::getChapterMax(), once you set the book<br>
</p>
<p>VerseKey::getVerseMax(), once you set the chapter<br>
</p>
</blockquote>
<p>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.<br>
Thanks! I may actually refactor my code now based on your hint.<br>
<br>
To give you some context how I use this function ... in Ezra
Project, this is currently used in three places.<br>
1) NavigationPane => Getting the number of chapters for a book<br>
2) I have a "verse range formatter", that needs the verse count
per chapter to work correctly.<br>
3) In my TagStatistics function I calculate percentages relative
to the total number of verses in a book.<br>
</p>
<p>Best regards,<br>
Tobias<br>
</p>
<br>
</body>
</html>