[sword-svn] r3808 - in trunk: include src/frontend src/keys src/modules/comments src/modules/comments/hrefcom src/modules/comments/rawcom src/modules/comments/rawcom4 src/modules/comments/rawfiles src/modules/comments/zcom src/modules/comments/zcom4 src/modules/filters src/modules/genbook src/modules/genbook/rawgenbook src/modules/texts src/modules/texts/rawtext src/modules/texts/rawtext4 src/modules/texts/ztext src/modules/texts/ztext4 src/utilfuns utilities/diatheke
scribe at crosswire.org
scribe at crosswire.org
Fri Oct 2 09:23:34 EDT 2020
Author: scribe
Date: 2020-10-02 09:23:34 -0400 (Fri, 02 Oct 2020)
New Revision: 3808
Modified:
trunk/include/defs.h
trunk/include/encfiltmgr.h
trunk/include/listkey.h
trunk/include/strkey.h
trunk/include/swcom.h
trunk/include/swdisp.h
trunk/include/swgenbook.h
trunk/include/swkey.h
trunk/include/swmodule.h
trunk/include/swobject.h
trunk/include/swtext.h
trunk/include/swversion.h
trunk/include/treekey.h
trunk/include/treekeyidx.h
trunk/include/versekey.h
trunk/include/versetreekey.h
trunk/src/frontend/swdisp.cpp
trunk/src/keys/listkey.cpp
trunk/src/keys/strkey.cpp
trunk/src/keys/swkey.cpp
trunk/src/keys/treekey.cpp
trunk/src/keys/treekeyidx.cpp
trunk/src/keys/versekey.cpp
trunk/src/keys/versetreekey.cpp
trunk/src/modules/comments/hrefcom/hrefcom.cpp
trunk/src/modules/comments/rawcom/rawcom.cpp
trunk/src/modules/comments/rawcom4/rawcom4.cpp
trunk/src/modules/comments/rawfiles/rawfiles.cpp
trunk/src/modules/comments/swcom.cpp
trunk/src/modules/comments/zcom/zcom.cpp
trunk/src/modules/comments/zcom4/zcom4.cpp
trunk/src/modules/filters/gbfosis.cpp
trunk/src/modules/filters/gbfwordjs.cpp
trunk/src/modules/filters/osisosis.cpp
trunk/src/modules/filters/osisstrongs.cpp
trunk/src/modules/filters/osiswordjs.cpp
trunk/src/modules/filters/swbasicfilter.cpp
trunk/src/modules/filters/thmlosis.cpp
trunk/src/modules/filters/thmlwordjs.cpp
trunk/src/modules/genbook/rawgenbook/rawgenbook.cpp
trunk/src/modules/genbook/swgenbook.cpp
trunk/src/modules/texts/rawtext/rawtext.cpp
trunk/src/modules/texts/rawtext4/rawtext4.cpp
trunk/src/modules/texts/swtext.cpp
trunk/src/modules/texts/ztext/ztext.cpp
trunk/src/modules/texts/ztext4/ztext4.cpp
trunk/src/utilfuns/swobject.cpp
trunk/utilities/diatheke/osiscgi.cpp
Log:
improved implementation of SWClass to hide more of the implementation
defaulted SWDYNAMIC_CAST to use compiler dynamic_cast
improved const safety
Modified: trunk/include/defs.h
===================================================================
--- trunk/include/defs.h 2020-09-27 12:59:54 UTC (rev 3807)
+++ trunk/include/defs.h 2020-10-02 13:23:34 UTC (rev 3808)
@@ -25,6 +25,7 @@
#ifndef SWORDDEFS_H
#define SWORDDEFS_H
+// support for compilers with no namespace support
// TODO: What is this? jansorg, why does NO_SWORD_NAMESPACE still define
// a C++ namespace, and then force using it? This makes no sense to me.
// see commit 1195
@@ -41,6 +42,16 @@
SWORD_NAMESPACE_START
+
+// support for compilers with no RTTI
+#define SWDYNAMIC_CAST(className, object) dynamic_cast<className *>(object)
+
+#ifdef NODYNCAST
+#define SWDYNAMIC_CAST(className, object) (className *)((object)?((object->getClass()->isAssignableFrom(#className))?object:0):0)
+#endif
+
+
+// support for compilers with no exception support
#define SWTRY try
#define SWCATCH(x) catch (x)
@@ -58,6 +69,7 @@
#define SWCATCH(x) if (0)
#endif
+// support for export / import of symbols from shared objects
// _declspec works in BC++ 5 and later, as well as VC++
#if defined(_MSC_VER)
@@ -75,6 +87,7 @@
# define SWDLLEXPORT_CTORFN
# endif
+// support for deprecated annotation
# define SWDEPRECATED __declspec(deprecated("** WARNING: deprecated method **"))
@@ -165,14 +178,5 @@
# define SWDLLIMPORT
#endif
-
-
-#ifdef __cplusplus
-enum {DIRECTION_LTR = 0, DIRECTION_RTL, DIRECTION_BIDI};
-enum {FMT_UNKNOWN = 0, FMT_PLAIN, FMT_THML, FMT_GBF, FMT_HTML, FMT_HTMLHREF, FMT_RTF, FMT_OSIS, FMT_WEBIF, FMT_TEI, FMT_XHTML, FMT_LATEX};
-enum {ENC_UNKNOWN = 0, ENC_LATIN1, ENC_UTF8, ENC_SCSU, ENC_UTF16, ENC_RTF, ENC_HTML};
-enum {BIB_BIBTEX = 0, /* possible future formats: BIB_MARCXML, BIB_MARC21, BIB_DCMI BIB_OSISHEADER, BIB_SBL_XHTML, BIB_MLA_XHTML, BIB_APA_XHTML, BIB_CHICAGO_XHTML */};
-#endif
-
SWORD_NAMESPACE_END
#endif //SWORDDEFS_H
Modified: trunk/include/encfiltmgr.h
===================================================================
--- trunk/include/encfiltmgr.h 2020-09-27 12:59:54 UTC (rev 3807)
+++ trunk/include/encfiltmgr.h 2020-10-02 13:23:34 UTC (rev 3808)
@@ -25,6 +25,7 @@
#ifndef ENCFILTERMGR_H
#define ENCFILTERMGR_H
+#include <swmodule.h>
#include <swfiltermgr.h>
SWORD_NAMESPACE_START
Modified: trunk/include/listkey.h
===================================================================
--- trunk/include/listkey.h 2020-09-27 12:59:54 UTC (rev 3807)
+++ trunk/include/listkey.h 2020-10-02 13:23:34 UTC (rev 3808)
@@ -37,7 +37,6 @@
*/
class SWDLLEXPORT ListKey : public SWKey {
- static SWClass classdef;
void init();
protected:
Modified: trunk/include/strkey.h
===================================================================
--- trunk/include/strkey.h 2020-09-27 12:59:54 UTC (rev 3807)
+++ trunk/include/strkey.h 2020-10-02 13:23:34 UTC (rev 3808)
@@ -37,7 +37,6 @@
class SWDLLEXPORT StrKey : public SWKey {
private:
- static SWClass classdef;
void init();
public:
Modified: trunk/include/swcom.h
===================================================================
--- trunk/include/swcom.h 2020-09-27 12:59:54 UTC (rev 3807)
+++ trunk/include/swcom.h 2020-10-02 13:23:34 UTC (rev 3808)
@@ -55,7 +55,8 @@
char *versification;
protected:
- VerseKey &getVerseKey(const SWKey *key = 0) const;
+ VerseKey &getVerseKey(SWKey *key = 0);
+ const VerseKey &getVerseKey(const SWKey *key = 0) const;
public:
Modified: trunk/include/swdisp.h
===================================================================
--- trunk/include/swdisp.h 2020-09-27 12:59:54 UTC (rev 3807)
+++ trunk/include/swdisp.h 2020-10-02 13:23:34 UTC (rev 3808)
@@ -36,11 +36,9 @@
*/
class SWDLLEXPORT SWDisplay : public SWObject {
- static SWClass classdef;
-
public:
- SWDisplay() { myclass = &classdef; };
- virtual ~SWDisplay() {};
+ SWDisplay();
+ virtual ~SWDisplay() { };
/** casts a module to a character pointer and displays it to
* raw output (overriden for different display types and
Modified: trunk/include/swgenbook.h
===================================================================
--- trunk/include/swgenbook.h 2020-09-27 12:59:54 UTC (rev 3807)
+++ trunk/include/swgenbook.h 2020-10-02 13:23:34 UTC (rev 3808)
@@ -39,7 +39,7 @@
protected:
mutable char *entkeytxt;
mutable TreeKey *tmpTreeKey;
- TreeKey &getTreeKey(const SWKey *k = 0) const;
+ const TreeKey &getTreeKey(const SWKey *k = 0) const;
public:
/** Initializes data for instance of SWGenBook
Modified: trunk/include/swkey.h
===================================================================
--- trunk/include/swkey.h 2020-09-27 12:59:54 UTC (rev 3807)
+++ trunk/include/swkey.h 2020-10-02 13:23:34 UTC (rev 3808)
@@ -95,7 +95,6 @@
long index;
- static SWClass classdef;
void init();
@@ -158,7 +157,7 @@
*/
SWDEPRECATED char Error() { return popError(); }
virtual char popError();
- virtual char getError() { return error; }
+ virtual char getError() const { return error; }
virtual void setError(char err) { error = err; }
/** Sets this SWKey with a character string
Modified: trunk/include/swmodule.h
===================================================================
--- trunk/include/swmodule.h 2020-09-27 12:59:54 UTC (rev 3807)
+++ trunk/include/swmodule.h 2020-10-02 13:23:34 UTC (rev 3808)
@@ -40,6 +40,13 @@
SWORD_NAMESPACE_START
+
+enum {DIRECTION_LTR = 0, DIRECTION_RTL, DIRECTION_BIDI};
+enum {FMT_UNKNOWN = 0, FMT_PLAIN, FMT_THML, FMT_GBF, FMT_HTML, FMT_HTMLHREF, FMT_RTF, FMT_OSIS, FMT_WEBIF, FMT_TEI, FMT_XHTML, FMT_LATEX};
+enum {ENC_UNKNOWN = 0, ENC_LATIN1, ENC_UTF8, ENC_SCSU, ENC_UTF16, ENC_RTF, ENC_HTML};
+enum {BIB_BIBTEX = 0, /* possible future formats: BIB_MARCXML, BIB_MARC21, BIB_DCMI BIB_OSISHEADER, BIB_SBL_XHTML, BIB_MLA_XHTML, BIB_APA_XHTML, BIB_CHICAGO_XHTML */};
+
+
class SWOptionFilter;
class SWFilter;
Modified: trunk/include/swobject.h
===================================================================
--- trunk/include/swobject.h 2020-09-27 12:59:54 UTC (rev 3807)
+++ trunk/include/swobject.h 2020-10-02 13:23:34 UTC (rev 3808)
@@ -27,7 +27,6 @@
#include <defs.h>
SWORD_NAMESPACE_START
-#define SWDYNAMIC_CAST(className, object) (className *)((object)?((object->getClass()->isAssignableFrom(#className))?object:0):0)
/**
* Class used for SWDYNAMIC_CAST to save the inheritance order.
@@ -53,14 +52,16 @@
class SWDLLEXPORT SWObject {
protected:
- SWClass * myclass;
+ const SWClass *myClass;
public:
+// SWObject();
+ SWObject(const SWClass &classdef);
/** Use this to get the class definition and inheritance order.
* @return The class definition of this object
*/
const SWClass *getClass() const {
- return myclass;
+ return myClass;
}
};
Modified: trunk/include/swtext.h
===================================================================
--- trunk/include/swtext.h 2020-09-27 12:59:54 UTC (rev 3807)
+++ trunk/include/swtext.h 2020-10-02 13:23:34 UTC (rev 3808)
@@ -43,7 +43,8 @@
char *versification;
protected:
- VerseKey &getVerseKey(const SWKey* key=0) const;
+ const VerseKey &getVerseKey(const SWKey *key=0) const;
+ VerseKey &getVerseKey(SWKey *key=0);
public:
/** Initializes data for instance of SWText
Modified: trunk/include/swversion.h
===================================================================
--- trunk/include/swversion.h 2020-09-27 12:59:54 UTC (rev 3807)
+++ trunk/include/swversion.h 2020-10-02 13:23:34 UTC (rev 3808)
@@ -24,12 +24,12 @@
#ifndef SWVERSION_H
#define SWVERSION_H
-#define SWORD_VERSION_NUM 1089023800
-#define SWORD_VERSION_STR "1.8.902.3800"
+#define SWORD_VERSION_NUM 1089023801
+#define SWORD_VERSION_STR "1.8.902.3801"
#define SWORD_VERSION_MAJOR 1
#define SWORD_VERSION_MINOR 8
#define SWORD_VERSION_MICRO 902
-#define SWORD_VERSION_NANO 3800
+#define SWORD_VERSION_NANO 3801
#include <defs.h>
SWORD_NAMESPACE_START
Modified: trunk/include/treekey.h
===================================================================
--- trunk/include/treekey.h 2020-09-27 12:59:54 UTC (rev 3807)
+++ trunk/include/treekey.h 2020-10-02 13:23:34 UTC (rev 3808)
@@ -1,4 +1,4 @@
-/******************************************************************************
+ /******************************************************************************
*
* treekey.h - class TreeKey: an SWKey for traversing a table of contents
*
@@ -38,7 +38,6 @@
class SWDLLEXPORT TreeKey : public SWKey {
private:
- static SWClass classdef;
void init();
protected:
Modified: trunk/include/treekeyidx.h
===================================================================
--- trunk/include/treekeyidx.h 2020-09-27 12:59:54 UTC (rev 3807)
+++ trunk/include/treekeyidx.h 2020-10-02 13:23:34 UTC (rev 3808)
@@ -53,8 +53,6 @@
char *userData;
} currentNode;
- static SWClass classdef;
-
char *path;
FileDesc *idxfd;
Modified: trunk/include/versekey.h
===================================================================
--- trunk/include/versekey.h 2020-09-27 12:59:54 UTC (rev 3807)
+++ trunk/include/versekey.h 2020-10-02 13:23:34 UTC (rev 3808)
@@ -53,8 +53,6 @@
class SWDLLEXPORT VerseKey : public SWKey {
private:
- static SWClass classdef;
-
/** number of instantiated VerseKey objects or derivitives
*/
static int instance;
Modified: trunk/include/versetreekey.h
===================================================================
--- trunk/include/versetreekey.h 2020-09-27 12:59:54 UTC (rev 3807)
+++ trunk/include/versetreekey.h 2020-10-02 13:23:34 UTC (rev 3808)
@@ -42,12 +42,11 @@
class SWDLLEXPORT VerseTreeKey : public VerseKey, public TreeKey::PositionChangeListener {
private:
- static SWClass classdef;
TreeKey *treeKey;
// vector<struct sbook> books;
void init(TreeKey *treeKey);
- void syncVerseToTree();
+ void syncVerseToTree() const;
long lastGoodOffset;
protected:
@@ -103,10 +102,11 @@
virtual bool isTraversable() const { return true; }
virtual TreeKey *getTreeKey();
+ virtual const TreeKey *getTreeKey() const;
// TreeKey::PositionChangeListener interface
virtual void positionChanged();
- bool internalPosChange;
+ mutable bool internalPosChange;
virtual void decrement(int steps = 1);
virtual void increment(int steps = 1);
Modified: trunk/src/frontend/swdisp.cpp
===================================================================
--- trunk/src/frontend/swdisp.cpp 2020-09-27 12:59:54 UTC (rev 3807)
+++ trunk/src/frontend/swdisp.cpp 2020-10-02 13:23:34 UTC (rev 3808)
@@ -29,8 +29,10 @@
SWORD_NAMESPACE_START
static const char *classes[] = {"SWDisplay", "SWObject", 0};
-SWClass SWDisplay::classdef(classes);
+static const SWClass classdef(classes);
+SWDisplay::SWDisplay() : SWObject(classdef){ };
+
/******************************************************************************
* SWDisplay::Display - casts a module to a character pointer and displays it to
* raw output (overriden for different display types and
Modified: trunk/src/keys/listkey.cpp
===================================================================
--- trunk/src/keys/listkey.cpp 2020-09-27 12:59:54 UTC (rev 3807)
+++ trunk/src/keys/listkey.cpp 2020-10-02 13:23:34 UTC (rev 3808)
@@ -32,7 +32,7 @@
SWORD_NAMESPACE_START
static const char *classes[] = {"ListKey", "SWKey", "SWObject", 0};
-SWClass ListKey::classdef(classes);
+static const SWClass classdef(classes);
/******************************************************************************
* ListKey Constructor - initializes instance of ListKey
@@ -59,7 +59,7 @@
void ListKey::init() {
- myclass = &classdef;
+ myClass = &classdef;
// this is a listkey, bound is always set
boundSet = true;
}
Modified: trunk/src/keys/strkey.cpp
===================================================================
--- trunk/src/keys/strkey.cpp 2020-09-27 12:59:54 UTC (rev 3807)
+++ trunk/src/keys/strkey.cpp 2020-10-02 13:23:34 UTC (rev 3808)
@@ -30,7 +30,7 @@
SWORD_NAMESPACE_START
static const char *classes[] = {"StrKey", "SWKey", "SWObject", 0};
-SWClass StrKey::classdef(classes);
+static const SWClass classdef(classes);
/******************************************************************************
* StrKey Constructor - initializes instance of StrKey
@@ -45,7 +45,7 @@
void StrKey::init() {
- myclass = &classdef;
+ myClass = &classdef;
}
Modified: trunk/src/keys/swkey.cpp
===================================================================
--- trunk/src/keys/swkey.cpp 2020-09-27 12:59:54 UTC (rev 3807)
+++ trunk/src/keys/swkey.cpp 2020-10-02 13:23:34 UTC (rev 3808)
@@ -31,7 +31,7 @@
SWORD_NAMESPACE_START
static const char *classes[] = {"SWKey", "SWObject", 0};
-SWClass SWKey::classdef(classes);
+static const SWClass classdef(classes);
SWKey::LocaleCache SWKey::localeCache;
/******************************************************************************
@@ -40,7 +40,7 @@
* ENT: ikey - text key
*/
-SWKey::SWKey(const char *ikey)
+SWKey::SWKey(const char *ikey) : SWObject(classdef)
{
init();
index = 0;
@@ -52,7 +52,7 @@
stdstr(&keytext, ikey);
}
-SWKey::SWKey(SWKey const &k)
+SWKey::SWKey(SWKey const &k) : SWObject(classdef)
{
init();
stdstr(&localeName, k.localeName);
@@ -66,7 +66,6 @@
}
void SWKey::init() {
- myclass = &classdef;
boundSet = false;
locale = 0;
localeName = 0;
Modified: trunk/src/keys/treekey.cpp
===================================================================
--- trunk/src/keys/treekey.cpp 2020-09-27 12:59:54 UTC (rev 3807)
+++ trunk/src/keys/treekey.cpp 2020-10-02 13:23:34 UTC (rev 3808)
@@ -29,10 +29,10 @@
SWORD_NAMESPACE_START
static const char *classes[] = {"TreeKey", "SWKey", "SWObject", 0};
-SWClass TreeKey::classdef(classes);
+static const SWClass classdef(classes);
void TreeKey::init() {
- myclass = &classdef;
+ myClass = &classdef;
unsnappedKeyText = "";
posChangeListener = 0;
}
Modified: trunk/src/keys/treekeyidx.cpp
===================================================================
--- trunk/src/keys/treekeyidx.cpp 2020-09-27 12:59:54 UTC (rev 3807)
+++ trunk/src/keys/treekeyidx.cpp 2020-10-02 13:23:34 UTC (rev 3808)
@@ -35,7 +35,7 @@
static const char *classes[] = {"TreeKeyIdx", "TreeKey", "SWKey", "SWObject", 0};
-SWClass TreeKeyIdx::classdef(classes);
+static const SWClass classdef(classes);
TreeKeyIdx::TreeKeyIdx(const TreeKeyIdx &ikey) : currentNode() {
@@ -75,7 +75,7 @@
void TreeKeyIdx::init() {
- myclass = &classdef;
+ myClass = &classdef;
}
@@ -573,7 +573,7 @@
int TreeKeyIdx::compare(const SWKey &ikey) {
- TreeKeyIdx *treeKey = SWDYNAMIC_CAST(TreeKeyIdx, (&ikey));
+ const TreeKeyIdx *treeKey = SWDYNAMIC_CAST(const TreeKeyIdx, (&ikey));
if (treeKey)
return _compare(*treeKey);
return SWKey::compare(ikey);
Modified: trunk/src/keys/versekey.cpp
===================================================================
--- trunk/src/keys/versekey.cpp 2020-09-27 12:59:54 UTC (rev 3807)
+++ trunk/src/keys/versekey.cpp 2020-10-02 13:23:34 UTC (rev 3808)
@@ -40,7 +40,7 @@
SWORD_NAMESPACE_START
static const char *classes[] = {"VerseKey", "SWKey", "SWObject", 0};
-SWClass VerseKey::classdef(classes);
+static const SWClass classdef(classes);
/******************************************************************************
* Initialize static members of VerseKey
@@ -54,7 +54,7 @@
*/
void VerseKey::init(const char *v11n) {
- myclass = &classdef;
+ myClass = &classdef;
instance++;
autonorm = 1; // default auto normalization to true
@@ -183,12 +183,12 @@
void VerseKey::positionFrom(const SWKey &ikey) {
error = 0;
const SWKey *fromKey = &ikey;
- ListKey *tryList = SWDYNAMIC_CAST(ListKey, fromKey);
+ const ListKey *tryList = SWDYNAMIC_CAST(const ListKey, fromKey);
if (tryList) {
- SWKey *k = tryList->getElement();
+ const SWKey *k = tryList->getElement();
if (k) fromKey = k;
}
- VerseKey *tryVerse = SWDYNAMIC_CAST(VerseKey, fromKey);
+ const VerseKey *tryVerse = SWDYNAMIC_CAST(const VerseKey, fromKey);
if (tryVerse) {
setFromOther(*tryVerse);
}
@@ -240,12 +240,12 @@
// check to see if we can do a more specific copy
// plus some optimizations
const SWKey *fromKey = &ikey;
- ListKey *tryList = SWDYNAMIC_CAST(ListKey, fromKey);
+ const ListKey *tryList = SWDYNAMIC_CAST(const ListKey, fromKey);
if (tryList) {
- SWKey *k = tryList->getElement();
+ const SWKey *k = tryList->getElement();
if (k) fromKey = k;
}
- VerseKey *tryVerse = SWDYNAMIC_CAST(VerseKey, fromKey);
+ const VerseKey *tryVerse = SWDYNAMIC_CAST(const VerseKey, fromKey);
if (tryVerse) {
copyFrom(*tryVerse);
}
@@ -1768,7 +1768,7 @@
int VerseKey::compare(const SWKey &ikey)
{
const SWKey *testKey = &ikey;
- const VerseKey *vkey = (const VerseKey *)SWDYNAMIC_CAST(VerseKey, testKey);
+ const VerseKey *vkey = (const VerseKey *)SWDYNAMIC_CAST(const VerseKey, testKey);
if (vkey) {
return _compare(*vkey);
}
Modified: trunk/src/keys/versetreekey.cpp
===================================================================
--- trunk/src/keys/versetreekey.cpp 2020-09-27 12:59:54 UTC (rev 3807)
+++ trunk/src/keys/versetreekey.cpp 2020-10-02 13:23:34 UTC (rev 3808)
@@ -29,7 +29,7 @@
SWORD_NAMESPACE_START
static const char *classes[] = {"VerseTreeKey", "VerseKey", "SWKey", "SWObject", 0};
-SWClass VerseTreeKey::classdef(classes);
+static const SWClass classdef(classes);
/******************************************************************************
@@ -76,7 +76,7 @@
void VerseTreeKey::init(TreeKey *treeKey)
{
- myclass = &classdef;
+ myClass = &classdef;
this->treeKey = (TreeKey *)treeKey->clone();
this->treeKey->setPositionChangeListener(this);
internalPosChange = false;
@@ -232,7 +232,7 @@
}
-void VerseTreeKey::syncVerseToTree() {
+void VerseTreeKey::syncVerseToTree() const {
internalPosChange = true;
SWBuf path;
if (!getTestament()) path = "/"; // "[ Module Heading ]";
@@ -251,6 +251,11 @@
}
+const TreeKey *VerseTreeKey::getTreeKey() const {
+ syncVerseToTree();
+ return treeKey;
+}
+
TreeKey *VerseTreeKey::getTreeKey() {
syncVerseToTree();
return treeKey;
Modified: trunk/src/modules/comments/hrefcom/hrefcom.cpp
===================================================================
--- trunk/src/modules/comments/hrefcom/hrefcom.cpp 2020-09-27 12:59:54 UTC (rev 3807)
+++ trunk/src/modules/comments/hrefcom/hrefcom.cpp 2020-10-02 13:23:34 UTC (rev 3808)
@@ -72,7 +72,7 @@
SWBuf &HREFCom::getRawEntryBuf() const {
long start;
unsigned short size;
- VerseKey *key = 0;
+ const VerseKey *key = 0;
key = &getVerseKey();
Modified: trunk/src/modules/comments/rawcom/rawcom.cpp
===================================================================
--- trunk/src/modules/comments/rawcom/rawcom.cpp 2020-09-27 12:59:54 UTC (rev 3807)
+++ trunk/src/modules/comments/rawcom/rawcom.cpp 2020-10-02 13:23:34 UTC (rev 3808)
@@ -70,7 +70,7 @@
SWBuf &RawCom::getRawEntryBuf() const {
long start = 0;
unsigned short size = 0;
- VerseKey *key = &getVerseKey();
+ const VerseKey *key = &getVerseKey();
findOffset(key->getTestament(), key->getTestamentIndex(), &start, &size);
entrySize = size; // support getEntrySize call
@@ -162,8 +162,8 @@
bool RawCom::isLinked(const SWKey *k1, const SWKey *k2) const {
long start1, start2;
unsigned short size1, size2;
- VerseKey *vk1 = &getVerseKey(k1);
- VerseKey *vk2 = &getVerseKey(k2);
+ const VerseKey *vk1 = &getVerseKey(k1);
+ const VerseKey *vk2 = &getVerseKey(k2);
if (vk1->getTestament() != vk2->getTestament()) return false;
findOffset(vk1->getTestament(), vk1->getTestamentIndex(), &start1, &size1);
@@ -175,7 +175,7 @@
bool RawCom::hasEntry(const SWKey *k) const {
long start;
unsigned short size;
- VerseKey *vk = &getVerseKey(k);
+ const VerseKey *vk = &getVerseKey(k);
findOffset(vk->getTestament(), vk->getTestamentIndex(), &start, &size);
return size;
Modified: trunk/src/modules/comments/rawcom4/rawcom4.cpp
===================================================================
--- trunk/src/modules/comments/rawcom4/rawcom4.cpp 2020-09-27 12:59:54 UTC (rev 3807)
+++ trunk/src/modules/comments/rawcom4/rawcom4.cpp 2020-10-02 13:23:34 UTC (rev 3808)
@@ -69,7 +69,7 @@
SWBuf &RawCom4::getRawEntryBuf() const {
long start = 0;
unsigned long size = 0;
- VerseKey *key = &getVerseKey();
+ const VerseKey *key = &getVerseKey();
findOffset(key->getTestament(), key->getTestamentIndex(), &start, &size);
entrySize = (int)size; // support getEntrySize call
@@ -157,8 +157,8 @@
bool RawCom4::isLinked(const SWKey *k1, const SWKey *k2) const {
long start1, start2;
unsigned long size1, size2;
- VerseKey *vk1 = &getVerseKey(k1);
- VerseKey *vk2 = &getVerseKey(k2);
+ const VerseKey *vk1 = &getVerseKey(k1);
+ const VerseKey *vk2 = &getVerseKey(k2);
if (vk1->getTestament() != vk2->getTestament()) return false;
findOffset(vk1->getTestament(), vk1->getTestamentIndex(), &start1, &size1);
@@ -170,7 +170,7 @@
bool RawCom4::hasEntry(const SWKey *k) const {
long start;
unsigned long size;
- VerseKey *vk = &getVerseKey(k);
+ const VerseKey *vk = &getVerseKey(k);
findOffset(vk->getTestament(), vk->getTestamentIndex(), &start, &size);
return size;
Modified: trunk/src/modules/comments/rawfiles/rawfiles.cpp
===================================================================
--- trunk/src/modules/comments/rawfiles/rawfiles.cpp 2020-09-27 12:59:54 UTC (rev 3807)
+++ trunk/src/modules/comments/rawfiles/rawfiles.cpp 2020-10-02 13:23:34 UTC (rev 3808)
@@ -74,7 +74,7 @@
FileDesc *datafile;
long start = 0;
unsigned short size = 0;
- VerseKey *key = &getVerseKey();
+ const VerseKey *key = &getVerseKey();
findOffset(key->getTestament(), key->getTestamentIndex(), &start, &size);
Modified: trunk/src/modules/comments/swcom.cpp
===================================================================
--- trunk/src/modules/comments/swcom.cpp 2020-09-27 12:59:54 UTC (rev 3807)
+++ trunk/src/modules/comments/swcom.cpp 2020-10-02 13:23:34 UTC (rev 3808)
@@ -71,7 +71,7 @@
long SWCom::getIndex() const {
- VerseKey *key = &getVerseKey();
+ const VerseKey *key = &getVerseKey();
entryIndex = key->getIndex();
return entryIndex;
}
@@ -87,9 +87,42 @@
}
-VerseKey &SWCom::getVerseKey(const SWKey *keyToConvert) const {
+const VerseKey &SWCom::getVerseKey(const SWKey *keyToConvert) const {
const SWKey *thisKey = keyToConvert ? keyToConvert : this->key;
+ const VerseKey *key = 0;
+ // see if we have a VerseKey * or decendant
+ SWTRY {
+ key = SWDYNAMIC_CAST(const VerseKey, thisKey);
+ }
+ SWCATCH ( ... ) { }
+ if (!key) {
+ const ListKey *lkTest = 0;
+ SWTRY {
+ lkTest = SWDYNAMIC_CAST(const ListKey, thisKey);
+ }
+ SWCATCH ( ... ) { }
+ if (lkTest) {
+ SWTRY {
+ key = SWDYNAMIC_CAST(const VerseKey, lkTest->getElement());
+ }
+ SWCATCH ( ... ) { }
+ }
+ }
+ if (!key) {
+ VerseKey *retKey = (tmpSecond) ? tmpVK1 : tmpVK2;
+ tmpSecond = !tmpSecond;
+ retKey->setLocale(LocaleMgr::getSystemLocaleMgr()->getDefaultLocaleName());
+ (*retKey) = *(thisKey);
+ return (*retKey);
+ }
+ else return *key;
+}
+
+
+VerseKey &SWCom::getVerseKey(SWKey *keyToConvert) {
+ SWKey *thisKey = keyToConvert ? keyToConvert : this->key;
+
VerseKey *key = 0;
// see if we have a VerseKey * or decendant
SWTRY {
Modified: trunk/src/modules/comments/zcom/zcom.cpp
===================================================================
--- trunk/src/modules/comments/zcom/zcom.cpp 2020-09-27 12:59:54 UTC (rev 3807)
+++ trunk/src/modules/comments/zcom/zcom.cpp 2020-10-02 13:23:34 UTC (rev 3808)
@@ -77,7 +77,7 @@
long start = 0;
unsigned short size = 0;
unsigned long buffnum = 0;
- VerseKey &key = getVerseKey();
+ const VerseKey &key = getVerseKey();
findOffset(key.getTestament(), key.getTestamentIndex(), &start, &size, &buffnum);
entrySize = size; // support getEntrySize call
@@ -198,8 +198,8 @@
long start1, start2;
unsigned short size1, size2;
unsigned long buffnum1, buffnum2;
- VerseKey *vk1 = &getVerseKey(k1);
- VerseKey *vk2 = &getVerseKey(k2);
+ const VerseKey *vk1 = &getVerseKey(k1);
+ const VerseKey *vk2 = &getVerseKey(k2);
if (vk1->getTestament() != vk2->getTestament()) return false;
findOffset(vk1->getTestament(), vk1->getTestamentIndex(), &start1, &size1, &buffnum1);
@@ -211,7 +211,7 @@
long start;
unsigned short size;
unsigned long buffnum;
- VerseKey *vk = &getVerseKey(k);
+ const VerseKey *vk = &getVerseKey(k);
findOffset(vk->getTestament(), vk->getTestamentIndex(), &start, &size, &buffnum);
return size;
Modified: trunk/src/modules/comments/zcom4/zcom4.cpp
===================================================================
--- trunk/src/modules/comments/zcom4/zcom4.cpp 2020-09-27 12:59:54 UTC (rev 3807)
+++ trunk/src/modules/comments/zcom4/zcom4.cpp 2020-10-02 13:23:34 UTC (rev 3808)
@@ -77,7 +77,7 @@
long start = 0;
unsigned long size = 0;
unsigned long buffnum = 0;
- VerseKey &key = getVerseKey();
+ const VerseKey &key = getVerseKey();
findOffset(key.getTestament(), key.getTestamentIndex(), &start, &size, &buffnum);
entrySize = size; // support getEntrySize call
@@ -198,8 +198,8 @@
long start1, start2;
unsigned long size1, size2;
unsigned long buffnum1, buffnum2;
- VerseKey *vk1 = &getVerseKey(k1);
- VerseKey *vk2 = &getVerseKey(k2);
+ const VerseKey *vk1 = &getVerseKey(k1);
+ const VerseKey *vk2 = &getVerseKey(k2);
if (vk1->getTestament() != vk2->getTestament()) return false;
findOffset(vk1->getTestament(), vk1->getTestamentIndex(), &start1, &size1, &buffnum1);
@@ -211,7 +211,7 @@
long start;
unsigned long size;
unsigned long buffnum;
- VerseKey *vk = &getVerseKey(k);
+ const VerseKey *vk = &getVerseKey(k);
findOffset(vk->getTestament(), vk->getTestamentIndex(), &start, &size, &buffnum);
return size;
Modified: trunk/src/modules/filters/gbfosis.cpp
===================================================================
--- trunk/src/modules/filters/gbfosis.cpp 2020-09-27 12:59:54 UTC (rev 3807)
+++ trunk/src/modules/filters/gbfosis.cpp 2020-10-02 13:23:34 UTC (rev 3808)
@@ -346,7 +346,7 @@
}
}
- VerseKey *vkey = SWDYNAMIC_CAST(VerseKey, key);
+ const VerseKey *vkey = SWDYNAMIC_CAST(const VerseKey, key);
if (vkey) {
SWBuf ref = "";
if (vkey->getVerse()) {
Modified: trunk/src/modules/filters/gbfwordjs.cpp
===================================================================
--- trunk/src/modules/filters/gbfwordjs.cpp 2020-09-27 12:59:54 UTC (rev 3807)
+++ trunk/src/modules/filters/gbfwordjs.cpp 2020-10-02 13:23:34 UTC (rev 3808)
@@ -76,9 +76,9 @@
const SWBuf orig = text;
const char * from = orig.c_str();
- VerseKey *vkey = 0;
+ const VerseKey *vkey = 0;
if (key) {
- vkey = SWDYNAMIC_CAST(VerseKey, key);
+ vkey = SWDYNAMIC_CAST(const VerseKey, key);
}
for (text = ""; *from; from++) {
Modified: trunk/src/modules/filters/osisosis.cpp
===================================================================
--- trunk/src/modules/filters/osisosis.cpp 2020-09-27 12:59:54 UTC (rev 3807)
+++ trunk/src/modules/filters/osisosis.cpp 2020-10-02 13:23:34 UTC (rev 3808)
@@ -56,7 +56,7 @@
char OSISOSIS::processText(SWBuf &text, const SWKey *key, const SWModule *module) {
char status = SWBasicFilter::processText(text, key, module);
- VerseKey *vkey = SWDYNAMIC_CAST(VerseKey, key);
+ const VerseKey *vkey = SWDYNAMIC_CAST(const VerseKey, key);
if (vkey) {
if (vkey->getVerse()) {
VerseKey *tmp = (VerseKey *)vkey->clone();
Modified: trunk/src/modules/filters/osisstrongs.cpp
===================================================================
--- trunk/src/modules/filters/osisstrongs.cpp 2020-09-27 12:59:54 UTC (rev 3807)
+++ trunk/src/modules/filters/osisstrongs.cpp 2020-10-02 13:23:34 UTC (rev 3808)
@@ -100,9 +100,9 @@
if (module->isProcessEntryAttributes()) {
wordStart = from+1;
char gh = 0;
- VerseKey *vkey = 0;
+ const VerseKey *vkey = 0;
if (key) {
- vkey = SWDYNAMIC_CAST(VerseKey, key);
+ vkey = SWDYNAMIC_CAST(const VerseKey, key);
}
SWBuf lemma = "";
SWBuf morph = "";
Modified: trunk/src/modules/filters/osiswordjs.cpp
===================================================================
--- trunk/src/modules/filters/osiswordjs.cpp 2020-09-27 12:59:54 UTC (rev 3807)
+++ trunk/src/modules/filters/osiswordjs.cpp 2020-10-02 13:23:34 UTC (rev 3808)
@@ -71,9 +71,9 @@
// add TR to w src in KJV then remove this next line
SWBuf wordSrcPrefix = (modName == "KJV")?SWBuf("TR"):modName;
- VerseKey *vkey = 0;
+ const VerseKey *vkey = 0;
if (key) {
- vkey = SWDYNAMIC_CAST(VerseKey, key);
+ vkey = SWDYNAMIC_CAST(const VerseKey, key);
}
const SWBuf orig = text;
Modified: trunk/src/modules/filters/swbasicfilter.cpp
===================================================================
--- trunk/src/modules/filters/swbasicfilter.cpp 2020-09-27 12:59:54 UTC (rev 3807)
+++ trunk/src/modules/filters/swbasicfilter.cpp 2020-10-02 13:23:34 UTC (rev 3808)
@@ -62,7 +62,7 @@
supressAdjacentWhitespace = false;
vkey = 0;
SWTRY {
- vkey = SWDYNAMIC_CAST(VerseKey, key);
+ vkey = SWDYNAMIC_CAST(const VerseKey, key);
}
SWCATCH ( ... ) { }
}
Modified: trunk/src/modules/filters/thmlosis.cpp
===================================================================
--- trunk/src/modules/filters/thmlosis.cpp 2020-09-27 12:59:54 UTC (rev 3807)
+++ trunk/src/modules/filters/thmlosis.cpp 2020-10-02 13:23:34 UTC (rev 3808)
@@ -537,7 +537,7 @@
}
}
- VerseKey *vkey = SWDYNAMIC_CAST(VerseKey, key);
+ const VerseKey *vkey = SWDYNAMIC_CAST(const VerseKey, key);
if (vkey) {
SWBuf ref = "";
if (vkey->getVerse()) {
Modified: trunk/src/modules/filters/thmlwordjs.cpp
===================================================================
--- trunk/src/modules/filters/thmlwordjs.cpp 2020-09-27 12:59:54 UTC (rev 3807)
+++ trunk/src/modules/filters/thmlwordjs.cpp 2020-10-02 13:23:34 UTC (rev 3808)
@@ -79,9 +79,9 @@
const SWBuf orig = text;
const char * from = orig.c_str();
- VerseKey *vkey = 0;
+ const VerseKey *vkey = 0;
if (key) {
- vkey = SWDYNAMIC_CAST(VerseKey, key);
+ vkey = SWDYNAMIC_CAST(const VerseKey, key);
}
for (text = ""; *from; from++) {
Modified: trunk/src/modules/genbook/rawgenbook/rawgenbook.cpp
===================================================================
--- trunk/src/modules/genbook/rawgenbook/rawgenbook.cpp 2020-09-27 12:59:54 UTC (rev 3807)
+++ trunk/src/modules/genbook/rawgenbook/rawgenbook.cpp 2020-10-02 13:23:34 UTC (rev 3808)
@@ -153,24 +153,26 @@
void RawGenBook::linkEntry(const SWKey *inkey) {
- TreeKeyIdx *srckey = 0;
+ const TreeKeyIdx *srcKey = 0;
+ TreeKeyIdx *tmpKey = 0;
TreeKeyIdx *key = ((TreeKeyIdx *)&(getTreeKey()));
// see if we have a VerseKey * or decendant
SWTRY {
- srckey = SWDYNAMIC_CAST(TreeKeyIdx, inkey);
+ srcKey = SWDYNAMIC_CAST(const TreeKeyIdx, inkey);
}
SWCATCH ( ... ) {}
// if we don't have a VerseKey * decendant, create our own
- if (!srckey) {
- srckey = (TreeKeyIdx *)createKey();
- (*srckey) = *inkey;
+ if (!srcKey) {
+ tmpKey = (TreeKeyIdx *)createKey();
+ (*tmpKey) = *inkey;
+ srcKey = tmpKey;
}
- key->setUserData(srckey->getUserData(), 8);
+ key->setUserData(srcKey->getUserData(), 8);
key->save();
- if (inkey != srckey) // free our key if we created a VerseKey
- delete srckey;
+ if (tmpKey) // free our key if we created a VerseKey
+ delete tmpKey;
}
@@ -216,11 +218,11 @@
}
bool RawGenBook::hasEntry(const SWKey *k) const {
- TreeKey &key = getTreeKey(k);
+ const TreeKey &key = getTreeKey(k);
int dsize;
key.getUserData(&dsize);
- return (dsize > 7) && key.popError() == '\x00';
+ return (dsize > 7) && key.getError() == '\x00';
}
SWORD_NAMESPACE_END
Modified: trunk/src/modules/genbook/swgenbook.cpp
===================================================================
--- trunk/src/modules/genbook/swgenbook.cpp 2020-09-27 12:59:54 UTC (rev 3807)
+++ trunk/src/modules/genbook/swgenbook.cpp 2020-10-02 13:23:34 UTC (rev 3808)
@@ -48,29 +48,29 @@
}
-TreeKey &SWGenBook::getTreeKey(const SWKey *k) const {
+const TreeKey &SWGenBook::getTreeKey(const SWKey *k) const {
const SWKey* thiskey = k?k:this->key;
- TreeKey *key = 0;
+ const TreeKey *key = 0;
SWTRY {
- key = SWDYNAMIC_CAST(TreeKey, (thiskey));
+ key = SWDYNAMIC_CAST(const TreeKey, (thiskey));
}
SWCATCH ( ... ) {}
if (!key) {
- ListKey *lkTest = 0;
+ const ListKey *lkTest = 0;
SWTRY {
- lkTest = SWDYNAMIC_CAST(ListKey, thiskey);
+ lkTest = SWDYNAMIC_CAST(const ListKey, thiskey);
}
SWCATCH ( ... ) { }
if (lkTest) {
SWTRY {
- key = SWDYNAMIC_CAST(TreeKey, lkTest->getElement());
+ key = SWDYNAMIC_CAST(const TreeKey, lkTest->getElement());
if (!key) {
- VerseTreeKey *tkey = 0;
+ const VerseTreeKey *tkey = 0;
SWTRY {
- tkey = SWDYNAMIC_CAST(VerseTreeKey, lkTest->getElement());
+ tkey = SWDYNAMIC_CAST(const VerseTreeKey, lkTest->getElement());
}
SWCATCH ( ... ) {}
if (tkey) key = tkey->getTreeKey();
@@ -80,9 +80,9 @@
}
}
if (!key) {
- VerseTreeKey *tkey = 0;
+ const VerseTreeKey *tkey = 0;
SWTRY {
- tkey = SWDYNAMIC_CAST(VerseTreeKey, (thiskey));
+ tkey = SWDYNAMIC_CAST(const VerseTreeKey, (thiskey));
}
SWCATCH ( ... ) {}
if (tkey) key = tkey->getTreeKey();
Modified: trunk/src/modules/texts/rawtext/rawtext.cpp
===================================================================
--- trunk/src/modules/texts/rawtext/rawtext.cpp 2020-09-27 12:59:54 UTC (rev 3807)
+++ trunk/src/modules/texts/rawtext/rawtext.cpp 2020-10-02 13:23:34 UTC (rev 3808)
@@ -88,7 +88,7 @@
SWBuf &RawText::getRawEntryBuf() const {
long start = 0;
unsigned short size = 0;
- VerseKey &key = getVerseKey();
+ const VerseKey &key = getVerseKey();
findOffset(key.getTestament(), key.getTestamentIndex(), &start, &size);
entrySize = size; // support getEntrySize call
@@ -179,8 +179,8 @@
bool RawText::isLinked(const SWKey *k1, const SWKey *k2) const {
long start1, start2;
unsigned short size1, size2;
- VerseKey *vk1 = &getVerseKey(k1);
- VerseKey *vk2 = &getVerseKey(k2);
+ const VerseKey *vk1 = &getVerseKey(k1);
+ const VerseKey *vk2 = &getVerseKey(k2);
if (vk1->getTestament() != vk2->getTestament()) return false;
findOffset(vk1->getTestament(), vk1->getTestamentIndex(), &start1, &size1);
@@ -192,7 +192,7 @@
bool RawText::hasEntry(const SWKey *k) const {
long start;
unsigned short size;
- VerseKey *vk = &getVerseKey(k);
+ const VerseKey *vk = &getVerseKey(k);
findOffset(vk->getTestament(), vk->getTestamentIndex(), &start, &size);
return size;
Modified: trunk/src/modules/texts/rawtext4/rawtext4.cpp
===================================================================
--- trunk/src/modules/texts/rawtext4/rawtext4.cpp 2020-09-27 12:59:54 UTC (rev 3807)
+++ trunk/src/modules/texts/rawtext4/rawtext4.cpp 2020-10-02 13:23:34 UTC (rev 3808)
@@ -72,7 +72,7 @@
SWBuf &RawText4::getRawEntryBuf() const {
long start = 0;
unsigned long size = 0;
- VerseKey &key = getVerseKey();
+ const VerseKey &key = getVerseKey();
findOffset(key.getTestament(), key.getTestamentIndex(), &start, &size);
entrySize = (int)size; // support getEntrySize call
@@ -158,8 +158,8 @@
bool RawText4::isLinked(const SWKey *k1, const SWKey *k2) const {
long start1, start2;
unsigned long size1, size2;
- VerseKey *vk1 = &getVerseKey(k1);
- VerseKey *vk2 = &getVerseKey(k2);
+ const VerseKey *vk1 = &getVerseKey(k1);
+ const VerseKey *vk2 = &getVerseKey(k2);
if (vk1->getTestament() != vk2->getTestament()) return false;
findOffset(vk1->getTestament(), vk1->getTestamentIndex(), &start1, &size1);
@@ -171,7 +171,7 @@
bool RawText4::hasEntry(const SWKey *k) const {
long start;
unsigned long size;
- VerseKey *vk = &getVerseKey(k);
+ const VerseKey *vk = &getVerseKey(k);
findOffset(vk->getTestament(), vk->getTestamentIndex(), &start, &size);
return size;
Modified: trunk/src/modules/texts/swtext.cpp
===================================================================
--- trunk/src/modules/texts/swtext.cpp 2020-09-27 12:59:54 UTC (rev 3807)
+++ trunk/src/modules/texts/swtext.cpp 2020-10-02 13:23:34 UTC (rev 3808)
@@ -74,7 +74,7 @@
long SWText::getIndex() const {
- VerseKey *key = &getVerseKey();
+ const VerseKey *key = &getVerseKey();
entryIndex = key->getIndex();
return entryIndex;
@@ -92,9 +92,42 @@
}
-VerseKey &SWText::getVerseKey(const SWKey *keyToConvert) const {
+const VerseKey &SWText::getVerseKey(const SWKey *keyToConvert) const {
const SWKey *thisKey = keyToConvert ? keyToConvert : this->key;
+ const VerseKey *key = 0;
+ // see if we have a VerseKey * or decendant
+ SWTRY {
+ key = SWDYNAMIC_CAST(const VerseKey, thisKey);
+ }
+ SWCATCH ( ... ) { }
+ if (!key) {
+ const ListKey *lkTest = 0;
+ SWTRY {
+ lkTest = SWDYNAMIC_CAST(const ListKey, thisKey);
+ }
+ SWCATCH ( ... ) { }
+ if (lkTest) {
+ SWTRY {
+ key = SWDYNAMIC_CAST(const VerseKey, lkTest->getElement());
+ }
+ SWCATCH ( ... ) { }
+ }
+ }
+ if (!key) {
+ VerseKey *retKey = (tmpSecond) ? tmpVK1 : tmpVK2;
+ tmpSecond = !tmpSecond;
+ retKey->setLocale(LocaleMgr::getSystemLocaleMgr()->getDefaultLocaleName());
+ (*retKey) = *(thisKey);
+ return (*retKey);
+ }
+ else return *key;
+}
+
+
+VerseKey &SWText::getVerseKey(SWKey *keyToConvert) {
+ SWKey *thisKey = keyToConvert ? keyToConvert : this->key;
+
VerseKey *key = 0;
// see if we have a VerseKey * or decendant
SWTRY {
Modified: trunk/src/modules/texts/ztext/ztext.cpp
===================================================================
--- trunk/src/modules/texts/ztext/ztext.cpp 2020-09-27 12:59:54 UTC (rev 3807)
+++ trunk/src/modules/texts/ztext/ztext.cpp 2020-10-02 13:23:34 UTC (rev 3808)
@@ -77,7 +77,7 @@
long start = 0;
unsigned short size = 0;
unsigned long buffnum = 0;
- VerseKey &key = getVerseKey();
+ const VerseKey &key = getVerseKey();
findOffset(key.getTestament(), key.getTestamentIndex(), &start, &size, &buffnum);
entrySize = size; // support getEntrySize call
@@ -200,8 +200,8 @@
long start1, start2;
unsigned short size1, size2;
unsigned long buffnum1, buffnum2;
- VerseKey *vk1 = &getVerseKey(k1);
- VerseKey *vk2 = &getVerseKey(k2);
+ const VerseKey *vk1 = &getVerseKey(k1);
+ const VerseKey *vk2 = &getVerseKey(k2);
if (vk1->getTestament() != vk2->getTestament()) return false;
findOffset(vk1->getTestament(), vk1->getTestamentIndex(), &start1, &size1, &buffnum1);
@@ -213,7 +213,7 @@
long start;
unsigned short size;
unsigned long buffnum;
- VerseKey *vk = &getVerseKey(k);
+ const VerseKey *vk = &getVerseKey(k);
findOffset(vk->getTestament(), vk->getTestamentIndex(), &start, &size, &buffnum);
return size;
Modified: trunk/src/modules/texts/ztext4/ztext4.cpp
===================================================================
--- trunk/src/modules/texts/ztext4/ztext4.cpp 2020-09-27 12:59:54 UTC (rev 3807)
+++ trunk/src/modules/texts/ztext4/ztext4.cpp 2020-10-02 13:23:34 UTC (rev 3808)
@@ -77,7 +77,7 @@
long start = 0;
unsigned long size = 0;
unsigned long buffnum = 0;
- VerseKey &key = getVerseKey();
+ const VerseKey &key = getVerseKey();
findOffset(key.getTestament(), key.getTestamentIndex(), &start, &size, &buffnum);
entrySize = (int)size; // support getEntrySize call
@@ -200,8 +200,8 @@
long start1, start2;
unsigned long size1, size2;
unsigned long buffnum1, buffnum2;
- VerseKey *vk1 = &getVerseKey(k1);
- VerseKey *vk2 = &getVerseKey(k2);
+ const VerseKey *vk1 = &getVerseKey(k1);
+ const VerseKey *vk2 = &getVerseKey(k2);
if (vk1->getTestament() != vk2->getTestament()) return false;
findOffset(vk1->getTestament(), vk1->getTestamentIndex(), &start1, &size1, &buffnum1);
@@ -213,7 +213,7 @@
long start;
unsigned long size;
unsigned long buffnum;
- VerseKey *vk = &getVerseKey(k);
+ const VerseKey *vk = &getVerseKey(k);
findOffset(vk->getTestament(), vk->getTestamentIndex(), &start, &size, &buffnum);
return size;
Modified: trunk/src/utilfuns/swobject.cpp
===================================================================
--- trunk/src/utilfuns/swobject.cpp 2020-09-27 12:59:54 UTC (rev 3807)
+++ trunk/src/utilfuns/swobject.cpp 2020-10-02 13:23:34 UTC (rev 3808)
@@ -35,7 +35,7 @@
bool SWClass::isAssignableFrom(const char *className) const {
- for (int i = 0; descends[i]; i++) {
+ for (int i = 0; descends[i]; ++i) {
#ifndef __CYGWIN__
if (!sword::stricmp(descends[i], className))
#else
@@ -46,6 +46,19 @@
return false;
}
+/*
+static const char *classes[] = {"SWObject", 0};
+static const SWClass classdef(classes);
+SWObject::SWObject() {
+ myClass = &classdef;
+}
+*/
+
+SWObject::SWObject(const SWClass &assignClassDef) {
+ myClass = &assignClassDef;
+}
+
+
SWORD_NAMESPACE_END
Modified: trunk/utilities/diatheke/osiscgi.cpp
===================================================================
--- trunk/utilities/diatheke/osiscgi.cpp 2020-09-27 12:59:54 UTC (rev 3807)
+++ trunk/utilities/diatheke/osiscgi.cpp 2020-10-02 13:23:34 UTC (rev 3808)
@@ -164,10 +164,10 @@
if (type != "x-strongsMarkup" && // leave strong's markup notes out, in the future we'll probably have different option filters to turn different note types on or off
type != "strongsMarkup") { // deprecated
SWBuf footnoteNumber = tag.getAttribute("swordFootnote");
- VerseKey *vkey = NULL;
+ const VerseKey *vkey = NULL;
// see if we have a VerseKey * or descendant
SWTRY {
- vkey = SWDYNAMIC_CAST(VerseKey, u->key);
+ vkey = SWDYNAMIC_CAST(const VerseKey, u->key);
}
SWCATCH ( ... ) { }
if (vkey) {
More information about the sword-cvs
mailing list