[sword-svn] r3481 - in trunk/examples: . tasks
scribe at crosswire.org
scribe at crosswire.org
Sun Jun 25 04:45:05 MST 2017
Author: scribe
Date: 2017-06-25 04:45:04 -0700 (Sun, 25 Jun 2017)
New Revision: 3481
Added:
trunk/examples/tasks/simpleverselookup.cpp
Removed:
trunk/examples/simple.cpp
Modified:
trunk/examples/tasks/CMakeLists.txt
trunk/examples/tasks/Makefile.am
Log:
moved simple.cpp to tasts/simpleverselookup.cpp
also updated CMakeList.txt to build new examples
Deleted: trunk/examples/simple.cpp
===================================================================
--- trunk/examples/simple.cpp 2017-06-25 11:44:29 UTC (rev 3480)
+++ trunk/examples/simple.cpp 2017-06-25 11:45:04 UTC (rev 3481)
@@ -1,54 +0,0 @@
-/******************************************************************************
- *
- * simple.cpp - This is about the simplest useful example of using the
- * SWORD engine.
- *
- * After sword is installed, it should compile with something similar to:
- *
- * g++ -o simple simple.cpp `pkg-config --cflags --libs sword`
- *
- * If you'd like to choose the type of tag markup which sword will output
- * for you, include:
- *
- * #include <markupfiltmgr.h>
- *
- * and change your instantiation of SWMgr, below, to (e.g., for HTML):
- *
- * SWMgr library(0, 0, true, new MarkupFilterMgr(FMT_HTMLHREF));
- *
- * $Id$
- *
- * Copyright 2006-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 <swmgr.h>
-#include <swmodule.h>
-#include <iostream>
-
-
-using namespace sword;
-using std::cout;
-
-
-int main(int argc, char **argv) {
- SWMgr library;
- SWModule *darby = library.getModule("Darby");
- darby->setKey("James 1:19");
- cout << darby->RenderText();
-
- return 0;
-}
-
Modified: trunk/examples/tasks/CMakeLists.txt
===================================================================
--- trunk/examples/tasks/CMakeLists.txt 2017-06-25 11:44:29 UTC (rev 3480)
+++ trunk/examples/tasks/CMakeLists.txt 2017-06-25 11:45:04 UTC (rev 3481)
@@ -6,6 +6,8 @@
MESSAGE(STATUS "\n-- CONFIGURING LIBRARY EXAMPLES")
SET(example_PROGRAMS
parallelbibles
+ simpleverselookup
+ listbiblebooknames
)
FOREACH(DEMO ${example_PROGRAMS})
Modified: trunk/examples/tasks/Makefile.am
===================================================================
--- trunk/examples/tasks/Makefile.am 2017-06-25 11:44:29 UTC (rev 3480)
+++ trunk/examples/tasks/Makefile.am 2017-06-25 11:45:04 UTC (rev 3481)
@@ -5,7 +5,8 @@
endif
LDADD = $(top_builddir)/lib/libsword.la
-noinst_PROGRAMS = parallelbibles listbiblebooknames
+noinst_PROGRAMS = parallelbibles listbiblebooknames simpleverselookup
parallelbibles_SOURCES = parallelbibles.cpp
listbiblebooknames_SOURCES = listbiblebooknames.cpp
+simpleverselookup_SOURCES = simpleverselookup.cpp
Copied: trunk/examples/tasks/simpleverselookup.cpp (from rev 3480, trunk/examples/simple.cpp)
===================================================================
--- trunk/examples/tasks/simpleverselookup.cpp (rev 0)
+++ trunk/examples/tasks/simpleverselookup.cpp 2017-06-25 11:45:04 UTC (rev 3481)
@@ -0,0 +1,65 @@
+/******************************************************************************
+ *
+ * simple.cpp - This is about the simplest useful example of using the
+ * SWORD engine.
+ *
+ * After sword is installed, it should compile with something similar to:
+ *
+ * g++ -o simple simple.cpp `pkg-config --cflags --libs sword`
+ *
+ * If you'd like to choose the type of tag markup which sword will output
+ * for you, include:
+ *
+ * #include <markupfiltmgr.h>
+ *
+ * and change your instantiation of SWMgr, below, to (e.g., for HTML):
+ *
+ * SWMgr library(0, 0, true, new MarkupFilterMgr(FMT_HTMLHREF));
+ *
+ * $Id$
+ *
+ * Copyright 2006-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.
+ *
+ */
+
+// Simple example to show James 1:19 from KJV,
+// if argv[1] is passed then use this instead of KJV
+// if argv[2] is passed then use this instead of James 1:19
+
+#include <swmgr.h>
+#include <swmodule.h>
+#include <iostream>
+
+
+using namespace sword;
+using std::cout;
+
+
+int main(int argc, char **argv) {
+ // instantiate a SWORD Manager to give access to the installed library of books (modules)
+ SWMgr library;
+
+ // try to retrieve a reference to an installed book (module)
+ SWModule *book = library.getModule((argc > 1) ? argv[1] : "KJV");
+
+ // set that book's reference key to our desired verse
+ book->setKey((argc > 2) ? argv[2] : "James 1:19");
+
+ // ask the book to render the current text
+ cout << book->renderText() << "\n";
+
+ return 0;
+}
+
More information about the sword-cvs
mailing list