The SWORD Project  1.9.0.svnversion
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
vs2osisreftxt.cpp
Go to the documentation of this file.
1 /******************************************************************************
2  *
3  * vs2osisreftext.cpp - Utility to translate a verse reference to an
4  * osisRef
5  *
6  * $Id: vs2osisreftxt.cpp 3063 2014-03-04 13:04:11Z chrislit $
7  *
8  * Copyright 2008-2013 CrossWire Bible Society (http://www.crosswire.org)
9  * CrossWire Bible Society
10  * P. O. Box 2528
11  * Tempe, AZ 85280-2528
12  *
13  * This program is free software; you can redistribute it and/or modify it
14  * under the terms of the GNU General Public License as published by the
15  * Free Software Foundation version 2.
16  *
17  * This program is distributed in the hope that it will be useful, but
18  * WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20  * General Public License for more details.
21  *
22  */
23 
24 #ifdef _MSC_VER
25  #pragma warning( disable: 4251 )
26 #endif
27 
28 #include <iostream>
29 #include <stdio.h>
30 
31 #include <versekey.h>
32 #include <localemgr.h>
33 
34 #ifndef NO_SWORD_NAMESPACE
35 using namespace sword;
36 #endif
37 
38 int main(int argc, char **argv) {
39  if ((argc < 2) || (argc > 4)) {
40  fprintf(stderr, "usage: %s <\"string to parse\"> [locale_name] [test-in-set-verse]\n", *argv);
41  exit(-1);
42  }
43 
44  if (argc > 2)
46 
47  VerseKey DefaultVSKey;
48 
49  DefaultVSKey = "jas3:1";
50 
51  ListKey verses = DefaultVSKey.parseVerseList(argv[1], DefaultVSKey, true);
52 
53  std::cout << verses.getOSISRefRangeText() << "\n";
54 
55  if (argc > 3) {
56  verses.setText(argv[3]);
57  std::cout << "Verse is" << ((verses.popError()) ? " NOT" : "") << " in set.\n\n";
58  }
59 
60  return 0;
61 }
virtual void setDefaultLocaleName(const char *name)
Definition: localemgr.cpp:251
int main(int argc, char **argv)
Definition: addcomment.cpp:32
static LocaleMgr * getSystemLocaleMgr()
Definition: localemgr.cpp:54