<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
> <span style="color: rgb(0, 0, 0); font-family: "Segoe UI", "Segoe UI Web (West European)", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif; font-size: 15px; background-color: rgb(255, 255, 255); display: inline !important;">The
first two are localized to whatever language you have set for the engine</span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
<span style="color: rgb(0, 0, 0); font-family: "Segoe UI", "Segoe UI Web (West European)", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif; font-size: 15px; background-color: rgb(255, 255, 255); display: inline !important;">This
is great, because I want localizations.</span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
<span style="color: rgb(0, 0, 0); font-family: "Segoe UI", "Segoe UI Web (West European)", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif; font-size: 15px; background-color: rgb(255, 255, 255); display: inline !important;"><br>
</span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
<span style="color: rgb(0, 0, 0); font-family: "Segoe UI", "Segoe UI Web (West European)", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif; font-size: 15px; background-color: rgb(255, 255, 255); display: inline !important;">> <span style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); display: inline !important;">I
am note sure I condone this behavior here :) </span></span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
<span style="color: rgb(0, 0, 0); font-family: "Segoe UI", "Segoe UI Web (West European)", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif; font-size: 15px; background-color: rgb(255, 255, 255); display: inline !important;"><span style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); display: inline !important;">TBH
I was struggling to figure out exactly what that was trying to do (no offense, Tobias or whoever wrote it).</span></span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
<span style="color: rgb(0, 0, 0); font-family: "Segoe UI", "Segoe UI Web (West European)", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif; font-size: 15px; background-color: rgb(255, 255, 255); display: inline !important;"><span style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); display: inline !important;"><br>
</span></span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
<p style="color: rgb(0, 0, 0); font-family: "Segoe UI", "Segoe UI Web (West European)", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif; font-size: 15px; background-color: rgb(255, 255, 255);">
> 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 style="color: rgb(0, 0, 0); font-family: "Segoe UI", "Segoe UI Web (West European)", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif; font-size: 15px; background-color: rgb(255, 255, 255);">
<span style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); display: inline !important;">><span> </span></span>VerseKey::getTestamentMax()</p>
<p style="color: rgb(0, 0, 0); font-family: "Segoe UI", "Segoe UI Web (West European)", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif; font-size: 15px; background-color: rgb(255, 255, 255);">
<span style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); display: inline !important;">><span> </span></span>VerseKey::getBookMax(), once you set the testament<br>
</p>
<p style="color: rgb(0, 0, 0); font-family: "Segoe UI", "Segoe UI Web (West European)", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif; font-size: 15px; background-color: rgb(255, 255, 255);">
<span style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); display: inline !important;">><span> </span></span>VerseKey::getChapterMax(), once you set the book<br>
</p>
<p style="color: rgb(0, 0, 0); font-family: "Segoe UI", "Segoe UI Web (West European)", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif; font-size: 15px; background-color: rgb(255, 255, 255);">
<span style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); display: inline !important;">><span> </span></span>VerseKey::getVerseMax(), once you set the chapter</p>
<p style="color: rgb(0, 0, 0); font-family: "Segoe UI", "Segoe UI Web (West European)", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif; font-size: 15px; background-color: rgb(255, 255, 255);">
Are the set{Book,Chapter,Verse} functions zero-indexed, and if so, do the get<span style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); display: inline !important;">{Book,Chapter,Verse}<span> functions reflect that? (Excuse my Bash scripting
<span id="š">š)</span></span></span></p>
</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> sword-devel <sword-devel-bounces@crosswire.org> on behalf of Troy A. Griffitts <scribe@crosswire.org><br>
<b>Sent:</b> Tuesday, November 17, 2020 7:33 PM<br>
<b>To:</b> sword-devel@crosswire.org <sword-devel@crosswire.org><br>
<b>Subject:</b> Re: [sword-devel] Getting info about books, chapters, and verses in a module</font>
<div> </div>
</div>
<div>
<p>Thank you Tobias,</p>
<p>A few comments below:</p>
<p><br>
</p>
<div class="x_moz-cite-prefix">On 11/17/20 10:46 AM, Tobias Klein wrote:<br>
</div>
<blockquote type="cite">Hi Loren,
<div class=""><br class="">
</div>
<div class="">This is how Iām doing it in node-sword-interface.</div>
<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 class="" 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)">vector<string>
</span><span class="x_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 class="" 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)">(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="">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>
<p><br>
</p>
<blockquote type="cite">
<div class="">2) Getting a map with the number of verses per chapter per book</div>
<div class=""><br class="">
</div>
<div class=""><span class="" 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)">std::map<std::string, std::vector<</span><span class="x_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 class="" 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)">>>
</span><span class="x_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 class="" 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)">(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="">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>
<p>Please remember that each module might give different results, and creating a VerseKey object without specifying a reference system will create a KJV VerseKey. If you want the module-specific reference system, it is always good to do as your first example
does and grab the current key, or use SWModule::createKey() to create a key specialized for the module-- which you'll need to delete when you are done using.</p>
<p>Hope this helps. Thanks for the comments!</p>
<p>There's an example here which goes into some of this and covers other things like VerseKey ranges:</p>
<p><a class="x_moz-txt-link-freetext" href="http://crosswire.org/svn/sword/trunk/examples/classes/lastVerseInChapter.cpp">http://crosswire.org/svn/sword/trunk/examples/classes/lastVerseInChapter.cpp</a></p>
<p><a class="x_moz-txt-link-freetext" href="http://crosswire.org/svn/sword/trunk/examples/classes/verseranges.cpp">http://crosswire.org/svn/sword/trunk/examples/classes/verseranges.cpp</a><br>
</p>
<p>Troy<br>
</p>
<p><br>
</p>
<blockquote type="cite">
<div class="">
<div>Best regards,</div>
<div>Tobias<br class="">
<br class="">
<br class="">
<blockquote type="cite" class="">
<div class="">Am 17.11.2020 um 04:43 schrieb Loren Burkholder <<a href="mailto:computersemiexpert@outlook.com" class="">computersemiexpert@outlook.com</a>>:</div>
<br class="x_Apple-interchange-newline">
<div class="">
<div class="">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?<br class="">
<br class="">
m_books = someVar; // what should this do?<br class="">
key.setBook(m_books.currentIndex());<br class="">
m_chapters = key.getChapterMax();<br class="">
m_verses = key.getVerseMax();<br class="">
setCurrentRef(m_books[index], m_chapters[index], m_verses[index]);<br class="">
<br class="">
I know that this isn't great pseudo code but it's what I came up with.<br class="">
<br class="">
Thanks,<br class="">
Loren<br class="">
<br class="">
<br class="">
_______________________________________________<br class="">
sword-devel mailing list: <a href="mailto:sword-devel@crosswire.org" class="">sword-devel@crosswire.org</a><br class="">
<a href="http://crosswire.org/mailman/listinfo/sword-devel" class="">http://crosswire.org/mailman/listinfo/sword-devel</a><br class="">
Instructions to unsubscribe/change your settings at above page<br class="">
</div>
</div>
</blockquote>
</div>
<br class="">
</div>
<br>
<fieldset class="x_mimeAttachmentHeader"></fieldset>
<pre class="x_moz-quote-pre">_______________________________________________
sword-devel mailing list: <a class="x_moz-txt-link-abbreviated" href="mailto:sword-devel@crosswire.org">sword-devel@crosswire.org</a>
<a class="x_moz-txt-link-freetext" href="http://crosswire.org/mailman/listinfo/sword-devel">http://crosswire.org/mailman/listinfo/sword-devel</a>
Instructions to unsubscribe/change your settings at above page</pre>
</blockquote>
</div>
</body>
</html>