[sword-svn] r2229 - in trunk: src/keys tests
scribe at crosswire.org
scribe at crosswire.org
Sun Jan 25 22:12:35 MST 2009
Author: scribe
Date: 2009-01-25 22:12:35 -0700 (Sun, 25 Jan 2009)
New Revision: 2229
Modified:
trunk/src/keys/versetreekey.cpp
trunk/tests/versekeytest.cpp
Log:
Fixed an issue with versetreekey in/decrement
Modified: trunk/src/keys/versetreekey.cpp
===================================================================
--- trunk/src/keys/versetreekey.cpp 2009-01-21 04:53:15 UTC (rev 2228)
+++ trunk/src/keys/versetreekey.cpp 2009-01-26 05:12:35 UTC (rev 2229)
@@ -107,7 +107,7 @@
void VerseTreeKey::decrement(int steps) {
int treeError = 0;
- if (!error) lastGoodOffset = treeKey->getOffset();
+ if (!error) lastGoodOffset = getTreeKey()->getOffset();
do {
treeKey->decrement();
treeError = treeKey->Error();
@@ -125,7 +125,7 @@
}
void VerseTreeKey::increment(int steps) {
int treeError = 0;
- if (!error) lastGoodOffset = treeKey->getOffset();
+ if (!error) lastGoodOffset = getTreeKey()->getOffset();
do {
treeKey->increment();
treeError = treeKey->Error();
Modified: trunk/tests/versekeytest.cpp
===================================================================
--- trunk/tests/versekeytest.cpp 2009-01-21 04:53:15 UTC (rev 2228)
+++ trunk/tests/versekeytest.cpp 2009-01-26 05:12:35 UTC (rev 2229)
@@ -5,6 +5,8 @@
#include <versekey.h>
#include <listkey.h>
#include <localemgr.h>
+#include <swmgr.h>
+#include <swmodule.h>
#ifndef NO_SWORD_NAMESPACE
using namespace sword;
#endif
@@ -13,17 +15,21 @@
using std::endl;
int main(int argc, char **argv) {
+/*
VerseKey currentVerse;
currentVerse.AutoNormalize(0);
currentVerse.Headings(1);
currentVerse.Persist(1);
currentVerse = "jn2";
cout << currentVerse << endl;
-/*
- VerseKey parser;
- ListKey scope = parser.ParseVerseList("amos", parser, true);
+ SWMgr mgr;
+ SWModule *mod = mgr.getModule("KJVgb");
+*/
+ VerseKey *parser = new VerseKey(); //(VerseKey *)mod->CreateKey();
+ ListKey scope = parser->ParseVerseList("amos", *parser, true);
+
ListKey result;
scope++;
@@ -31,12 +37,13 @@
scope++;
scope++;
- VerseKey x = scope;
- x.clearBound();
+ VerseKey *x = new VerseKey(); //(VerseKey *)mod->CreateKey();
+ *x = scope;
+ x->clearBound();
- std::cout << "x: " << x.getText() << "\n";
+ std::cout << "x: " << x->getText() << "\n";
- result << x;
+ result << *x;
std::cout << result.getText() << "\n";
@@ -45,7 +52,7 @@
std::cout << result.getText() << "\n";
const char *bounds = "lk,acts";
- scope = parser.ParseVerseList(bounds, parser, true);
+ scope = parser->ParseVerseList(bounds, *parser, true);
VerseKey boundTest("lk", "acts");
@@ -55,14 +62,32 @@
std::cout << "Error: " << (int)boundTest.Error() << "\n";
- x = "Is.1.13";
- scope = x;
+ *x = "Is.1.13";
+ scope = *x;
// if (scope == x) std::cout << "Error restricting bounds: " << x.getText() << " is in " << bounds << "\n";
- if (!scope.Error()) std::cout << "Error restricting bounds: " << x.getText() << " is in " << bounds << "\n";
+ if (!scope.Error()) std::cout << "Error restricting bounds: " << x->getText() << " is in " << bounds << "\n";
- x = "1Sam.21.1";
- scope = x;
- if (!scope.Error()) std::cout << "Error restricting bounds: " << x.getText() << " is in " << bounds << "\n";
+ *x = "1Sam.21.1";
+ scope = *x;
+ if (!scope.Error()) std::cout << "Error restricting bounds: " << x->getText() << " is in " << bounds << "\n";
+
+/*
+ VerseKey *y = (VerseKey *)mod->CreateKey();
+ (*y) = "lev 1.1";
+ cout << (*y) << "\n";
+ (*y)++;
+ cout << (*y) << "\n";
+ (*y)--;
+ cout << (*y) << "\n";
+ (*y)--;
+ cout << (*y) << "\n";
+
+ mod->setKey("Ruth 1.1");
+ cout << mod->getKeyText() << "\n";
+ (*mod)++;
+ cout << mod->getKeyText() << "\n";
+ (*mod)--;
+ cout << mod->getKeyText() << "\n";
*/
return 0;
More information about the sword-cvs
mailing list