diff options
author | Teus Benschop <teusjannette@gmail.com> | 2018-11-10 21:10:09 +0700 |
---|---|---|
committer | Teus Benschop <teusjannette@gmail.com> | 2018-11-10 21:10:09 +0700 |
commit | 2a58bdf9b682f462b63be719fc441a679f7d52f3 (patch) | |
tree | 4b8fce727ab045eef1a846659bb90f18719477e6 /examples/classes | |
parent | 018216c25c73b221df0810e6c909623abd46c321 (diff) | |
parent | 70090da73f95ee90e15650d853744526b5f47e68 (diff) |
Record sword (1.8.1+dfsg-7) in archive suite sid
Diffstat (limited to 'examples/classes')
-rw-r--r-- | examples/classes/Makefile | 2 | ||||
-rw-r--r-- | examples/classes/flatapiinstallmgr.cpp | 48 | ||||
-rw-r--r-- | examples/classes/flatapilookup.c | 2 | ||||
-rw-r--r-- | examples/classes/flatapiparsekey.c | 2 | ||||
-rw-r--r-- | examples/classes/flatapisearch.c | 2 | ||||
-rw-r--r-- | examples/classes/simplechapter.cpp | 2 | ||||
-rw-r--r-- | examples/classes/versenorm.cpp | 72 |
7 files changed, 125 insertions, 5 deletions
diff --git a/examples/classes/Makefile b/examples/classes/Makefile index c626fb0..04e3457 100644 --- a/examples/classes/Makefile +++ b/examples/classes/Makefile @@ -1,4 +1,4 @@ -TARGETS= ciphercng swmgrex verseranges lastVerseInChapter verseposition simplechapter flatapilookup flatapiparsekey flatapisearch +TARGETS= ciphercng swmgrex verseranges lastVerseInChapter verseposition simplechapter flatapilookup flatapiparsekey flatapisearch versenorm flatapiinstallmgr all: $(TARGETS) clean: diff --git a/examples/classes/flatapiinstallmgr.cpp b/examples/classes/flatapiinstallmgr.cpp new file mode 100644 index 0000000..6541063 --- /dev/null +++ b/examples/classes/flatapiinstallmgr.cpp @@ -0,0 +1,48 @@ +/****************************************************************************** + * + * flatapilookup.c - + * + * $Id$ + * + * Copyright 2014 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 <stdio.h> +#include <stdlib.h> + +#include <flatapi.h> + +int main(int argc, char **argv) { + if (argc != 4) { + fprintf(stderr, "\nusage: %s \"<sourceName>\" <\"modName\"> \"<destPath>\"\n" + "\tExample: CrossWire KJV ~/library\n\n", argv[0]); + exit(-1); + } + + + SWHANDLE mgr = org_crosswire_sword_SWMgr_newWithPath(argv[3]); + + SWHANDLE instMgr = org_crosswire_sword_InstallMgr_new("/home/scribe/.sword/InstallMgr", 0); + + org_crosswire_sword_InstallMgr_setUserDisclaimerConfirmed(instMgr); + + fprintf(stdout, "Install returned: %d\n", org_crosswire_sword_InstallMgr_remoteInstallModule(instMgr, mgr, argv[1], argv[2])); + + org_crosswire_sword_SWMgr_delete(mgr); + org_crosswire_sword_InstallMgr_delete(instMgr); + + return 0; +} diff --git a/examples/classes/flatapilookup.c b/examples/classes/flatapilookup.c index b76e7e2..9afde22 100644 --- a/examples/classes/flatapilookup.c +++ b/examples/classes/flatapilookup.c @@ -2,7 +2,7 @@ * * flatapilookup.c - * - * $Id: flatapilookup.c 3162 2014-04-17 04:05:54Z greg.hellings $ + * $Id: flatapilookup.c 3097 2014-03-11 11:40:13Z scribe $ * * Copyright 2014 CrossWire Bible Society (http://www.crosswire.org) * CrossWire Bible Society diff --git a/examples/classes/flatapiparsekey.c b/examples/classes/flatapiparsekey.c index a8616a2..41f7118 100644 --- a/examples/classes/flatapiparsekey.c +++ b/examples/classes/flatapiparsekey.c @@ -2,7 +2,7 @@ * * flatapiparsekey.c - * - * $Id: flatapiparsekey.c 3162 2014-04-17 04:05:54Z greg.hellings $ + * $Id: flatapiparsekey.c 3097 2014-03-11 11:40:13Z scribe $ * * Copyright 2014 CrossWire Bible Society (http://www.crosswire.org) * CrossWire Bible Society diff --git a/examples/classes/flatapisearch.c b/examples/classes/flatapisearch.c index 59e0074..715d6bc 100644 --- a/examples/classes/flatapisearch.c +++ b/examples/classes/flatapisearch.c @@ -2,7 +2,7 @@ * * flatapisearch.c - * - * $Id: flatapisearch.c 3165 2014-04-17 04:07:57Z greg.hellings $ + * $Id: flatapisearch.c 3102 2014-03-12 04:55:44Z chrislit $ * * Copyright 2014 CrossWire Bible Society (http://www.crosswire.org) * CrossWire Bible Society diff --git a/examples/classes/simplechapter.cpp b/examples/classes/simplechapter.cpp index 2178181..489f730 100644 --- a/examples/classes/simplechapter.cpp +++ b/examples/classes/simplechapter.cpp @@ -2,7 +2,7 @@ * * simplechapter.cpp - * - * $Id: simplechapter.cpp 3156 2014-04-17 03:50:37Z greg.hellings $ + * $Id: simplechapter.cpp 3045 2014-03-02 07:53:52Z chrislit $ * * Copyright 2013-2014 CrossWire Bible Society (http://www.crosswire.org) * CrossWire Bible Society diff --git a/examples/classes/versenorm.cpp b/examples/classes/versenorm.cpp new file mode 100644 index 0000000..08bad54 --- /dev/null +++ b/examples/classes/versenorm.cpp @@ -0,0 +1,72 @@ +/****************************************************************************** + * + * versenorm.cpp - checks normalization of verse to module + * + * $Id$ + * + * Copyright 2012-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) { + + 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; +} |