<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>Thank you Tobias,</p>
    <p>A few comments below:</p>
    <p><br>
    </p>
    <div class="moz-cite-prefix">On 11/17/20 10:46 AM, Tobias Klein
      wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:D80E7A5A-B1E9-49F6-AF16-1DC3D72A8418@tklein.info">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      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 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>
    <p><br>
    </p>
    <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>
    <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="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="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"
      cite="mid:D80E7A5A-B1E9-49F6-AF16-1DC3D72A8418@tklein.info">
      <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=""
                moz-do-not-send="true">computersemiexpert@outlook.com</a>>:</div>
            <br class="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=""
                  moz-do-not-send="true">sword-devel@crosswire.org</a><br
                  class="">
                <a
                  href="http://crosswire.org/mailman/listinfo/sword-devel"
                  class="" moz-do-not-send="true">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="mimeAttachmentHeader"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
sword-devel mailing list: <a class="moz-txt-link-abbreviated" href="mailto:sword-devel@crosswire.org">sword-devel@crosswire.org</a>
<a class="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>
  </body>
</html>