diff options
author | Roberto C. Sanchez <roberto@connexer.com> | 2014-03-29 10:54:01 -0400 |
---|---|---|
committer | Roberto C. Sanchez <roberto@connexer.com> | 2014-03-29 10:54:01 -0400 |
commit | 71a39f4652cd51df814c930dd268f3c9ad2aee86 (patch) | |
tree | 5994350a603908c4e4d660bc9d72c4ec43dd648e /tests/parsekey.cpp | |
parent | 03134fa5f6f25d92724ce4c183f9bbe12a9e37dc (diff) |
Imported Upstream version 1.6.0+dfsg
Diffstat (limited to 'tests/parsekey.cpp')
-rw-r--r-- | tests/parsekey.cpp | 51 |
1 files changed, 38 insertions, 13 deletions
diff --git a/tests/parsekey.cpp b/tests/parsekey.cpp index 16b97c0..99a4340 100644 --- a/tests/parsekey.cpp +++ b/tests/parsekey.cpp @@ -1,16 +1,33 @@ +/* + * Copyright 2009 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 <stdio.h> -#include <stdlib.h> #include <versekey.h> #include <localemgr.h> +#include <swlog.h> + #ifndef NO_SWORD_NAMESPACE using namespace sword; #endif int main(int argc, char **argv) { if ((argc < 2) || (argc > 4)) { - fprintf(stderr, "usage: %s <\"string to parse\"> [locale name] [test-in-set-verse]\n", *argv); + fprintf(stderr, "usage: %s <\"string to parse\"> [locale_name] [v11n] [test-in-set-verse]\n", *argv); exit(-1); } @@ -18,24 +35,32 @@ int main(int argc, char **argv) { LocaleMgr::getSystemLocaleMgr()->setDefaultLocaleName(argv[2]); VerseKey DefaultVSKey; +// DefaultVSKey.AutoNormalize(0); + + if (argc > 3) + DefaultVSKey.setVersificationSystem(argv[3]); + + SWLog::getSystemLog()->setLogLevel(SWLog::LOG_DEBUG); + DefaultVSKey.validateCurrentLocale(); DefaultVSKey = "jas3:1"; ListKey verses = DefaultVSKey.ParseVerseList(argv[1], DefaultVSKey, true); + for (int i = 1; i < argc; i++) { + if (i > 1) std::cout << " "; + std::cout << argv[i]; + } + std::cout << ": "; + std::cout << verses.getRangeText() << "\n"; +/* for (int i = 0; i < verses.Count(); i++) { - VerseKey *element = SWDYNAMIC_CAST(VerseKey, verses.GetElement(i)); - if (element) { - std::cout << (SWBuf(element->LowerBound()) + " - " + SWBuf(element->UpperBound())).c_str() << "\n"; - } - else std::cout << (const char *)*verses.GetElement(i) << "\n"; -// else { -// std::cout << VerseKey(verses.GetElement(i)).getOSISRef() << "\n"; -// } + std::cout << verses.GetElement(i)->getRangeText() << "\n"; } +*/ - if (argc > 3) { - verses.setText(argv[3]); + if (argc > 4) { + verses.setText(argv[4]); std::cout << "Verse is" << ((verses.Error()) ? " NOT" : "") << " in set.\n\n"; } |