[sword-svn] r3397 - trunk/examples/classes
scribe at crosswire.org
scribe at crosswire.org
Mon Jan 11 10:45:12 MST 2016
Author: scribe
Date: 2016-01-11 10:45:11 -0700 (Mon, 11 Jan 2016)
New Revision: 3397
Modified:
trunk/examples/classes/versenorm.cpp
Log:
Added comments and cleaned up allocated objects
Modified: trunk/examples/classes/versenorm.cpp
===================================================================
--- trunk/examples/classes/versenorm.cpp 2016-01-11 17:40:24 UTC (rev 3396)
+++ trunk/examples/classes/versenorm.cpp 2016-01-11 17:45:11 UTC (rev 3397)
@@ -35,27 +35,38 @@
const char *modName = "RusCARS";
const char *keyTextRegular = "1Sam1.20";
const char *keyTextNeedsNormalization = "1Sam1.200";
+
+
SWMgr library;
SWModule *book = library.getModule(modName);
if (!book) {
cerr << "Can't find module: " << modName << endl;
return -1;
}
+
+
+ // get two VerseKey objects for a module
VerseKey *verse = ((VerseKey *)book->createKey());
VerseKey *verseNormalized = ((VerseKey *)book->createKey());
+ // turn off autonormalization for one VerseKey reference
verse->setAutoNormalize(false);
+ // set a reference not requiring normalization to both VerseKey objects
verse->setText(keyTextRegular);
verseNormalized->setText(keyTextRegular);
+ // check to see if they are equal
cout << *verse << ((*verse) == (*verseNormalized) ? " == " : " != ") << *verseNormalized << endl;
+ // now do the same for a reference which requires normalization in this module's v11n system
verse->setText(keyTextNeedsNormalization);
verseNormalized->setText(keyTextNeedsNormalization);
cout << *verse << ((*verse) == (*verseNormalized) ? " == " : " != ") << *verseNormalized << endl;
+ delete verse;
+ delete verseNormalized;
return 0;
}
More information about the sword-cvs
mailing list