summaryrefslogtreecommitdiff
path: root/utilities/vpl2mod.cpp
diff options
context:
space:
mode:
authorRoberto C. Sanchez <roberto@connexer.com>2014-05-12 08:21:30 -0400
committerRoberto C. Sanchez <roberto@connexer.com>2014-05-12 08:21:30 -0400
commit7a00574163029c0c2b649878c95d5acbd083564a (patch)
treec13cc5736025834df2874ed87ee8598070025ea6 /utilities/vpl2mod.cpp
parentb745315323de9f27538edac9453205ca70e6186e (diff)
Imported Upstream version 1.7.2+dfsg
Diffstat (limited to 'utilities/vpl2mod.cpp')
-rw-r--r--utilities/vpl2mod.cpp38
1 files changed, 21 insertions, 17 deletions
diff --git a/utilities/vpl2mod.cpp b/utilities/vpl2mod.cpp
index e2fca09..c696541 100644
--- a/utilities/vpl2mod.cpp
+++ b/utilities/vpl2mod.cpp
@@ -1,5 +1,10 @@
-/*
- * Copyright 2009 CrossWire Bible Society (http://www.crosswire.org)
+/******************************************************************************
+ *
+ * vpl2mod.cpp - Utility to import VPL formatted modules
+ *
+ * $Id: vpl2mod.cpp 2921 2013-07-28 17:21:44Z scribe $
+ *
+ * Copyright 2000-2013 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
* P. O. Box 2528
* Tempe, AZ 85280-2528
@@ -36,8 +41,7 @@
#include <filemgr.h>
#include <swmgr.h>
#include <rawtext.h>
-#include <iostream>
-#include <string>
+#include <swbuf.h>
#include <versekey.h>
#ifndef NO_SWORD_NAMESPACE
@@ -45,10 +49,10 @@ using sword::FileMgr;
using sword::SWMgr;
using sword::RawText;
using sword::VerseKey;
+using sword::SWBuf;
using sword::SW_POSITION;
#endif
-using std::string;
char readline(int fd, char **buf) {
char ch;
@@ -130,14 +134,14 @@ char *parseVReg(char *buf) {
bool isKJVRef(const char *buf) {
VerseKey vk, test;
- vk.AutoNormalize(0);
- vk.Headings(1); // turn on mod/testmnt/book/chap headings
- vk.Persist(1);
+ vk.setAutoNormalize(false);
+ vk.setIntros(true); // turn on mod/testmnt/book/chap headings
+ vk.setPersist(true);
// lets do some tests on the verse --------------
vk = buf;
test = buf;
- if (vk.Testament() && vk.Book() && vk.Chapter() && vk.Verse()) { // if we're not a heading
+ if (vk.getTestament() && vk.getBook() && vk.getChapter() && vk.getVerse()) { // if we're not a heading
// std::cerr << (const char*)vk << " == " << (const char*)test << std::endl;
return (vk == test);
}
@@ -213,9 +217,9 @@ int main(int argc, char **argv) {
char *buffer = 0;
RawText mod(argv[2]); // open our datapath with our RawText driver.
VerseKey vk;
- vk.AutoNormalize(0);
- vk.Headings(1); // turn on mod/testmnt/book/chap headings
- vk.Persist(1);
+ vk.setAutoNormalize(false);
+ vk.setIntros(true); // turn on mod/testmnt/book/chap headings
+ vk.setPersist(true);
mod.setKey(vk);
@@ -225,7 +229,7 @@ int main(int argc, char **argv) {
if (ntonly) vk = "Matthew 1:1";
int successive = 0; //part of hack below
- while ((!mod.Error()) && (!readline(fd, &buffer))) {
+ while ((!mod.popError()) && (!readline(fd, &buffer))) {
if (*buffer == '|') // comments, ignore line
continue;
if (vref) {
@@ -236,11 +240,11 @@ int main(int argc, char **argv) {
}
vk = buffer;
- if (vk.Error()) {
+ if (vk.popError()) {
std::cerr << "Error parsing key: " << buffer << "\n";
exit(-5);
}
- string orig = mod.getRawEntry();
+ SWBuf orig = mod.getRawEntry();
if (!isKJVRef(buffer)) {
VerseKey origVK = vk;
@@ -248,7 +252,7 @@ int main(int argc, char **argv) {
do {
vk--;
}
- while (!vk.Error() && !isKJVRef(vk)); */
+ while (!vk.popError() && !isKJVRef(vk)); */
//hack to replace above:
successive++;
vk -= successive;
@@ -261,7 +265,7 @@ int main(int argc, char **argv) {
orig += ") ";
orig += verseText;
orig += " ] ";
- verseText = orig.c_str();
+ verseText = orig;
}
else {
successive = 0;