[sword-svn] r2195 - in trunk: examples/cmdline include src/utilfuns
scribe at www.crosswire.org
scribe at www.crosswire.org
Wed Sep 10 17:20:59 MST 2008
Author: scribe
Date: 2008-09-10 17:20:58 -0700 (Wed, 10 Sep 2008)
New Revision: 2195
Modified:
trunk/examples/cmdline/outplain.cpp
trunk/include/listkey.h
trunk/include/rawcom.h
trunk/include/rawcom4.h
trunk/include/swkey.h
trunk/include/utilxml.h
trunk/include/versekey.h
trunk/src/utilfuns/utilxml.cpp
Log:
Applied DM's gloriously perfect patch to fix ++ --, copy c-tors and virtual sigs with defaults
Modified: trunk/examples/cmdline/outplain.cpp
===================================================================
--- trunk/examples/cmdline/outplain.cpp 2008-09-03 15:46:12 UTC (rev 2194)
+++ trunk/examples/cmdline/outplain.cpp 2008-09-11 00:20:58 UTC (rev 2195)
@@ -17,6 +17,7 @@
#include <swmgr.h>
#include <swmodule.h>
+#include <versekey.h>
using namespace sword;
using namespace std;
@@ -25,9 +26,17 @@
SWMgr manager; // create a default manager that looks in the current directory for mods.conf
const char *bookName = (argc > 1) ? argv[1] : "WLC";
- SWModule &book = *manager.getModule(bookName);
+ SWModule *b = manager.getModule(bookName);
+ if (!b) return -1;
+ SWModule &book = *b;
book.processEntryAttributes(false);
- for (book = TOP; !book.Error(); book++) {
- cout << book.getKeyText() << " " << book.StripText() << "\n";
+ VerseKey *vk = SWDYNAMIC_CAST(VerseKey, book.getKey());
+ for (book = TOP; !book.Error() && !book.getRawEntryBuf().size(); book++);
+ if (!book.getRawEntryBuf().size()) return -2; // empty module
+ for (;!book.Error(); book++) {
+ cout << "$$$";
+ if (vk) cout << vk->getOSISRef();
+ else cout << book.getKeyText();
+ cout << "\n" << book.StripText() << "\n\n";
}
}
Modified: trunk/include/listkey.h
===================================================================
--- trunk/include/listkey.h 2008-09-03 15:46:12 UTC (rev 2194)
+++ trunk/include/listkey.h 2008-09-11 00:20:58 UTC (rev 2195)
@@ -117,11 +117,11 @@
/** Decrements a number of elements
*/
- virtual void decrement(int step);
+ virtual void decrement(int step = 1);
/** Increments a number of elements
*/
- virtual void increment(int step);
+ virtual void increment(int step = 1);
virtual bool isTraversable() const { return true; }
virtual long Index() const { return arraypos; }
Modified: trunk/include/rawcom.h
===================================================================
--- trunk/include/rawcom.h 2008-09-03 15:46:12 UTC (rev 2194)
+++ trunk/include/rawcom.h 2008-09-11 00:20:58 UTC (rev 2195)
@@ -43,8 +43,8 @@
virtual SWBuf &getRawEntryBuf();
- virtual void increment(int steps);
- virtual void decrement(int steps) { increment(-steps); }
+ virtual void increment(int steps = 1);
+ virtual void decrement(int steps = 1) { increment(-steps); }
// write interface ----------------------------
virtual bool isWritable();
Modified: trunk/include/rawcom4.h
===================================================================
--- trunk/include/rawcom4.h 2008-09-03 15:46:12 UTC (rev 2194)
+++ trunk/include/rawcom4.h 2008-09-11 00:20:58 UTC (rev 2195)
@@ -43,8 +43,8 @@
virtual SWBuf &getRawEntryBuf();
- virtual void increment(int steps);
- virtual void decrement(int steps) { increment(-steps); }
+ virtual void increment(int steps = 1);
+ virtual void decrement(int steps = 1) { increment(-steps); }
// write interface ----------------------------
virtual bool isWritable();
Modified: trunk/include/swkey.h
===================================================================
--- trunk/include/swkey.h 2008-09-03 15:46:12 UTC (rev 2194)
+++ trunk/include/swkey.h 2008-09-11 00:20:58 UTC (rev 2195)
@@ -45,8 +45,10 @@
virtual bool operator <=(const SWKey &ikey) { return (compare(ikey) < 1); } \
SWKey &operator -=(int steps) { decrement(steps); return *this; } \
SWKey &operator +=(int steps) { increment(steps); return *this; } \
- SWKey &operator++(int) { return *this += 1; } \
- SWKey &operator--(int) { return *this -= 1; }
+ SWKey &operator ++() { increment(1); return *this; } \
+ SWKey operator ++(int) { SWKey temp = *this; increment(1); return temp; } \
+ SWKey &operator --() { decrement(1); return *this; } \
+ SWKey operator --(int) { SWKey temp = *this; decrement(1); return temp; }
/** For use with = operator to position key.
Modified: trunk/include/utilxml.h
===================================================================
--- trunk/include/utilxml.h 2008-09-03 15:46:12 UTC (rev 2194)
+++ trunk/include/utilxml.h 2008-09-11 00:20:58 UTC (rev 2195)
@@ -50,6 +50,7 @@
public:
XMLTag(const char *tagString = 0);
+ XMLTag(const XMLTag& tag);
~XMLTag();
void setText(const char *tagString);
Modified: trunk/include/versekey.h
===================================================================
--- trunk/include/versekey.h 2008-09-03 15:46:12 UTC (rev 2194)
+++ trunk/include/versekey.h 2008-09-11 00:20:58 UTC (rev 2195)
@@ -246,14 +246,14 @@
* @param steps Number of verses to jump backward
* @return *this
*/
- virtual void decrement(int steps);
+ virtual void decrement(int steps = 1);
/** Increments key a number of verses
*
* @param steps Number of verses to jump forward
* @return *this
*/
- virtual void increment(int steps);
+ virtual void increment(int steps = 1);
virtual bool isTraversable() const { return true; }
virtual const char *getBookName() const;
Modified: trunk/src/utilfuns/utilxml.cpp
===================================================================
--- trunk/src/utilfuns/utilxml.cpp 2008-09-03 15:46:12 UTC (rev 2194)
+++ trunk/src/utilfuns/utilxml.cpp 2008-09-11 00:20:58 UTC (rev 2195)
@@ -121,6 +121,22 @@
setText(tagString);
}
+XMLTag::XMLTag(const XMLTag& t) : attributes(t.attributes) {
+ parsed = t.parsed;
+ empty = t.empty;
+ endTag = t.endTag;
+ if (t.buf) {
+ int len = strlen(t.buf);
+ buf = new char[len + 1];
+ memcpy(buf, t.buf, len + 1);
+ }
+ if (t.name) {
+ int len = strlen(t.name);
+ name = new char[len + 1];
+ memcpy(name, t.name, len + 1);
+ }
+}
+
void XMLTag::setText(const char *tagString) {
parsed = false;
empty = false;
More information about the sword-cvs
mailing list