[sword-svn] r3480 - trunk/examples/tasks
scribe at crosswire.org
scribe at crosswire.org
Sun Jun 25 04:44:30 MST 2017
Author: scribe
Date: 2017-06-25 04:44:29 -0700 (Sun, 25 Jun 2017)
New Revision: 3480
Added:
trunk/examples/tasks/listbiblebooknames.cpp
Modified:
trunk/examples/tasks/Makefile.am
Log:
added listbiblebooknames example
Modified: trunk/examples/tasks/Makefile.am
===================================================================
--- trunk/examples/tasks/Makefile.am 2017-06-25 11:44:01 UTC (rev 3479)
+++ trunk/examples/tasks/Makefile.am 2017-06-25 11:44:29 UTC (rev 3480)
@@ -5,7 +5,7 @@
endif
LDADD = $(top_builddir)/lib/libsword.la
-noinst_PROGRAMS = parallelbibles
+noinst_PROGRAMS = parallelbibles listbiblebooknames
parallelbibles_SOURCES = parallelbibles.cpp
-
+listbiblebooknames_SOURCES = listbiblebooknames.cpp
Added: trunk/examples/tasks/listbiblebooknames.cpp
===================================================================
--- trunk/examples/tasks/listbiblebooknames.cpp (rev 0)
+++ trunk/examples/tasks/listbiblebooknames.cpp 2017-06-25 11:44:29 UTC (rev 3480)
@@ -0,0 +1,57 @@
+/******************************************************************************
+ *
+ * verseranges.cpp - This example demonstrates how to work with contiguous
+ * verse ranges using VerseKey
+ *
+ * $Id$
+ *
+ * Copyright 2011-2013 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#include <iostream>
+
+#include <swmgr.h>
+#include <swmodule.h>
+#include <versekey.h>
+
+
+using namespace sword;
+using namespace std;
+
+
+int main(int argc, char **argv) {
+
+ cout << "\n";
+
+ const char *modName = (argc > 1) ? argv[1] : "KJV";
+ SWMgr manager;
+ SWModule *bible = manager.getModule(modName);
+ if (!bible) {
+ cout << modName << " module is not installed.\nPlease install to show versification (v11n) from this specific Bible.\nShowing builtin KJV v11n scheme..\n\n";
+ }
+
+ VerseKey *vk = (bible) ? (VerseKey *)bible->getKey() : new VerseKey();
+
+ for ((*vk) = TOP; !vk->popError(); vk->setBook(vk->getBook()+1)) {
+ cout << vk->getBookName() << "\n";
+ }
+
+ // if we 'new'ed a VerseKey unassociated with a module, above, then we should delete it.
+ if (!bible) delete vk;
+
+ return 0;
+}
+
More information about the sword-cvs
mailing list