DM Smith wrote:
I use:
                for (verseKeys = TOP; !verseKeys.Error(); verseKeys++) {
                        ...
                }
Will that iterate over the whole?

Yes.

if (verseKeys++ == verseKeys) { /* then I have a single key */ }

postfix operator++ increments the object and returns a temporary which represented the object before the iteration.

so (verseKey++ == verseKey) checks if verseKey is the same value after increment as it was before increment.

(++verseKey == verseKey) should always return true because the prefix operator++ iterates first and returns the object state after the iteration.

Hope this makes sense.  Thanks for fixing things!

        -Troy.








DM Smith wrote:
I found the problem. SWORD reports the count of verses in a VerseList differently. A range now counts as one. It used to count as many verses as was in it. Here is a demonstration of the problem that I quickly hacked together. (Troy, tell me which testcase file to put it in and I'll add it.) It should say (and used to say) that
"There are 5 verses that are in the range"
#include <iostream>
#include <swbuf.h>
#include <listkey.h>
#include <versekey.h>
#ifndef NO_SWORD_NAMESPACE
using namespace sword;
#endif
using namespace std;
int main(int argc, char **argv) {
      VerseKey currentVerse;
      SWBuf keyVal = "Matt.1.1-Matt.1.5";
ListKey verseKeys = currentVerse.ParseVerseList(keyVal, "Gen.1.1", true);
      int memberKeyCount = verseKeys.Count();
      if (memberKeyCount) {
cout << "There are " << memberKeyCount << " verses that are in the range: " << keyVal << endl;
              for (verseKeys = TOP; !verseKeys.Error(); verseKeys++)
              {
                      cout << verseKeys << endl;
              }
      }
      else {
cout << "Error: Invalid reference/annotateRef: " << keyVal << endl;
      }
}


I'll look into the testsuite.  FYI, a sample xml is:

  <?xml version="1.0" encoding="UTF-8"?>
  <osis
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
      xmlns="http://www.bibletechnologies.net/2003/OSIS/namespace";
xmlns:osis="http://www.bibletechnologies.net/2003/OSIS/namespace"; xsi:schemaLocation="http://www.bibletechnologies.net/2003/OSIS/namespace
  http://www.bibletechnologies.net/osisCore.2.1.1.xsd";>
      <osisText osisIDWork="Luther" osisRefWork="commentary"
  xml:lang="en" canonical="false">
          <header>
              header.
          </header>
          <div type="bookGroup">
              <title>New Testament</title>
              <div type="book" osisID="Matt" canonical="false">
                  <title type="main" short="Matthew">Matthew</title>
                  <div type="section" annotateType="commentary"
  annotateRef="Matt.1.1">
                      <p>
                      Blah blah...
                      This is a test!
                      </p>
</div> <div type="section" annotateType="commentary"
  annotateRef="Matt.22.1-Matt.22.9">
              <title level="2">Sermon; Matthew 21:1-9</title>
              <p>
                  This fails
              </p>
              </div>                   </div>
          </div>
      </osisText>
  </osis>


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


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


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


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


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

Reply via email to