[sword-svn] r2651 - trunk/examples/classes
scribe at crosswire.org
scribe at crosswire.org
Thu Aug 4 12:05:10 MST 2011
Author: scribe
Date: 2011-08-04 12:05:09 -0700 (Thu, 04 Aug 2011)
New Revision: 2651
Added:
trunk/examples/classes/lastVerseInChapter.cpp
Modified:
trunk/examples/classes/Makefile
Log:
Added new example
Modified: trunk/examples/classes/Makefile
===================================================================
--- trunk/examples/classes/Makefile 2011-08-01 13:55:40 UTC (rev 2650)
+++ trunk/examples/classes/Makefile 2011-08-04 19:05:09 UTC (rev 2651)
@@ -1,4 +1,4 @@
-TARGETS= ciphercng swmgrex verseranges
+TARGETS= ciphercng swmgrex verseranges lastVerseInChapter
all: $(TARGETS)
clean:
Added: trunk/examples/classes/lastVerseInChapter.cpp
===================================================================
--- trunk/examples/classes/lastVerseInChapter.cpp (rev 0)
+++ trunk/examples/classes/lastVerseInChapter.cpp 2011-08-04 19:05:09 UTC (rev 2651)
@@ -0,0 +1,26 @@
+#include <swmgr.h>
+#include <swmodule.h>
+#include <versekey.h>
+#include <iostream>
+
+using namespace sword;
+using namespace std;
+
+int main(int argc, char **argv) {
+
+ SWMgr library;
+
+ SWModule *book = library.getModule("KJV");
+
+ VerseKey *vk = (VerseKey *) book->getKey();
+ for (;!vk->Error();vk->setChapter(vk->getChapter()+1)) {
+ vk->setVerse(vk->getVerseMax());
+ SWBuf text = book->StripText();
+ text = text.trim();
+ if (text.endsWith(",")) {
+ cout << vk->getText() << ":\n\n";
+ cout << text << endl;
+ }
+ }
+ return 0;
+}
More information about the sword-cvs
mailing list