The SWORD Project  1.9.0.svnversion
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
VerseTreeKey Class Reference

#include <versetreekey.h>

+ Inheritance diagram for VerseTreeKey:
+ Collaboration diagram for VerseTreeKey:

Public Member Functions

virtual int _compare (const VerseKey &ikey)
 
SWDEPRECATED char AutoNormalize (char iautonorm)
 
SWDEPRECATED char AutoNormalize () const
 
SWDEPRECATED char Book () const
 
SWDEPRECATED char Book (char ibook)
 
SWDEPRECATED int Chapter () const
 
SWDEPRECATED int Chapter (int ichapter)
 
void clearBounds () const
 
SWDEPRECATED void ClearBounds ()
 
virtual SWKeyclone () const
 
virtual int compare (const SWKey &ikey)
 
virtual void copyFrom (const SWKey &ikey)
 
virtual void copyFrom (const VerseKey &ikey)
 
virtual void decrement (int steps=1)
 
virtual bool equals (const SWKey &ikey)
 
SWDEPRECATED char Error ()
 
virtual char getBook () const
 
virtual const char * getBookAbbrev () const
 
virtual int getBookMax () const
 
virtual const char * getBookName () const
 
virtual int getChapter () const
 
virtual int getChapterMax () const
 
const SWClassgetClass () const
 
virtual char getError () const
 
virtual long getIndex () const
 
char * getLocale () const
 
VerseKeygetLowerBound () const
 
virtual const char * getOSISBookName () const
 
virtual const char * getOSISRef () const
 
virtual const char * getOSISRefRangeText () const
 
virtual const char * getRangeText () const
 
virtual const char * getShortRangeText () const
 
virtual const char * getShortText () const
 
virtual char getSuffix () const
 
virtual char getTestament () const
 
virtual long getTestamentIndex () const
 
virtual int getTestamentMax () const
 
virtual const char * getText () const
 
virtual TreeKeygetTreeKey ()
 
virtual const TreeKeygetTreeKey () const
 
VerseKeygetUpperBound () const
 
virtual int getVerse () const
 
virtual int getVerseMax () const
 
virtual const char * getVersificationSystem () const
 
SWDEPRECATED char Headings (char iheadings=MAXPOS(char))
 
virtual void increment (int steps=1)
 
virtual bool isAutoNormalize () const
 
virtual bool isBoundSet () const
 
virtual bool isIntros () const
 
bool isPersist () const
 
virtual bool isTraversable () const
 
SWDEPRECATED VerseKeyLowerBound (const VerseKey &lb)
 
SWDEPRECATED VerseKeyLowerBound () const
 
virtual long newIndex () const
 
virtual void Normalize (char autocheck=0)
 
virtual void normalize (bool autocheck=false)
 
virtual SWKEY_OPERATORS SWKeyoperator= (const VerseKey &ikey)
 
virtual ListKey parseVerseList (const char *buf, const char *defaultKey=0, bool expandRange=false, bool useChapterAsVerse=false)
 
SWDEPRECATED ListKey ParseVerseList (const char *buf, const char *defaultKey=0, bool expandRange=false, bool useChapterAsVerse=false)
 
SWDEPRECATED char Persist () const
 
SWDEPRECATED char Persist (signed char ipersist)
 
virtual char popError ()
 
virtual void positionChanged ()
 
virtual void positionFrom (const SWKey &ikey)
 
virtual void setAutoNormalize (bool iautonorm)
 
virtual void setBook (char ibook)
 
virtual void setBookName (const char *bname)
 
virtual void setChapter (int ichapter)
 
virtual void setError (char err)
 
virtual void setIndex (long iindex)
 
virtual void setIntros (bool val)
 
void setLocale (const char *name)
 
void setLowerBound (const VerseKey &lb)
 
void setPersist (bool ipersist)
 
virtual void setPosition (SW_POSITION newpos)
 
virtual void setSuffix (char isuffix)
 
virtual void setTestament (char itestament)
 
virtual void setText (const char *ikey, bool checkNormalize)
 
virtual void setText (const char *ikey)
 
void setTreeKey (TreeKey *tk)
 
void setUpperBound (const VerseKey &ub)
 
virtual void setVerse (int iverse)
 
virtual void setVersificationSystem (const char *name)
 
SWDEPRECATED char Testament () const
 
SWDEPRECATED char Testament (char itestament)
 
SWDEPRECATED long TestamentIndex () const
 
SWDEPRECATED VerseKeyUpperBound (const VerseKey &ub)
 
SWDEPRECATED VerseKeyUpperBound () const
 
void validateCurrentLocale () const
 
SWDEPRECATED int Verse () const
 
SWDEPRECATED int Verse (int iverse)
 
 VerseTreeKey (TreeKey *treeKey, const char *ikey=0)
 
 VerseTreeKey (TreeKey *treeKey, const SWKey *ikey)
 
 VerseTreeKey (TreeKey *treeKey, const char *min, const char *max)
 
 VerseTreeKey (const VerseTreeKey &k)
 
virtual ~VerseTreeKey ()
 

Static Public Member Functions

static const char * convertToOSIS (const char *inRef, const SWKey *defaultKey)
 

Public Attributes

int BMAX [2]
 
bool internalPosChange
 
SW_u64 userData
 

Protected Member Functions

void freshtext () const
 
virtual int getBookFromAbbrev (const char *abbr) const
 
SWLocalegetPrivateLocale () const
 
virtual char parse (bool checkNormalize=true)
 

Protected Attributes

signed char book
 
bool boundSet
 
signed int chapter
 
char error
 
char * keytext
 
char * localeName
 
const SWClassmyClass
 
bool persist
 
char * rangeText
 
signed char suffix
 
signed char testament
 
signed int verse
 

Private Member Functions

void init (TreeKey *treeKey)
 
void syncVerseToTree () const
 

Private Attributes

long lastGoodOffset
 
TreeKeytreeKey
 

Detailed Description

Class VerseKey The SWKey implementation used for verse based modules like Bibles or commentaries.

Definition at line 42 of file versetreekey.h.

Constructor & Destructor Documentation

VerseTreeKey::VerseTreeKey ( TreeKey treeKey,
const char *  ikey = 0 
)

VerseKey Constructor - initializes Instance of VerseKey

Parameters
treeKeya TreeKey which will form the basis of this VerseTreeKey
ikeytext key (will take various forms of 'BOOK CH:VS'. See parse() for more detailed information)

Definition at line 57 of file versetreekey.cpp.

57  : VerseKey(ikey)
58 {
59  init(treeKey);
60  if (ikey)
61  parse();
62 }
VerseKey(const char *ikey=0)
Definition: versekey.cpp:105
void init()
Definition: swkey.cpp:68
virtual char parse(bool checkNormalize=true)
Definition: versekey.cpp:326
VerseTreeKey::VerseTreeKey ( TreeKey treeKey,
const SWKey ikey 
)

VerseKey Constructor - initializes instance of VerseKey

Parameters
treeKeya TreeKey which will form the basis of this VerseTreeKey
ikeybase key (will take various forms of 'BOOK CH:VS'. See parse() for more detailed information)

Definition at line 42 of file versetreekey.cpp.

42  : VerseKey(ikey)
43 {
44  init(treeKey);
45  if (ikey)
46  parse();
47 }
VerseKey(const char *ikey=0)
Definition: versekey.cpp:105
void init()
Definition: swkey.cpp:68
virtual char parse(bool checkNormalize=true)
Definition: versekey.cpp:326
VerseTreeKey::VerseTreeKey ( TreeKey treeKey,
const char *  min,
const char *  max 
)

VerseKey Constructor - initializes instance of VerseKey with boundariess - see also LowerBound() and UpperBound()

Parameters
treeKeya TreeKey which will form the basis of this VerseTreeKey
minthe lower boundary of the new VerseKey
maxthe upper boundary of the new VerseKey

Definition at line 71 of file versetreekey.cpp.

71  : VerseKey(min, max)
72 {
73  init(treeKey);
74 }
VerseKey(const char *ikey=0)
Definition: versekey.cpp:105
void init()
Definition: swkey.cpp:68
VerseTreeKey::VerseTreeKey ( const VerseTreeKey k)
VerseKey Copy Constructor - will create a new   VerseKey

based on an existing one

Parameters
kthe VerseKey to copy from

Definition at line 65 of file versetreekey.cpp.

65  : VerseKey(k)
66 {
67  init(k.treeKey);
68 }
VerseKey(const char *ikey=0)
Definition: versekey.cpp:105
void init()
Definition: swkey.cpp:68
TreeKey * treeKey
Definition: versetreekey.h:45
VerseTreeKey::~VerseTreeKey ( )
virtual
VerseKey Destructor

Cleans up an instance of VerseKey

Definition at line 126 of file versetreekey.cpp.

126  {
127  delete treeKey;
128 }
TreeKey * treeKey
Definition: versetreekey.h:45

Member Function Documentation

int VerseKey::_compare ( const VerseKey ikey)
virtualinherited

Compares another VerseKey object

Parameters
ikeykey to compare with this one
Returns
>0 if this VerseKey is greater than compare VerseKey, <0 if this VerseKey is smaller than compare VerseKey, 0 if the keys are the same

Definition at line 1790 of file versekey.cpp.

1791 {
1792  unsigned long keyval1 = 0;
1793  unsigned long keyval2 = 0;
1794 
1795  keyval1 += getTestament() * 1000000000;
1796  keyval2 += ivkey.getTestament() * 1000000000;
1797  keyval1 += getBook() * 10000000;
1798  keyval2 += ivkey.getBook() * 10000000;
1799  keyval1 += getChapter() * 10000;
1800  keyval2 += ivkey.getChapter() * 10000;
1801  keyval1 += getVerse() * 50;
1802  keyval2 += ivkey.getVerse() * 50;
1803  keyval1 += (int)getSuffix();
1804  keyval2 += (int)ivkey.getSuffix();
1805  keyval1 = (keyval1 != keyval2) ? ((keyval1 > keyval2) ? 1 : -1) : 0; // -1 | 0 | 1
1806  return (int)keyval1;
1807 }
virtual char getSuffix() const
Definition: versekey.cpp:1630
virtual int getChapter() const
Definition: versekey.cpp:1522
virtual char getBook() const
Definition: versekey.cpp:1510
virtual int getVerse() const
Definition: versekey.cpp:1534
virtual char getTestament() const
Definition: versekey.cpp:1498
SWDEPRECATED char VerseKey::AutoNormalize ( char  iautonorm)
inlineinherited
Deprecated:
Use setAutoNormalize() instead.

Definition at line 375 of file versekey.h.

375 { char retVal = isAutoNormalize()?1:0; setAutoNormalize(iautonorm!=0); return retVal; } // deprecated
virtual bool isAutoNormalize() const
Definition: versekey.cpp:1643
virtual void setAutoNormalize(bool iautonorm)
Definition: versekey.cpp:1648
SWDEPRECATED char VerseKey::AutoNormalize ( ) const
inlineinherited
Deprecated:
Use isAutoNormalize() instead.

Definition at line 379 of file versekey.h.

379 { return isAutoNormalize()?1:0; } // deprecated
virtual bool isAutoNormalize() const
Definition: versekey.cpp:1643
SWDEPRECATED char VerseKey::Book ( ) const
inlineinherited
Deprecated:
Use getBook() instead.

Definition at line 276 of file versekey.h.

276 { return getBook(); } // deprecated
virtual char getBook() const
Definition: versekey.cpp:1510
SWDEPRECATED char VerseKey::Book ( char  ibook)
inlineinherited
Deprecated:
Use setBook() instead.

Definition at line 325 of file versekey.h.

325 { char retVal = getBook(); setBook(ibook); return retVal; } // deprecated
virtual char getBook() const
Definition: versekey.cpp:1510
virtual void setBook(char ibook)
Definition: versekey.cpp:1565
SWDEPRECATED int VerseKey::Chapter ( ) const
inlineinherited
Deprecated:
Use getChapter() instead.

Definition at line 287 of file versekey.h.

287 { return getChapter(); } // deprecated
virtual int getChapter() const
Definition: versekey.cpp:1522
SWDEPRECATED int VerseKey::Chapter ( int  ichapter)
inlineinherited
Deprecated:
Use setChapter() instead.

Definition at line 335 of file versekey.h.

335 { char retVal = getChapter(); setChapter(ichapter); return retVal; } // deprecated
virtual void setChapter(int ichapter)
Definition: versekey.cpp:1603
virtual int getChapter() const
Definition: versekey.cpp:1522
void VerseKey::clearBounds ( ) const
virtualinherited

clears the boundaries of this VerseKey

Reimplemented from SWKey.

Definition at line 1202 of file versekey.cpp.

1202  {
1203  delete tmpClone;
1204  tmpClone = 0;
1205  boundSet = false;
1206 }
bool boundSet
Definition: swkey.h:104
VerseKey * tmpClone
Definition: versekey.h:85
SWDEPRECATED void VerseKey::ClearBounds ( )
inlineinherited
Deprecated:
Use clearBounds

Definition at line 208 of file versekey.h.

208 { clearBounds(); }
void clearBounds() const
Definition: versekey.cpp:1202
SWKey * VerseTreeKey::clone ( ) const
virtual

Creates a new SWKey based on the current VerseKey see also the Copy Constructor

Reimplemented from VerseKey.

Definition at line 86 of file versetreekey.cpp.

87 {
88  return new VerseTreeKey(*this);
89 }
VerseTreeKey(TreeKey *treeKey, const char *ikey=0)
int VerseKey::compare ( const SWKey ikey)
virtualinherited

Compares another SWKey object

Parameters
ikeykey to compare with this one
Returns
>0 if this VerseKey is greater than compare SWKey, <0 if this VerseKey is smaller than compare SWKey, 0 if the keys are the same

Reimplemented from SWKey.

Definition at line 1768 of file versekey.cpp.

1769 {
1770  const SWKey *testKey = &ikey;
1771  const VerseKey *vkey = (const VerseKey *)SWDYNAMIC_CAST(const VerseKey, testKey);
1772  if (vkey) {
1773  return _compare(*vkey);
1774  }
1775  const VerseKey ivkey = (const char *)ikey;
1776  return _compare(ivkey);
1777 }
virtual int _compare(const VerseKey &ikey)
Definition: versekey.cpp:1790
#define SWDYNAMIC_CAST(className, object)
Definition: defs.h:47
Definition: swkey.h:77
const char * VerseKey::convertToOSIS ( const char *  inRef,
const SWKey defaultKey 
)
staticinherited

Tries to parse a string and convert it into an OSIS reference

Parameters
inRefreference string to try to parse
defaultKeyfor details
See Also
ParseVerseList(..., defaultKey, ...)

Definition at line 1887 of file versekey.cpp.

1887  {
1888  static SWBuf outRef;
1889 
1890  outRef = "";
1891 
1892  VerseKey defLanguage;
1893  ListKey verses = defLanguage.parseVerseList(inRef, (*lastKnownKey), true);
1894  const char *startFrag = inRef;
1895  for (int i = 0; i < verses.getCount(); i++) {
1896  SWKey *element = verses.getElement(i);
1897 // VerseKey *element = SWDYNAMIC_CAST(VerseKey, verses.GetElement(i));
1898  SWBuf buf;
1899  // TODO: This code really needs to not use fixed size arrays
1900  char frag[800];
1901  char preJunk[800];
1902  char postJunk[800];
1903  memset(frag, 0, 800);
1904  memset(preJunk, 0, 800);
1905  memset(postJunk, 0, 800);
1906  while ((*startFrag) && (strchr(" {}:;,()[].", *startFrag))) {
1907  outRef += *startFrag;
1908  startFrag++;
1909  }
1910  memmove(frag, startFrag, (size_t)((const char *)element->userData - startFrag) + 1);
1911  frag[((const char *)element->userData - startFrag) + 1] = 0;
1912  int j;
1913  for (j = strlen(frag)-1; j && (strchr(" {}:;,()[].", frag[j])); j--);
1914  if (frag[j+1])
1915  strcpy(postJunk, frag+j+1);
1916  frag[j+1]=0;
1917  startFrag += ((const char *)element->userData - startFrag) + 1;
1918  buf = "<reference osisRef=\"";
1919  buf += element->getOSISRefRangeText();
1920  buf += "\">";
1921  buf += frag;
1922  buf += "</reference>";
1923  buf += postJunk;
1924 
1925  outRef += buf;
1926 
1927  }
1928  if (startFrag < (inRef + strlen(inRef)))
1929  outRef += startFrag;
1930  return outRef.c_str();
1931 }
virtual int getCount() const
Definition: listkey.cpp:211
Definition: swbuf.h:47
virtual SWKey * getElement(int pos=-1)
Definition: listkey.cpp:270
const char * c_str() const
Definition: swbuf.h:158
virtual ListKey parseVerseList(const char *buf, const char *defaultKey=0, bool expandRange=false, bool useChapterAsVerse=false)
Definition: versekey.cpp:515
virtual const char * getOSISRefRangeText() const
Definition: swkey.cpp:203
SW_u64 userData
Definition: swkey.h:115
Definition: swkey.h:77
void VerseKey::copyFrom ( const SWKey ikey)
virtualinherited

Copies as much info (position, range, etc.) as possible from another SWKey object

Parameters
ikeyother SWKey object from which to copy

Reimplemented from SWKey.

Definition at line 239 of file versekey.cpp.

239  {
240  // check to see if we can do a more specific copy
241  // plus some optimizations
242  const SWKey *fromKey = &ikey;
243  const ListKey *tryList = SWDYNAMIC_CAST(const ListKey, fromKey);
244  if (tryList) {
245  const SWKey *k = tryList->getElement();
246  if (k) fromKey = k;
247  }
248  const VerseKey *tryVerse = SWDYNAMIC_CAST(const VerseKey, fromKey);
249  if (tryVerse) {
250  copyFrom(*tryVerse);
251  }
252  else {
253  SWKey::copyFrom(*fromKey);
254 // extraneous parse which inadvertently clears error flag
255 // SWKey::copyFrom already calls setText, which VerseKey::setText already calls parse()
256 // parse();
257  }
258 }
virtual void copyFrom(const SWKey &ikey)
Definition: versekey.cpp:239
virtual SWKey * getElement(int pos=-1)
Definition: listkey.cpp:270
virtual void copyFrom(const SWKey &ikey)
Definition: swkey.cpp:173
#define SWDYNAMIC_CAST(className, object)
Definition: defs.h:47
Definition: swkey.h:77
void VerseKey::copyFrom ( const VerseKey ikey)
virtualinherited

Equates this VerseKey to another VerseKey

Definition at line 218 of file versekey.cpp.

218  {
219  autonorm = ikey.autonorm;
220  intros = ikey.intros;
221  testament = ikey.getTestament();
222  book = ikey.getBook();
223  chapter = ikey.getChapter();
224  verse = ikey.getVerse();
225  suffix = ikey.getSuffix();
226  setLocale(ikey.getLocale());
228  if (ikey.isBoundSet()) {
231  }
232 }
virtual bool isBoundSet() const
Definition: swkey.h:189
signed int chapter
Definition: versekey.h:97
signed char testament
Definition: versekey.h:95
VerseKey & getLowerBound() const
Definition: versekey.cpp:1156
signed char suffix
Definition: versekey.h:99
signed int verse
Definition: versekey.h:98
char intros
Definition: versekey.h:69
void setLowerBound(const VerseKey &lb)
Definition: versekey.cpp:1112
virtual char getSuffix() const
Definition: versekey.cpp:1630
virtual int getChapter() const
Definition: versekey.cpp:1522
virtual void setVersificationSystem(const char *name)
Definition: versekey.cpp:298
virtual const char * getVersificationSystem() const
Definition: versekey.cpp:316
virtual char getBook() const
Definition: versekey.cpp:1510
virtual int getVerse() const
Definition: versekey.cpp:1534
VerseKey & getUpperBound() const
Definition: versekey.cpp:1179
void setUpperBound(const VerseKey &ub)
Definition: versekey.cpp:1135
signed char book
Definition: versekey.h:96
char autonorm
Definition: versekey.h:65
void setLocale(const char *name)
Definition: swkey.h:225
char * getLocale() const
Definition: swkey.h:224
virtual char getTestament() const
Definition: versekey.cpp:1498
void VerseTreeKey::decrement ( int  steps = 1)
virtual

Decrements key a number of verses

Parameters
stepsNumber of verses to jump backward

Reimplemented from VerseKey.

Definition at line 131 of file versetreekey.cpp.

131  {
132  int treeError = 0;
134  do {
135  treeKey->decrement();
136  treeError = treeKey->popError();
137  // iterate until 3 levels and no versekey parse errors
138  } while (!treeError && ((treeKey->getLevel() < 3) || error));
139  if (error && !treeError) {
140  int saveError = error;
141  increment();
142  error = saveError;
143  }
144  if (treeError) {
146  error = treeError;
147  }
148  if (_compare(getUpperBound()) > 0) {
151  }
152  if (_compare(getLowerBound()) < 0) {
155  }
156 }
virtual unsigned long getOffset() const =0
virtual void setOffset(unsigned long offset)=0
VerseKey & getLowerBound() const
Definition: versekey.cpp:1156
virtual int getLevel()
Definition: treekey.h:76
virtual void positionFrom(const SWKey &ikey)
Definition: versekey.cpp:183
long lastGoodOffset
Definition: versetreekey.h:50
virtual int _compare(const VerseKey &ikey)
Definition: versekey.cpp:1790
virtual TreeKey * getTreeKey()
TreeKey * treeKey
Definition: versetreekey.h:45
virtual void increment(int steps=1)
VerseKey & getUpperBound() const
Definition: versekey.cpp:1179
virtual void decrement(int steps=1)=0
#define KEYERR_OUTOFBOUNDS
Definition: swkey.h:35
virtual char popError()
Definition: swkey.cpp:147
char error
Definition: swkey.h:106
virtual bool SWKey::equals ( const SWKey ikey)
inlinevirtualinherited

test equality of this SWKey object's position with another SWKey

Parameters
ikeykey to compare with this one
Returns
true if the key positions are equal

Definition at line 204 of file swkey.h.

204 { return !compare(ikey); }
virtual int compare(const SWKey &ikey)
Definition: swkey.cpp:218
SWDEPRECATED char SWKey::Error ( )
inlineinherited
Deprecated:
Use popError and getError instead

Definition at line 169 of file swkey.h.

169 { return popError(); }
virtual char popError()
Definition: swkey.cpp:147
void VerseKey::freshtext ( ) const
protectedinherited

Refresh keytext based on testament|book|chapter|verse default auto normalization to true default display headings option is false

Definition at line 357 of file versekey.cpp.

358 {
359  char buf[2024];
360  int realTest = testament;
361  int realbook = book;
362 
363  if (book < 1) {
364  if (testament < 1)
365  sprintf(buf, "[ Module Heading ]");
366  else sprintf(buf, "[ Testament %d Heading ]", (int)testament);
367  }
368  else {
369  if (realbook > BMAX[realTest-1]) {
370  realbook -= BMAX[realTest-1];
371  if (realTest < 2)
372  realTest++;
373  if (realbook > BMAX[realTest-1])
374  realbook = BMAX[realTest-1];
375  }
376  sprintf(buf, "%s %d:%d", getBookName(), chapter, verse);
377  if (suffix) {
378  buf[strlen(buf)+1] = 0;
379  buf[strlen(buf)] = suffix;
380  }
381  }
382 
383  stdstr((char **)&keytext, buf);
384 }
signed int chapter
Definition: versekey.h:97
virtual const char * getBookName() const
Definition: versekey.cpp:1265
signed char testament
Definition: versekey.h:95
char * keytext
Definition: swkey.h:102
signed char suffix
Definition: versekey.h:99
signed int verse
Definition: versekey.h:98
SWORD_NAMESPACE_START char * stdstr(char **ipstr, const char *istr, unsigned int memPadFactor=1)
Definition: utilstr.h:44
signed char book
Definition: versekey.h:96
int BMAX[2]
Definition: versekey.h:120
char VerseKey::getBook ( ) const
virtualinherited

Gets book

Returns
value of book

Definition at line 1510 of file versekey.cpp.

1511 {
1512  return book;
1513 }
signed char book
Definition: versekey.h:96
const char * VerseKey::getBookAbbrev ( ) const
virtualinherited

Definition at line 1275 of file versekey.cpp.

1275  {
1276  return getPrivateLocale()->translate((SWBuf("prefAbbr_")+refSys->getBook(((testament>1)?BMAX[0]:0)+book-1)->getPreferredAbbreviation()).c_str());
1277 }
Definition: swbuf.h:47
signed char testament
Definition: versekey.h:95
const VersificationMgr::System * refSys
Definition: versekey.h:61
const Book * getBook(int number) const
const char * getPreferredAbbreviation() const
virtual const char * translate(const char *text)
Definition: swlocale.cpp:106
SWLocale * getPrivateLocale() const
Definition: swkey.cpp:111
signed char book
Definition: versekey.h:96
int BMAX[2]
Definition: versekey.h:120
int VerseTreeKey::getBookFromAbbrev ( const char *  abbr) const
protectedvirtual

Reimplemented from VerseKey.

Definition at line 92 of file versetreekey.cpp.

93 {
94  int bookno = VerseKey::getBookFromAbbrev(iabbr);
95  if (bookno < 0) {
96  SWLog::getSystemLog(); // TODO fix for odd android bug
97 /*
98  vector<struct sbook>::iterator it = find(books, iabbr);
99  if (it == books.end()) {
100  TreeKey *tkey = this->treeKey;
101  int saveError = tkey->popError();
102  long bookmark = tkey->getOffset();
103  SWBuf segment;
104  internalPosChange = true;
105  do {
106  segment = (SWBuf)tkey->getLocalName();
107  } while (tkey->parent());
108  segment << 1;
109  if (saveError) {
110  error = saveError;
111  }
112  tkey->setOffset(bookmark);
113  }
114  books.push_back(sbook(iabbr));
115 */
116  }
117  return bookno;
118 }
static SWLog * getSystemLog()
Definition: swlog.cpp:53
virtual int getBookFromAbbrev(const char *abbr) const
Definition: versekey.cpp:396
virtual int VerseKey::getBookMax ( ) const
inlinevirtualinherited

Definition at line 277 of file versekey.h.

277 { return BMAX[testament-1]; }
signed char testament
Definition: versekey.h:95
int BMAX[2]
Definition: versekey.h:120
const char * VerseKey::getBookName ( ) const
virtualinherited

Get/Set position of this key by Book Name

Definition at line 1265 of file versekey.cpp.

1265  {
1266  return getPrivateLocale()->translate(refSys->getBook(((testament>1)?BMAX[0]:0)+book-1)->getLongName());
1267 }
signed char testament
Definition: versekey.h:95
const VersificationMgr::System * refSys
Definition: versekey.h:61
const Book * getBook(int number) const
virtual const char * translate(const char *text)
Definition: swlocale.cpp:106
SWLocale * getPrivateLocale() const
Definition: swkey.cpp:111
signed char book
Definition: versekey.h:96
const char * getLongName() const
int BMAX[2]
Definition: versekey.h:120
int VerseKey::getChapter ( ) const
virtualinherited

Gets chapter

Returns
value of chapter

Definition at line 1522 of file versekey.cpp.

1523 {
1524  return chapter;
1525 }
signed int chapter
Definition: versekey.h:97
int VerseKey::getChapterMax ( ) const
virtualinherited

Definition at line 1327 of file versekey.cpp.

1327  {
1328  if (book < 1) return 0;
1329  const VersificationMgr::Book *b = refSys->getBook(((testament>1)?BMAX[0]:0)+book-1);
1330  return (b) ? b->getChapterMax() : -1;
1331 }
signed char testament
Definition: versekey.h:95
const VersificationMgr::System * refSys
Definition: versekey.h:61
const Book * getBook(int number) const
signed char book
Definition: versekey.h:96
int BMAX[2]
Definition: versekey.h:120
const SWClass* SWObject::getClass ( ) const
inlineinherited

Use this to get the class definition and inheritance order.

Returns
The class definition of this object

Definition at line 63 of file swobject.h.

63  {
64  return myClass;
65  }
const SWClass * myClass
Definition: swobject.h:55
virtual char SWKey::getError ( ) const
inlinevirtualinherited

Definition at line 164 of file swkey.h.

164 { return error; }
char error
Definition: swkey.h:106
long VerseKey::getIndex ( ) const
virtualinherited

Gets index based upon current verse

Returns
offset

Reimplemented from SWKey.

Definition at line 1681 of file versekey.cpp.

1682 {
1683  long offset;
1684 
1685  if (!testament) { // if we want module heading
1686  offset = 0;
1687  }
1688  else if (!book) { // we want testament heading
1689  offset = ((testament == 2) ? refSys->getNTStartOffset():0) + 1;
1690  }
1691  else {
1692  offset = refSys->getOffsetFromVerse((((testament>1)?BMAX[0]:0)+book-1), chapter, verse);
1693  }
1694  return offset;
1695 }
signed int chapter
Definition: versekey.h:97
signed char testament
Definition: versekey.h:95
long getOffsetFromVerse(int book, int chapter, int verse) const
const VersificationMgr::System * refSys
Definition: versekey.h:61
signed int verse
Definition: versekey.h:98
signed char book
Definition: versekey.h:96
int BMAX[2]
Definition: versekey.h:120
char* SWKey::getLocale ( ) const
inlineinherited

Definition at line 224 of file swkey.h.

224 { return localeName; }
char * localeName
Definition: swkey.h:108
VerseKey & VerseKey::getLowerBound ( ) const
inherited

gets the lower boundary of this VerseKey

Returns
the lower boundary of this VerseKey

Definition at line 1156 of file versekey.cpp.

1157 {
1158  initBounds();
1159  if (!isAutoNormalize()) {
1165  }
1166  else {
1169  }
1170 
1171  return (*tmpClone);
1172 }
virtual void setIndex(long iindex)
Definition: versekey.cpp:1718
signed int chapter
Definition: versekey.h:97
VerseComponents lowerBoundComponents
Definition: versekey.h:89
signed char testament
Definition: versekey.h:95
virtual bool isAutoNormalize() const
Definition: versekey.cpp:1643
virtual void setSuffix(char isuffix)
Definition: versekey.cpp:1634
virtual void setVerse(int iverse)
Definition: versekey.cpp:1622
void initBounds() const
Definition: versekey.cpp:1209
signed char book
Definition: versekey.h:96
VerseKey * tmpClone
Definition: versekey.h:85
long lowerBound
Definition: versekey.h:84
const char * VerseKey::getOSISBookName ( ) const
virtualinherited

Definition at line 1270 of file versekey.cpp.

1270  {
1271  return refSys->getBook(((testament>1)?BMAX[0]:0)+book-1)->getOSISName();
1272 }
signed char testament
Definition: versekey.h:95
const VersificationMgr::System * refSys
Definition: versekey.h:61
const Book * getBook(int number) const
const char * getOSISName() const
signed char book
Definition: versekey.h:96
int BMAX[2]
Definition: versekey.h:120
const char * VerseKey::getOSISRef ( ) const
virtualinherited

Definition at line 1810 of file versekey.cpp.

1810  {
1811  static char buf[5][254];
1812  static int loop = 0;
1813 
1814  if (loop > 4)
1815  loop = 0;
1816 
1817  if (getVerse())
1818  sprintf(buf[loop], "%s.%d.%d", getOSISBookName(), getChapter(), getVerse());
1819  else if (getChapter())
1820  sprintf(buf[loop], "%s.%d", getOSISBookName(), getChapter());
1821  else if (getBook())
1822  sprintf(buf[loop], "%s", getOSISBookName());
1823  else buf[loop][0] = 0;
1824  return buf[loop++];
1825 }
virtual int getChapter() const
Definition: versekey.cpp:1522
virtual char getBook() const
Definition: versekey.cpp:1510
virtual int getVerse() const
Definition: versekey.cpp:1534
virtual const char * getOSISBookName() const
Definition: versekey.cpp:1270
const char * VerseKey::getOSISRefRangeText ( ) const
virtualinherited

Reimplemented from SWKey.

Definition at line 1873 of file versekey.cpp.

1873  {
1874  if (isBoundSet() && (lowerBound != upperBound)) {
1875  SWBuf buf = getLowerBound().getOSISRef();
1876  buf += "-";
1877  buf += getUpperBound().getOSISRef();
1878  stdstr(&rangeText, buf.c_str());
1879  }
1880  else stdstr(&rangeText, getOSISRef());
1881  return rangeText;
1882 }
virtual bool isBoundSet() const
Definition: swkey.h:189
Definition: swbuf.h:47
VerseKey & getLowerBound() const
Definition: versekey.cpp:1156
SWORD_NAMESPACE_START char * stdstr(char **ipstr, const char *istr, unsigned int memPadFactor=1)
Definition: utilstr.h:44
const char * c_str() const
Definition: swbuf.h:158
virtual const char * getOSISRef() const
Definition: versekey.cpp:1810
VerseKey & getUpperBound() const
Definition: versekey.cpp:1179
char * rangeText
Definition: swkey.h:103
long lowerBound
Definition: versekey.h:84
long upperBound
Definition: versekey.h:84
SWLocale * SWKey::getPrivateLocale ( ) const
protectedinherited

Definition at line 111 of file swkey.cpp.

111  {
112  if (!locale) {
113  if ((!localeCache.name) || (strcmp(localeCache.name, localeName))) {
115  // this line is the entire bit of work we're trying to avoid with the cache
116  // worth it? compare time examples/cmdline/search KJV "God love world" to
117  // same with this method reduced to:
118  // if (!local) local = ... (call below); return locale;
120  }
122  }
123  return locale;
124 }
SWLocale * locale
Definition: swkey.h:82
char * localeName
Definition: swkey.h:108
char * name
Definition: swkey.h:81
SWORD_NAMESPACE_START char * stdstr(char **ipstr, const char *istr, unsigned int memPadFactor=1)
Definition: utilstr.h:44
virtual SWLocale * getLocale(const char *name)
Definition: localemgr.cpp:210
static LocaleMgr * getSystemLocaleMgr()
Definition: localemgr.cpp:54
SWLocale * locale
Definition: swkey.h:94
static LocaleCache localeCache
Definition: swkey.h:92
const char * VerseKey::getRangeText ( ) const
virtualinherited

Reimplemented from SWKey.

Definition at line 1832 of file versekey.cpp.

1832  {
1833  if (isBoundSet() && lowerBound != upperBound) {
1834  SWBuf buf = (const char *)getLowerBound();
1835  buf += "-";
1836  buf += (const char *)getUpperBound();
1837  stdstr(&rangeText, buf.c_str());
1838  }
1839  else stdstr(&rangeText, getText());
1840  return rangeText;
1841 }
virtual bool isBoundSet() const
Definition: swkey.h:189
Definition: swbuf.h:47
VerseKey & getLowerBound() const
Definition: versekey.cpp:1156
virtual const char * getText() const
Definition: versekey.cpp:1242
SWORD_NAMESPACE_START char * stdstr(char **ipstr, const char *istr, unsigned int memPadFactor=1)
Definition: utilstr.h:44
const char * c_str() const
Definition: swbuf.h:158
VerseKey & getUpperBound() const
Definition: versekey.cpp:1179
char * rangeText
Definition: swkey.h:103
long lowerBound
Definition: versekey.h:84
long upperBound
Definition: versekey.h:84
const char * VerseKey::getShortRangeText ( ) const
virtualinherited

Reimplemented from SWKey.

Definition at line 1848 of file versekey.cpp.

1848  {
1849  if (isBoundSet() && (lowerBound != upperBound)) {
1850  SWBuf buf = getLowerBound().getShortText();
1851  buf += "-";
1855  buf.appendFormatted("%d", getUpperBound().getVerse());
1856  }
1858  && getUpperBound().getBook() == getLowerBound().getBook()) {
1860  }
1861  else buf += getUpperBound().getShortText();
1862  stdstr(&rangeText, buf.c_str());
1863  }
1864  else stdstr(&rangeText, getShortText());
1865  return rangeText;
1866 }
virtual bool isBoundSet() const
Definition: swkey.h:189
SWBuf & appendFormatted(const char *format,...)
Definition: swbuf.cpp:81
Definition: swbuf.h:47
VerseKey & getLowerBound() const
Definition: versekey.cpp:1156
SWORD_NAMESPACE_START char * stdstr(char **ipstr, const char *istr, unsigned int memPadFactor=1)
Definition: utilstr.h:44
virtual int getChapter() const
Definition: versekey.cpp:1522
const char * c_str() const
Definition: swbuf.h:158
virtual char getBook() const
Definition: versekey.cpp:1510
virtual int getVerse() const
Definition: versekey.cpp:1534
VerseKey & getUpperBound() const
Definition: versekey.cpp:1179
char * rangeText
Definition: swkey.h:103
virtual const char * getShortText() const
Definition: versekey.cpp:1248
long lowerBound
Definition: versekey.h:84
long upperBound
Definition: versekey.h:84
virtual char getTestament() const
Definition: versekey.cpp:1498
const char * VerseKey::getShortText ( ) const
virtualinherited

Reimplemented from SWKey.

Definition at line 1248 of file versekey.cpp.

1248  {
1249  static char *stext = 0;
1250  char buf[2047];
1251  freshtext();
1252  if (book < 1) {
1253  if (testament < 1)
1254  sprintf(buf, "[ Module Heading ]");
1255  else sprintf(buf, "[ Testament %d Heading ]", (int)testament);
1256  }
1257  else {
1258  sprintf(buf, "%s %d:%d", getBookAbbrev(), chapter, verse);
1259  }
1260  stdstr(&stext, buf);
1261  return stext;
1262 }
signed int chapter
Definition: versekey.h:97
signed char testament
Definition: versekey.h:95
signed int verse
Definition: versekey.h:98
SWORD_NAMESPACE_START char * stdstr(char **ipstr, const char *istr, unsigned int memPadFactor=1)
Definition: utilstr.h:44
void freshtext() const
Definition: versekey.cpp:357
signed char book
Definition: versekey.h:96
virtual const char * getBookAbbrev() const
Definition: versekey.cpp:1275
char VerseKey::getSuffix ( ) const
virtualinherited

Gets verse suffix

Returns
value of verse suffix

Definition at line 1630 of file versekey.cpp.

1630  {
1631  return suffix;
1632 }
signed char suffix
Definition: versekey.h:99
char VerseKey::getTestament ( ) const
virtualinherited

Gets testament

Returns
value of testament

Definition at line 1498 of file versekey.cpp.

1499 {
1500  return testament;
1501 }
signed char testament
Definition: versekey.h:95
long VerseKey::getTestamentIndex ( ) const
virtualinherited

Gets index into current testament based upon current verse

Returns
offset

Definition at line 1704 of file versekey.cpp.

1705 {
1706  long offset = getIndex();
1707  return (testament > 1) ? offset - refSys->getNTStartOffset() : offset;
1708 }
signed char testament
Definition: versekey.h:95
const VersificationMgr::System * refSys
Definition: versekey.h:61
virtual long getIndex() const
Definition: versekey.cpp:1681
virtual int VerseKey::getTestamentMax ( ) const
inlinevirtualinherited

Definition at line 266 of file versekey.h.

266 { return 2; }
const char * VerseKey::getText ( ) const
virtualinherited

refreshes keytext before returning if cast to a (char *) is requested

Reimplemented from SWKey.

Definition at line 1242 of file versekey.cpp.

1242  {
1243  freshtext();
1244  return keytext;
1245 }
char * keytext
Definition: swkey.h:102
void freshtext() const
Definition: versekey.cpp:357
TreeKey * VerseTreeKey::getTreeKey ( )
virtual

Definition at line 259 of file versetreekey.cpp.

259  {
260  syncVerseToTree();
261  return treeKey;
262 }
TreeKey * treeKey
Definition: versetreekey.h:45
void syncVerseToTree() const
const TreeKey * VerseTreeKey::getTreeKey ( ) const
virtual

Definition at line 254 of file versetreekey.cpp.

254  {
255  syncVerseToTree();
256  return treeKey;
257 }
TreeKey * treeKey
Definition: versetreekey.h:45
void syncVerseToTree() const
VerseKey & VerseKey::getUpperBound ( ) const
inherited

gets the upper boundary of this VerseKey

Returns
the upper boundary of this VerseKey

Definition at line 1179 of file versekey.cpp.

1180 {
1181  initBounds();
1182  if (!isAutoNormalize()) {
1188  }
1189  else {
1192  }
1193 
1194  return (*tmpClone);
1195 }
virtual void setIndex(long iindex)
Definition: versekey.cpp:1718
signed int chapter
Definition: versekey.h:97
signed char testament
Definition: versekey.h:95
virtual bool isAutoNormalize() const
Definition: versekey.cpp:1643
VerseComponents upperBoundComponents
Definition: versekey.h:89
virtual void setSuffix(char isuffix)
Definition: versekey.cpp:1634
virtual void setVerse(int iverse)
Definition: versekey.cpp:1622
void initBounds() const
Definition: versekey.cpp:1209
signed char book
Definition: versekey.h:96
VerseKey * tmpClone
Definition: versekey.h:85
long upperBound
Definition: versekey.h:84
int VerseKey::getVerse ( ) const
virtualinherited

Gets verse

Returns
value of verse

Definition at line 1534 of file versekey.cpp.

1535 {
1536  return verse;
1537 }
signed int verse
Definition: versekey.h:98
int VerseKey::getVerseMax ( ) const
virtualinherited

Definition at line 1333 of file versekey.cpp.

1333  {
1334  if (book < 1) return 0;
1335  const VersificationMgr::Book *b = refSys->getBook(((testament>1)?BMAX[0]:0)+book-1);
1336  return (b) ? b->getVerseMax(chapter) : -1;
1337 }
signed int chapter
Definition: versekey.h:97
signed char testament
Definition: versekey.h:95
const VersificationMgr::System * refSys
Definition: versekey.h:61
const Book * getBook(int number) const
signed char book
Definition: versekey.h:96
int getVerseMax(int chapter) const
int BMAX[2]
Definition: versekey.h:120
const char * VerseKey::getVersificationSystem ( ) const
virtualinherited

Definition at line 316 of file versekey.cpp.

316 { return refSys->getName(); }
const VersificationMgr::System * refSys
Definition: versekey.h:61
const char * getName() const
SWDEPRECATED char VerseKey::Headings ( char  iheadings = MAXPOS(char))
inlineinherited

Sets/gets flag that tells VerseKey to include chapter/book/testament/module intros

Deprecated:
Use setIntros() and isIntros() instead.
Parameters
iheadingsvalue which to set intros [MAXPOS(char)] - only get
Returns
if unchanged -> value of intros, if changed -> previous value of intros

Definition at line 391 of file versekey.h.

391 { char retVal = isIntros(); if (iheadings != MAXPOS(char)) setIntros(iheadings!=0); return retVal; }
virtual bool isIntros() const
Definition: versekey.cpp:1669
virtual void setIntros(bool val)
Definition: versekey.cpp:1663
#define MAXPOS(x)
Definition: swmacs.h:30
void VerseTreeKey::increment ( int  steps = 1)
virtual

Increments key a number of verses

Parameters
stepsNumber of verses to jump forward

Reimplemented from VerseKey.

Definition at line 159 of file versetreekey.cpp.

159  {
160  int treeError = 0;
162  do {
163  treeKey->increment();
164  treeError = treeKey->popError();
165  // iterate until 3 levels and no versekey parse errors
166  } while (!treeError && ((treeKey->getLevel() < 3) || error));
167  if (error && !treeError) {
168  int saveError = error;
169  decrement();
170  error = saveError;
171  }
172  if (treeError) {
174  error = treeError;
175  }
176  // bounds
177  if (_compare(getUpperBound()) > 0) {
180  }
181  if (_compare(getLowerBound()) < 0) {
184  }
185 }
virtual unsigned long getOffset() const =0
virtual void setOffset(unsigned long offset)=0
VerseKey & getLowerBound() const
Definition: versekey.cpp:1156
virtual int getLevel()
Definition: treekey.h:76
virtual void increment(int steps=1)=0
virtual void decrement(int steps=1)
virtual void positionFrom(const SWKey &ikey)
Definition: versekey.cpp:183
long lastGoodOffset
Definition: versetreekey.h:50
virtual int _compare(const VerseKey &ikey)
Definition: versekey.cpp:1790
virtual TreeKey * getTreeKey()
TreeKey * treeKey
Definition: versetreekey.h:45
VerseKey & getUpperBound() const
Definition: versekey.cpp:1179
#define KEYERR_OUTOFBOUNDS
Definition: swkey.h:35
virtual char popError()
Definition: swkey.cpp:147
char error
Definition: swkey.h:106
void VerseTreeKey::init ( TreeKey treeKey)
private

Definition at line 77 of file versetreekey.cpp.

78 {
79  myClass = &classdef;
80  this->treeKey = (TreeKey *)treeKey->clone();
81  this->treeKey->setPositionChangeListener(this);
82  internalPosChange = false;
83 }
const SWClass * myClass
Definition: swobject.h:55
void setPositionChangeListener(PositionChangeListener *pcl)
Definition: treekey.h:64
static const SWClass classdef(classes)
virtual SWKey * clone() const
Definition: swkey.cpp:75
bool internalPosChange
Definition: versetreekey.h:109
bool VerseKey::isAutoNormalize ( ) const
virtualinherited

Definition at line 1643 of file versekey.cpp.

1644 {
1645  return autonorm;
1646 }
char autonorm
Definition: versekey.h:65
virtual bool SWKey::isBoundSet ( ) const
inlinevirtualinherited

Definition at line 189 of file swkey.h.

189 { return boundSet; }
bool boundSet
Definition: swkey.h:104
bool VerseKey::isIntros ( ) const
virtualinherited

Definition at line 1669 of file versekey.cpp.

1670 {
1671  return intros;
1672 }
char intros
Definition: versekey.h:69
bool SWKey::isPersist ( ) const
inherited

Gets whether this key should persist in any module to which it is set otherwise just a copy will be used in the module.

Returns
1 - persists in module; 0 - a copy is attempted

Definition at line 99 of file swkey.cpp.

100 {
101  return persist;
102 }
bool persist
Definition: swkey.h:105
virtual bool VerseTreeKey::isTraversable ( ) const
inlinevirtual

Whether or not this key can be ++ – incremented

Reimplemented from VerseKey.

Definition at line 102 of file versetreekey.h.

102 { return true; }
SWDEPRECATED VerseKey& VerseKey::LowerBound ( const VerseKey lb)
inlineinherited
Deprecated:
Use setLowerBound / getLowerBound

Definition at line 173 of file versekey.h.

173 { setLowerBound(lb); return getLowerBound(); }
VerseKey & getLowerBound() const
Definition: versekey.cpp:1156
void setLowerBound(const VerseKey &lb)
Definition: versekey.cpp:1112
SWDEPRECATED VerseKey& VerseKey::LowerBound ( ) const
inlineinherited
Deprecated:
Use getLowerBound

Definition at line 191 of file versekey.h.

191 { return getLowerBound(); }
VerseKey & getLowerBound() const
Definition: versekey.cpp:1156
long VerseTreeKey::newIndex ( ) const
virtual

Definition at line 269 of file versetreekey.cpp.

269  {
270  return treeKey->getOffset();
271 }
virtual unsigned long getOffset() const =0
TreeKey * treeKey
Definition: versetreekey.h:45
void VerseTreeKey::Normalize ( char  autocheck = 0)
virtual

Definition at line 265 of file versetreekey.cpp.

265  {
266  error = 0;
267 }
char error
Definition: swkey.h:106
void VerseKey::normalize ( bool  autocheck = false)
virtualinherited

checks limits and normalizes if necessary (e.g. Matthew 29:47 = Mark 2:2). If last verse is exceeded, key is set to last Book CH:VS

Definition at line 1401 of file versekey.cpp.

1402 {
1403 
1404  if ((!autocheck || autonorm) // only normalize if we were explicitely called or if autonorm is turned on
1405  ) {
1406  error = 0;
1407 
1408  while ((testament < 3) && (testament > 0)) {
1409 
1410 
1411  if (book > BMAX[testament-1]) {
1412  book -= (BMAX[testament-1] + (intros?1:0));
1413  testament++;
1414  continue;
1415  }
1416  if (book < (intros?0:1)) {
1417  if (--testament > 0) {
1418  book += (BMAX[testament-1] + (intros?1:0));
1419  }
1420  continue;
1421  }
1422 
1423 
1424  if (chapter > getChapterMax()) {
1425  chapter -= (getChapterMax() + (intros?1:0));
1426  book++;
1427  continue;
1428  }
1429  if (chapter < (intros?0:1)) {
1430  --book;
1431  if (book < (intros?0:1)) {
1432  if (--testament > 0) {
1433  book += (BMAX[testament-1] + (intros?1:0));
1434  }
1435  }
1436  chapter += (getChapterMax() + (intros?1:0));
1437  continue;
1438  }
1439 
1440 
1441  if (chapter > 0 && verse > getVerseMax()) {
1442  verse -= (getVerseMax() + (intros?1:0));
1443  chapter++;
1444  continue;
1445  }
1446  if (verse < (intros?0:1)) {
1447  if (--chapter < (intros?0:1)) {
1448  --book;
1449  if (book < (intros?0:1)) {
1450  if (--testament > 0) {
1451  book += (BMAX[testament-1] + (intros?1:0));
1452  }
1453  }
1454  chapter += (getChapterMax() + (intros?1:0));
1455  }
1456  verse += (getVerseMax() + (intros?1:0));
1457  continue;
1458  }
1459 
1460  break; // If we've made it this far (all failure checks continue) we're ok
1461  }
1462 
1463  if (testament > (BMAX[1]?2:1)) {
1464  testament = BMAX[1]?2:1;
1465  book = BMAX[testament-1];
1466  chapter = getChapterMax();
1467  verse = getVerseMax();
1469  }
1470 
1471  if (testament < 1) {
1472  error = ((!intros) || (testament < 0) || (book < 0)) ? KEYERR_OUTOFBOUNDS : 0;
1473  testament = ((intros) ? 0 : 1);
1474  book = ((intros) ? 0 : 1);
1475  chapter = ((intros) ? 0 : 1);
1476  verse = ((intros) ? 0 : 1);
1477  }
1478 
1479  // should we always perform bounds checks? Tried but seems to cause infinite recursion
1480  if (_compare(getUpperBound()) > 0) {
1483  }
1484  if (_compare(getLowerBound()) < 0) {
1487  }
1488  }
1489 }
virtual int getChapterMax() const
Definition: versekey.cpp:1327
signed int chapter
Definition: versekey.h:97
signed char testament
Definition: versekey.h:95
VerseKey & getLowerBound() const
Definition: versekey.cpp:1156
virtual void positionFrom(const SWKey &ikey)
Definition: versekey.cpp:183
signed int verse
Definition: versekey.h:98
char intros
Definition: versekey.h:69
virtual int _compare(const VerseKey &ikey)
Definition: versekey.cpp:1790
VerseKey & getUpperBound() const
Definition: versekey.cpp:1179
#define KEYERR_OUTOFBOUNDS
Definition: swkey.h:35
virtual int getVerseMax() const
Definition: versekey.cpp:1333
signed char book
Definition: versekey.h:96
char error
Definition: swkey.h:106
char autonorm
Definition: versekey.h:65
int BMAX[2]
Definition: versekey.h:120
virtual SWKEY_OPERATORS SWKey& VerseTreeKey::operator= ( const VerseKey ikey)
inlinevirtual

Reimplemented from VerseKey.

Definition at line 123 of file versetreekey.h.

123 { copyFrom(ikey); return *this; }
virtual void copyFrom(const SWKey &ikey)
Definition: versekey.cpp:239
char VerseKey::parse ( bool  checkNormalize = true)
protectedvirtualinherited

Parse a character array into testament|book|chapter|verse

Definition at line 326 of file versekey.cpp.

327 {
328  testament = BMAX[1]?2:1;
329  book = BMAX[BMAX[1]?1:0];
330  chapter = 1;
331  verse = 1;
332 
333  int error = 0;
334 
335  if (keytext) {
336  // pass our own copy of keytext as keytext memory may be freshed during parse
337  ListKey tmpListKey = parseVerseList(SWBuf(keytext).c_str());
338  if (tmpListKey.getCount()) {
339  this->positionFrom(*tmpListKey.getElement(0));
340  error = this->error;
341  } else error = 1;
342  }
343  if (checkAutoNormalize) {
344  normalize(true);
345  }
346  freshtext();
347 
348  return (this->error) ? this->error : (this->error = error);
349 }
signed int chapter
Definition: versekey.h:97
virtual int getCount() const
Definition: listkey.cpp:211
Definition: swbuf.h:47
signed char testament
Definition: versekey.h:95
char * keytext
Definition: swkey.h:102
virtual void positionFrom(const SWKey &ikey)
Definition: versekey.cpp:183
signed int verse
Definition: versekey.h:98
virtual SWKey * getElement(int pos=-1)
Definition: listkey.cpp:270
virtual ListKey parseVerseList(const char *buf, const char *defaultKey=0, bool expandRange=false, bool useChapterAsVerse=false)
Definition: versekey.cpp:515
void freshtext() const
Definition: versekey.cpp:357
virtual void normalize(bool autocheck=false)
Definition: versekey.cpp:1401
signed char book
Definition: versekey.h:96
char error
Definition: swkey.h:106
int BMAX[2]
Definition: versekey.h:120
ListKey VerseKey::parseVerseList ( const char *  buf,
const char *  defaultKey = 0,
bool  expandRange = false,
bool  useChapterAsVerse = false 
)
virtualinherited

Definition at line 515 of file versekey.cpp.

515  {
516 
517  // hold on to our own copy of params, as threads/recursion may change outside values
518  const char *bufStart = buf;
519  SWBuf iBuf = buf;
520  buf = iBuf.c_str();
521  SWBuf iDefaultKey = defaultKey;
522  if (defaultKey) defaultKey = iDefaultKey.c_str();
523 
524  char book[2048]; // TODO: bad, remove
525  char number[2048]; // TODO: bad, remove
526  *book = 0;
527  *number = 0;
528  int tobook = 0;
529  int tonumber = 0;
530  char suffix = 0;
531  int chap = -1, verse = -1;
532  int bookno = 0;
533  int loop;
534  char comma = 0;
535  char dash = 0;
536  const char *orig = buf;
537  int q;
538  ListKey tmpListKey;
540  char lastPartial = 0;
541  bool inTerm = true;
542  int notAllDigits = 0;
543  bool doubleF = false;
544 
545  // assert we have a buffer
546  if (!buf) return internalListKey;
547 
548  VerseKey *curKey = (VerseKey *)this->clone();
549  VerseKey *lastKey = (VerseKey *)this->clone();
550  lastKey->clearBounds();
551  curKey->clearBounds();
552 
553  // some silly checks for corner cases
554  if (!strcmp(buf, "[ Module Heading ]")) {
555  curKey->setVerse(0);
556  curKey->setChapter(0);
557  curKey->setBook(0);
558  curKey->setTestament(0);
559  lastKey->setLowerBound(*curKey);
560  lastKey->setUpperBound(*curKey);
561  internalListKey << *lastKey;
562  delete curKey;
563  delete lastKey;
564  return internalListKey;
565  }
566  if ((!strncmp(buf, "[ Testament ", 12)) &&
567  (isdigit(buf[12])) &&
568  (!strcmp(buf+13, " Heading ]"))) {
569  curKey->setVerse(0);
570  curKey->setChapter(0);
571  curKey->setBook(0);
572  curKey->setTestament(buf[12]-48);
573  lastKey->setLowerBound(*curKey);
574  lastKey->setUpperBound(*curKey);
575  internalListKey << *lastKey;
576  delete curKey;
577  delete lastKey;
578  return internalListKey;
579  }
580 
582  lastKey->setAutoNormalize(false);
583  if (defaultKey) *lastKey = defaultKey;
584 
585  while (*buf) {
586  switch (*buf) {
587  case ':':
588  if (buf[1] != ' ') { // for silly "Mat 1:1: this verse...."
589  number[tonumber] = 0;
590  tonumber = 0;
591  if (*number) {
592  if (chap >= 0)
593  verse = atoi(number);
594  else chap = atoi(number);
595  }
596  *number = 0;
597  comma = 0;
598  break;
599  }
600  goto terminate_range;
601  // otherwise drop down to next case
602  case ' ':
603  inTerm = true;
604  while (true) {
605  if ((!*number) || (chap < 0))
606  break;
607  for (q = 1; ((buf[q]) && (buf[q] != ' ')); q++);
608  if (buf[q] == ':')
609  break;
610  inTerm = false;
611  break;
612  }
613  if (inTerm) {
614  if (tobook < 1 || book[tobook-1] != ' ') {
615  book[tobook++] = ' ';
616  }
617  break;
618  }
619 
620  case '-':
621  if (chap == -1) {
622  book[tobook] = *buf;
623  book[tobook+1] = *(buf+1);
624  book[tobook+2] = 0;
625  int bookno = getBookFromAbbrev(book);
626  if (bookno > -1) {
627  tobook++;
628  buf++;
629  break;
630  }
631  }
632  case ',': // on number new verse
633  case ';': // on number new chapter
634 terminate_range:
635  number[tonumber] = 0;
636  tonumber = 0;
637  if (*number) {
638  if (chap >= 0)
639  verse = atoi(number);
640  else chap = atoi(number);
641  }
642  *number = 0;
643  book[tobook] = 0;
644  tobook = 0;
645  bookno = -1;
646  if (*book) {
647  loop = (int)strlen(book) - 1;
648 
649  for (; loop+1; loop--) { if (book[loop] == ' ') book[loop] = 0; else break; }
650 
651  if (loop > 0 && isdigit(book[loop-1]) && book[loop] >= 'a' && book[loop] <= 'z') {
652  book[loop--] = 0;
653  }
654  for (; loop+1; loop--) {
655  if ((isdigit(book[loop])) || (book[loop] == ' ')) {
656  book[loop] = 0;
657  continue;
658  }
659  else {
660  if ((SW_toupper(book[loop])=='F')&&(loop)) {
661  if ((isdigit(book[loop-1])) || (book[loop-1] == ' ') || (SW_toupper(book[loop-1]) == 'F')) {
662  book[loop] = 0;
663  continue;
664  }
665  }
666  }
667  break;
668  }
669 
670  for (loop = (int)strlen(book) - 1; loop+1; loop--) {
671  if (book[loop] == ' ') {
672  // "PS C" is ok, but "II C" is not ok
673  if (isRoman(&book[loop+1]) && !isRoman(book,loop)) {
674  if (verse == -1) {
675  verse = chap;
676  chap = fromRoman(&book[loop+1]);
677  book[loop] = 0;
678  }
679  }
680  break;
681  }
682  }
683 
684  // check for special inscriptio and subscriptio which are saved as book intro and chap 1 intro (for INTF)
685  for (loop = (int)strlen(book) - 1; loop+1; loop--) {
686  if (book[loop] == ' ') {
687  if (!strnicmp(&book[loop+1], "inscriptio", (int)strlen(&book[loop+1]))) {
688  book[loop] = 0;
689  verse = 0;
690  chap = 0;
691  }
692  else if (!strnicmp(&book[loop+1], "subscriptio", (int)strlen(&book[loop+1]))) {
693  book[loop] = 0;
694  verse = 0;
695  chap = 1;
696  }
697  break;
698  }
699  }
700 
701  if ((!stricmp(book, "V")) || (!stricmp(book, "VER"))) { // Verse abbrev
702  if (verse == -1) {
703  verse = chap;
704  chap = lastKey->getChapter();
705  *book = 0;
706  }
707  }
708  if ((!stricmp(book, "ch")) || (!stricmp(book, "chap"))) { // Verse abbrev
709  strcpy(book, lastKey->getBookName());
710  }
711  bookno = getBookFromAbbrev(book);
712  if ((bookno > -1) && (suffix == 'f') && (book[strlen(book)-1] == 'f')) {
713  suffix = 0;
714  }
715  }
716  if (((bookno > -1) || (!*book)) && ((*book) || (chap >= 0) || (verse >= 0))) {
717  char partial = 0;
718  curKey->setVerse(1);
719  curKey->setChapter(1);
720  curKey->setBook(1);
721 
722  if (bookno < 0) {
723  curKey->setTestament(lastKey->getTestament());
724  curKey->setBook(lastKey->getBook());
725  }
726  else {
727  int t = 1;
728  if (bookno > BMAX[0]) {
729  t++;
730  bookno -= BMAX[0];
731  }
732  curKey->setTestament(t);
733  curKey->setBook(bookno);
734  }
735 
736 
737  if (((comma)||((verse < 0)&&(bookno < 0)))&&(!lastPartial)) {
738 // if (comma) {
739  curKey->setChapter(lastKey->getChapter());
740  curKey->setVerse(chap); // chap because this is the first number captured
741  if (suffix) {
742  curKey->setSuffix(suffix);
743  }
744  }
745  else {
746  if (useChapterAsVerse && verse < 0 && chap > 0 && curKey->getChapterMax() == 1) {
747  verse = chap;
748  chap = 1;
749  }
750 
751 
752  if (chap >= 0) {
753  curKey->setChapter(chap);
754  }
755  else {
756  partial++;
757  curKey->setChapter(1);
758  }
759  if (verse >= 0) {
760  curKey->setVerse(verse);
761  if (suffix) {
762  curKey->setSuffix(suffix);
763  }
764  }
765  else {
766  partial++;
767  curKey->setVerse(1);
768  }
769  }
770 
771  // check for '-'
772  for (q = 0; ((buf[q]) && (buf[q] == ' ')); q++);
773  if ((buf[q] == '-') && (expandRange)) { // if this is a dash save lowerBound and wait for upper
774  buf+=q;
775  lastKey->setLowerBound(*curKey);
776  lastKey->setPosition(TOP);
777  tmpListKey << *lastKey;
778  ((VerseKey *)tmpListKey.getElement())->setAutoNormalize(isAutoNormalize());
779  tmpListKey.getElement()->userData = (SW_u64)(bufStart + (buf - iBuf.c_str()));
780  }
781  else {
782  if (!dash) { // if last separator was not a dash just add
783  if (expandRange && partial) {
784  lastKey->setLowerBound(*curKey);
785  if (partial > 1)
786  curKey->setPosition(MAXCHAPTER);
787  if (partial > 0)
788  *curKey = MAXVERSE;
789  lastKey->setUpperBound(*curKey);
790  *lastKey = TOP;
791  tmpListKey << *lastKey;
792  ((VerseKey *)tmpListKey.getElement())->setAutoNormalize(isAutoNormalize());
793  tmpListKey.getElement()->userData = (SW_u64)(bufStart + (buf - iBuf.c_str()));
794  }
795  else {
796  bool f = false;
797  if (curKey->getSuffix() == 'f') {
798  curKey->setSuffix(0);
799  f = true;
800  }
801  lastKey->setLowerBound(*curKey);
802  if (f && doubleF) (*curKey) = MAXVERSE;
803  else if (f) (*curKey)++;
804  lastKey->setUpperBound(*curKey);
805  *lastKey = TOP;
806  tmpListKey << *lastKey;
807  ((VerseKey *)tmpListKey.getElement())->setAutoNormalize(isAutoNormalize());
808  tmpListKey.getElement()->userData = (SW_u64)(bufStart + (buf - iBuf.c_str()));
809  }
810  }
811  else if (expandRange) {
812  VerseKey *newElement = SWDYNAMIC_CAST(VerseKey, tmpListKey.getElement());
813  if (newElement) {
814  if (partial > 1)
815  *curKey = MAXCHAPTER;
816  if (partial > 0)
817  *curKey = MAXVERSE;
818  newElement->setUpperBound(*curKey);
819  *lastKey = *curKey;
820  *newElement = TOP;
821  tmpListKey.getElement()->userData = (SW_u64)(bufStart + (buf - iBuf.c_str()));
822  }
823  }
824  }
825  lastPartial = partial;
826  }
827  *book = 0;
828  chap = -1;
829  verse = -1;
830  suffix = 0;
831  if (*buf == ',')
832  comma = 1;
833  else comma = 0;
834  if (*buf == '-')
835  dash = 1;
836  else dash = 0;
837  break;
838  case 10: // ignore these
839  case 13:
840  case '[':
841  case ']':
842  case '(':
843  case ')':
844  case '{':
845  case '}':
846  break;
847  case '.':
848  if (buf > orig) { // ignore (break) if preceeding char is not a digit
849  for (notAllDigits = tobook; notAllDigits; notAllDigits--) {
850  if ((!isdigit(book[notAllDigits-1])) && (!strchr(" .", book[notAllDigits-1])))
851  break;
852  }
853  if (!notAllDigits && !isdigit(buf[1]))
854  break;
855  }
856 
857  number[tonumber] = 0;
858  tonumber = 0;
859  if (*number) {
860  if (chap >= 0)
861  verse = atoi(number);
862  else chap = atoi(number);
863  *number = 0;
864  }
865  else if (chap == -1 && (tobook < 1 || book[tobook-1] != ' ')) {
866  book[tobook++] = ' ';
867  }
868 
869  break;
870 
871  default:
872  if (isdigit(*buf)) {
873  number[tonumber++] = *buf;
874  suffix = 0;
875  doubleF = 0;
876  }
877  else {
878  switch (*buf) {
879  case ' ': // ignore these and don't reset number
880  case 'F':
881  break;
882  default:
883  // suffixes (and oddly 'f'-- ff.)
884  if ((*buf >= 'a' && *buf <= 'z' && (chap >=0 || bookno > -1 || lastKey->isBoundSet()))
885  || *buf == 'f') {
886  // if suffix is already an 'f', then we need to mark if we're doubleF.
887  doubleF = (*buf == 'f' && suffix == 'f');
888  if (suffix && !doubleF) {
889  // we've already had a suffix one, so this is another letter, thus any number is not a number, e.g., '2jn'. We're on 'n'
890  number[tonumber] = 0;
891  tonumber = 0;
892  }
893  suffix = *buf;
894  }
895  else {
896  number[tonumber] = 0;
897  tonumber = 0;
898  }
899  break;
900  }
901  }
902  if (chap == -1)
903  book[tobook++] = *buf;
904  }
905  buf++;
906  }
907  number[tonumber] = 0;
908  tonumber = 0;
909  if (*number) {
910  if (chap >= 0)
911  verse = atoi(number);
912  else chap = atoi(number);
913  }
914  *number = 0;
915  book[tobook] = 0;
916  tobook = 0;
917  if (*book) {
918  loop = (int)strlen(book) - 1;
919 
920  // strip trailing spaces
921  for (; loop+1; loop--) { if (book[loop] == ' ') book[loop] = 0; else break; }
922 
923  // check if endsWith([0-9][a-z]) and kill the last letter, e.g., ...12a, and chop off the 'a'
924  // why? What's this for? wouldn't this mess up 2t?
925  if (loop > 0 && isdigit(book[loop-1]) && book[loop] >= 'a' && book[loop] <= 'z') {
926  book[loop--] = 0;
927  }
928 
929  // skip trailing spaces and numbers
930  for (; loop+1; loop--) {
931  if ((isdigit(book[loop])) || (book[loop] == ' ')) {
932  book[loop] = 0;
933  continue;
934  }
935  else {
936  if ((SW_toupper(book[loop])=='F')&&(loop)) {
937  if ((isdigit(book[loop-1])) || (book[loop-1] == ' ') || (SW_toupper(book[loop-1]) == 'F')) {
938  book[loop] = 0;
939  continue;
940  }
941  }
942  }
943  break;
944  }
945 
946  // check for roman numeral chapter
947  for (loop = (int)strlen(book) - 1; loop+1; loop--) {
948  if (book[loop] == ' ') {
949  // "PS C" is ok, but "II C" is not ok
950  if (isRoman(&book[loop+1]) && !isRoman(book,loop)) {
951  if (verse == -1) {
952  verse = chap;
953  chap = fromRoman(&book[loop+1]);
954  book[loop] = 0;
955  }
956  }
957  break;
958  }
959  }
960  // check for special inscriptio and subscriptio which are saved as book intro and chap 1 intro (for INTF)
961  for (loop = (int)strlen(book) - 1; loop+1; loop--) {
962  if (book[loop] == ' ') {
963  if (!strnicmp(&book[loop+1], "inscriptio", (int)strlen(&book[loop+1]))) {
964  book[loop] = 0;
965  verse = 0;
966  chap = 0;
967  suffix = 0;
968  }
969  else if (!strnicmp(&book[loop+1], "subscriptio", (int)strlen(&book[loop+1]))) {
970  book[loop] = 0;
971  verse = 0;
972  chap = 1;
973  suffix = 0;
974  }
975  break;
976  }
977  }
978 
979  if ((!stricmp(book, "V")) || (!stricmp(book, "VER"))) { // Verse abbrev.
980  if (verse == -1) {
981  verse = chap;
982  chap = lastKey->getChapter();
983  *book = 0;
984  }
985  }
986 
987  if ((!stricmp(book, "ch")) || (!stricmp(book, "chap"))) { // Verse abbrev
988  strcpy(book, lastKey->getBookName());
989  }
990  bookno = getBookFromAbbrev(book);
991  if ((bookno > -1) && (suffix == 'f') && (book[strlen(book)-1] == 'f')) {
992  suffix = 0;
993  }
994  }
995  if (((bookno > -1) || (!*book)) && ((*book) || (chap >= 0) || (verse >= 0))) {
996  char partial = 0;
997  curKey->setVerse(1);
998  curKey->setChapter(1);
999  curKey->setBook(1);
1000 
1001  if (bookno < 0) {
1002  curKey->setTestament(lastKey->getTestament());
1003  curKey->setBook(lastKey->getBook());
1004  }
1005  else {
1006  int t = 1;
1007  if (bookno > BMAX[0]) {
1008  t++;
1009  bookno -= BMAX[0];
1010  }
1011  curKey->setTestament(t);
1012  curKey->setBook(bookno);
1013  }
1014 
1015  if (((comma)||((verse < 0)&&(bookno < 0)))&&(!lastPartial)) {
1016  curKey->setChapter(lastKey->getChapter());
1017  curKey->setVerse(chap); // chap because this is the first number captured
1018  if (suffix) {
1019  curKey->setSuffix(suffix);
1020  }
1021  }
1022  else {
1023  if (useChapterAsVerse && verse < 0 && chap > 0 && curKey->getChapterMax() == 1) {
1024  verse = chap;
1025  chap = 1;
1026  }
1027 
1028 
1029  if (chap >= 0) {
1030  curKey->setChapter(chap);
1031  }
1032  else {
1033  partial++;
1034  curKey->setChapter(1);
1035  }
1036  if (verse >= 0) {
1037  curKey->setVerse(verse);
1038  if (suffix) {
1039  curKey->setSuffix(suffix);
1040  }
1041  }
1042  else {
1043  partial++;
1044  curKey->setVerse(1);
1045  }
1046  }
1047 
1048  if ((*buf == '-') && (expandRange)) { // if this is a dash save lowerBound and wait for upper
1049  lastKey->setLowerBound(*curKey);
1050  *lastKey = TOP;
1051  tmpListKey << *lastKey;
1052  tmpListKey.getElement()->userData = (SW_u64)(bufStart + (buf - iBuf.c_str()));
1053  }
1054  else {
1055  if (!dash) { // if last separator was not a dash just add
1056  if (expandRange && partial) {
1057  lastKey->setLowerBound(*curKey);
1058  if (partial > 1)
1059  *curKey = MAXCHAPTER;
1060  if (partial > 0)
1061  *curKey = MAXVERSE;
1062  lastKey->setUpperBound(*curKey);
1063  *lastKey = TOP;
1064  tmpListKey << *lastKey;
1065  tmpListKey.getElement()->userData = (SW_u64)(bufStart + (buf - iBuf.c_str()));
1066  }
1067  else {
1068  bool f = false;
1069  if (curKey->getSuffix() == 'f') {
1070  curKey->setSuffix(0);
1071  f = true;
1072  }
1073  lastKey->setLowerBound(*curKey);
1074  if (f && doubleF) (*curKey) = MAXVERSE;
1075  else if (f) (*curKey)++;
1076  lastKey->setUpperBound(*curKey);
1077  *lastKey = TOP;
1078  tmpListKey << *lastKey;
1079  tmpListKey.getElement()->userData = (SW_u64)(bufStart + (buf - iBuf.c_str()));
1080  }
1081  }
1082  else if (expandRange) {
1083  VerseKey *newElement = SWDYNAMIC_CAST(VerseKey, tmpListKey.getElement());
1084  if (newElement) {
1085  if (partial > 1)
1086  *curKey = MAXCHAPTER;
1087  if (partial > 0)
1088  *curKey = MAXVERSE;
1089  newElement->setUpperBound(*curKey);
1090  *newElement = TOP;
1091  tmpListKey.getElement()->userData = (SW_u64)(bufStart + (buf - iBuf.c_str()));
1092  }
1093  }
1094  }
1095  }
1096  *book = 0;
1097  tmpListKey = TOP;
1098  internalListKey = tmpListKey;
1099  internalListKey = TOP; // Align internalListKey to first element before passing back;
1100 
1101  delete curKey;
1102  delete lastKey;
1103 
1104  return internalListKey;
1105 }
virtual int getChapterMax() const
Definition: versekey.cpp:1327
#define TOP
Definition: swkey.h:68
virtual SWKey * clone() const
Definition: versekey.cpp:278
Definition: swbuf.h:47
virtual const char * getBookName() const
Definition: versekey.cpp:1265
#define MAXVERSE
Definition: versekey.h:43
virtual void setPosition(SW_POSITION newpos)
Definition: versekey.cpp:1288
#define SW_toupper(c)
Definition: utilstr.h:67
virtual void setChapter(int ichapter)
Definition: versekey.cpp:1603
signed char suffix
Definition: versekey.h:99
virtual bool isAutoNormalize() const
Definition: versekey.cpp:1643
signed int verse
Definition: versekey.h:98
virtual void setTestament(char itestament)
Definition: versekey.cpp:1548
int stricmp(const char *s1, const char *s2)
Definition: utilstr.cpp:194
virtual SWKey * getElement(int pos=-1)
Definition: listkey.cpp:270
void setLowerBound(const VerseKey &lb)
Definition: versekey.cpp:1112
ListKey internalListKey
Definition: versekey.h:59
virtual char getSuffix() const
Definition: versekey.cpp:1630
virtual int getChapter() const
Definition: versekey.cpp:1522
const char * c_str() const
Definition: swbuf.h:158
virtual int getBookFromAbbrev(const char *abbr) const
Definition: versekey.cpp:396
SWORD_NAMESPACE_START char isRoman(const char *str, int maxchars)
Definition: roman.cpp:31
virtual void setSuffix(char isuffix)
Definition: versekey.cpp:1634
virtual void setVerse(int iverse)
Definition: versekey.cpp:1622
virtual char getBook() const
Definition: versekey.cpp:1510
#define SWDYNAMIC_CAST(className, object)
Definition: defs.h:47
void setUpperBound(const VerseKey &ub)
Definition: versekey.cpp:1135
unsigned long long SW_u64
Definition: sysdata.h:56
void clearBounds() const
Definition: versekey.cpp:1202
virtual void setBook(char ibook)
Definition: versekey.cpp:1565
int strnicmp(const char *s1, const char *s2, int len)
Definition: utilstr.cpp:180
int fromRoman(const char *str)
Definition: roman.cpp:39
signed char book
Definition: versekey.h:96
SW_u64 userData
Definition: swkey.h:115
#define MAXCHAPTER
Definition: versekey.h:44
int BMAX[2]
Definition: versekey.h:120
virtual void setAutoNormalize(bool iautonorm)
Definition: versekey.cpp:1648
virtual char getTestament() const
Definition: versekey.cpp:1498
SWDEPRECATED ListKey VerseKey::ParseVerseList ( const char *  buf,
const char *  defaultKey = 0,
bool  expandRange = false,
bool  useChapterAsVerse = false 
)
inlineinherited
Deprecated:
Use parseVerseList

Definition at line 453 of file versekey.h.

453 { return parseVerseList(buf, defaultKey, expandRange, useChapterAsVerse); }
virtual ListKey parseVerseList(const char *buf, const char *defaultKey=0, bool expandRange=false, bool useChapterAsVerse=false)
Definition: versekey.cpp:515
SWDEPRECATED char SWKey::Persist ( ) const
inlineinherited
Deprecated:
Use isPersist

Definition at line 148 of file swkey.h.

148 { return isPersist(); }
bool isPersist() const
Definition: swkey.cpp:99
SWDEPRECATED char SWKey::Persist ( signed char  ipersist)
inlineinherited
Deprecated:
Use setPersist and isPersist instead.

Definition at line 158 of file swkey.h.

158 { setPersist(ipersist!=0); return isPersist(); }
void setPersist(bool ipersist)
Definition: swkey.cpp:135
bool isPersist() const
Definition: swkey.cpp:99
char SWKey::popError ( )
virtualinherited

Gets and clears error status

Returns
error status

Definition at line 147 of file swkey.cpp.

148 {
149  char retval = error;
150 
151  error = 0;
152  return retval;
153 }
char error
Definition: swkey.h:106
void VerseTreeKey::positionChanged ( )
virtual

Implements TreeKey::PositionChangeListener.

Definition at line 188 of file versetreekey.cpp.

188  {
189  if (!internalPosChange) {
191  int saveError = tkey->popError();
192  long bookmark = tkey->getOffset();
193  SWBuf seg[4];
194  internalPosChange = true;
195  int legs = 0;
196  do {
197  seg[legs] = tkey->getLocalName();
198  legs++;
199  } while (tkey->parent() && (legs < 4));
200 
201  legs--;
202 
203  if ((legs < 2) && (!seg[0].length() || seg[0] == "/")) { //"[ Module Heading ]";
204  testament = 0;
205  book = 0;
206  chapter = 0;
207  setVerse(0);
208  }
209  else if ((legs < 2)
210  && ((!strncmp(seg[0].c_str(), "[ Testament ", 12)) && //"[ Testament n Heading ]";
211  (isdigit(seg[0][12])) &&
212  (!strcmp(seg[0].c_str()+13, " Heading ]")))) {
213  testament = (seg[0][12]-48);
214  book = 0;
215  chapter = 0;
216  setVerse(0);
217  } //path = "[ Module Heading ]";
218  else {
219  setBookName(seg[--legs]);
220  chapter = (legs > 0) ? atoi(seg[--legs]) : 0;
221  setVerse((legs > 0) ? atoi(seg[--legs]) : 0);
222  }
223 
224 // setText(path);
225  if (saveError) {
226  error = saveError;
227  }
228  tkey->setOffset(bookmark);
229  tkey->setError(saveError);
230  internalPosChange = false;
231  }
232 }
virtual bool parent()=0
virtual unsigned long getOffset() const =0
signed int chapter
Definition: versekey.h:97
Definition: swbuf.h:47
unsigned long length() const
Definition: swbuf.h:197
virtual void setOffset(unsigned long offset)=0
signed char testament
Definition: versekey.h:95
virtual void setBookName(const char *bname)
Definition: versekey.cpp:1582
virtual const char * getLocalName()=0
virtual void setVerse(int iverse)
Definition: versekey.cpp:1622
virtual char popError()
Definition: swkey.cpp:147
signed char book
Definition: versekey.h:96
char error
Definition: swkey.h:106
virtual void setError(char err)
Definition: swkey.h:165
bool internalPosChange
Definition: versetreekey.h:109
void VerseKey::positionFrom ( const SWKey ikey)
virtualinherited

Only repositions this VerseKey to another VerseKey

Reimplemented from SWKey.

Definition at line 183 of file versekey.cpp.

183  {
184  error = 0;
185  const SWKey *fromKey = &ikey;
186  const ListKey *tryList = SWDYNAMIC_CAST(const ListKey, fromKey);
187  if (tryList) {
188  const SWKey *k = tryList->getElement();
189  if (k) fromKey = k;
190  }
191  const VerseKey *tryVerse = SWDYNAMIC_CAST(const VerseKey, fromKey);
192  if (tryVerse) {
193  setFromOther(*tryVerse);
194  }
195  else {
196  SWKey::positionFrom(*fromKey);
197 // extraneous parse which inadvertently clears error flag
198 // SWKey::positionFrom already calls copyFrom which calls setText, which VerseKey::setText already calls parse()
199 // parse();
200  }
201 
202  // should we always perform bounds checks? Tried but seems to cause infinite recursion
203  if (_compare(getUpperBound()) > 0) {
206  }
207  if (_compare(getLowerBound()) < 0) {
210  }
211 }
VerseKey & getLowerBound() const
Definition: versekey.cpp:1156
virtual void positionFrom(const SWKey &ikey)
Definition: swkey.h:180
virtual SWKey * getElement(int pos=-1)
Definition: listkey.cpp:270
virtual int _compare(const VerseKey &ikey)
Definition: versekey.cpp:1790
VerseKey & getUpperBound() const
Definition: versekey.cpp:1179
#define SWDYNAMIC_CAST(className, object)
Definition: defs.h:47
#define KEYERR_OUTOFBOUNDS
Definition: swkey.h:35
char error
Definition: swkey.h:106
void setFromOther(const VerseKey &vk)
Definition: versekey.cpp:124
Definition: swkey.h:77
void VerseKey::setAutoNormalize ( bool  iautonorm)
virtualinherited

Sets flag that tells VerseKey to automatically normalize itself when modified

Parameters
iautonormvalue which to set autonorm

Definition at line 1648 of file versekey.cpp.

1649 {
1650  autonorm = iautonorm?1:0;
1651  normalize(true);
1652 }
virtual void normalize(bool autocheck=false)
Definition: versekey.cpp:1401
char autonorm
Definition: versekey.h:65
void VerseKey::setBook ( char  ibook)
virtualinherited

Sets book

Parameters
ibookvalue which to set book

Definition at line 1565 of file versekey.cpp.

1566 {
1567  suffix = 0;
1568  verse = (intros) ? 0 : 1;
1569  chapter = (intros) ? 0 : 1;
1570  book = ibook;
1571  normalize(true);
1572 }
signed int chapter
Definition: versekey.h:97
signed char suffix
Definition: versekey.h:99
signed int verse
Definition: versekey.h:98
char intros
Definition: versekey.h:69
virtual void normalize(bool autocheck=false)
Definition: versekey.cpp:1401
signed char book
Definition: versekey.h:96
void VerseKey::setBookName ( const char *  bname)
virtualinherited

Definition at line 1582 of file versekey.cpp.

1583 {
1584  int bnum = getBookFromAbbrev(bname);
1585  if (bnum > -1) {
1586  if (bnum > BMAX[0]) {
1587  bnum -= BMAX[0];
1588  testament = 2;
1589  }
1590  else testament = 1;
1591  setBook(bnum);
1592  }
1593  else error = KEYERR_OUTOFBOUNDS;
1594 }
signed char testament
Definition: versekey.h:95
virtual int getBookFromAbbrev(const char *abbr) const
Definition: versekey.cpp:396
#define KEYERR_OUTOFBOUNDS
Definition: swkey.h:35
virtual void setBook(char ibook)
Definition: versekey.cpp:1565
char error
Definition: swkey.h:106
int BMAX[2]
Definition: versekey.h:120
void VerseKey::setChapter ( int  ichapter)
virtualinherited

Sets chapter

Parameters
ichaptervalue which to set chapter

Definition at line 1603 of file versekey.cpp.

1604 {
1605  suffix = 0;
1606  verse = (intros) ? 0 : 1;
1607  chapter = ichapter;
1608  normalize(true);
1609 }
signed int chapter
Definition: versekey.h:97
signed char suffix
Definition: versekey.h:99
signed int verse
Definition: versekey.h:98
char intros
Definition: versekey.h:69
virtual void normalize(bool autocheck=false)
Definition: versekey.cpp:1401
virtual void SWKey::setError ( char  err)
inlinevirtualinherited

Definition at line 165 of file swkey.h.

165 { error = err; }
char error
Definition: swkey.h:106
void VerseKey::setIndex ( long  iindex)
virtualinherited

Sets index based upon current verse

Parameters
iindexvalue to set index to

Reimplemented from SWKey.

Definition at line 1718 of file versekey.cpp.

1719 {
1720  // assert we're sane
1721  if (iindex < 0) {
1723  return;
1724  }
1725 
1726  int b;
1727  error = refSys->getVerseFromOffset(iindex, &b, &chapter, &verse);
1728  book = (unsigned char)b;
1729  testament = 1;
1730  if (book > BMAX[0]) {
1731  book -= BMAX[0];
1732  testament = 2;
1733  }
1734  // special case for Module and Testament heading
1735  if (book < 0) { testament = 0; book = 0; }
1736  if (chapter < 0) { book = 0; chapter = 0; }
1737 
1738  checkBounds();
1739 }
signed int chapter
Definition: versekey.h:97
signed char testament
Definition: versekey.h:95
const VersificationMgr::System * refSys
Definition: versekey.h:61
signed int verse
Definition: versekey.h:98
char getVerseFromOffset(long offset, int *book, int *chapter, int *verse) const
#define KEYERR_OUTOFBOUNDS
Definition: swkey.h:35
signed char book
Definition: versekey.h:96
char error
Definition: swkey.h:106
void checkBounds()
Definition: versekey.cpp:1741
int BMAX[2]
Definition: versekey.h:120
void VerseKey::setIntros ( bool  val)
virtualinherited

The Intros property determine whether or not to include chapter/book/testament/module intros

Definition at line 1663 of file versekey.cpp.

1664 {
1665  intros = val;
1666  normalize(true);
1667 }
char intros
Definition: versekey.h:69
virtual void normalize(bool autocheck=false)
Definition: versekey.cpp:1401
void SWKey::setLocale ( const char *  name)
inlineinherited

Definition at line 225 of file swkey.h.

225 { stdstr(&localeName, name); locale = 0; } // this will force an on demand lookup of our locale
char * localeName
Definition: swkey.h:108
SWORD_NAMESPACE_START char * stdstr(char **ipstr, const char *istr, unsigned int memPadFactor=1)
Definition: utilstr.h:44
SWLocale * locale
Definition: swkey.h:94
void VerseKey::setLowerBound ( const VerseKey lb)
inherited

sets the lower boundary for this VerseKey

Parameters
lbthe new lower boundary for this VerseKey

Definition at line 1112 of file versekey.cpp.

1113 {
1114  initBounds();
1115 
1116  lowerBound = lb.getIndex();
1122 
1123  // both this following check and UpperBound check force upperBound to
1124  // change allowing LowerBound then UpperBound logic to always flow
1125  // and set values without restrictions, as expected
1127  boundSet = true;
1128 }
VerseComponents lowerBoundComponents
Definition: versekey.h:89
bool boundSet
Definition: swkey.h:104
virtual char getSuffix() const
Definition: versekey.cpp:1630
virtual int getChapter() const
Definition: versekey.cpp:1522
virtual char getBook() const
Definition: versekey.cpp:1510
virtual int getVerse() const
Definition: versekey.cpp:1534
void initBounds() const
Definition: versekey.cpp:1209
long lowerBound
Definition: versekey.h:84
long upperBound
Definition: versekey.h:84
virtual char getTestament() const
Definition: versekey.cpp:1498
virtual long getIndex() const
Definition: versekey.cpp:1681
void SWKey::setPersist ( bool  ipersist)
inherited

Sets whether this key should persist in any module to which it is set otherwise just a copy will be used in the module.

Parameters
ipersistvalue which to set persist;

Definition at line 135 of file swkey.cpp.

136 {
137  persist = ipersist;
138 }
bool persist
Definition: swkey.h:105
void VerseTreeKey::setPosition ( SW_POSITION  newpos)
virtual

Positions this key

Parameters
newposPosition to set to.

Reimplemented from VerseKey.

Definition at line 274 of file versetreekey.cpp.

274  {
275 
276  if (isBoundSet()) {
277  return VerseKey::setPosition(p);
278  }
279 
280  switch (p) {
281  case POS_TOP:
282  popError();
283  treeKey->setPosition(p);
284  increment();
285  decrement();
286  popError();
287  break;
288  case POS_BOTTOM:
289  popError();
290  treeKey->setPosition(p);
291  decrement();
292  increment();
293  popError();
294  break;
295  case POS_MAXVERSE:
296  case POS_MAXCHAPTER:
298  break;
299  }
300 }
virtual bool isBoundSet() const
Definition: swkey.h:189
virtual void setPosition(SW_POSITION p)=0
#define POS_MAXVERSE
Definition: versekey.h:39
#define POS_MAXCHAPTER
Definition: versekey.h:40
virtual void setPosition(SW_POSITION newpos)
Definition: versekey.cpp:1288
virtual void decrement(int steps=1)
#define POS_TOP
Definition: swkey.h:65
TreeKey * treeKey
Definition: versetreekey.h:45
virtual void increment(int steps=1)
virtual char popError()
Definition: swkey.cpp:147
#define POS_BOTTOM
Definition: swkey.h:66
void VerseKey::setSuffix ( char  isuffix)
virtualinherited

Sets/gets verse suffix

Parameters
isuffixvalue which to set verse suffix

Definition at line 1634 of file versekey.cpp.

1634  {
1635  suffix = suf;
1636 }
signed char suffix
Definition: versekey.h:99
void VerseKey::setTestament ( char  itestament)
virtualinherited

Sets testament

Parameters
itestamentvalue which to set testament

Definition at line 1548 of file versekey.cpp.

1549 {
1550  suffix = 0;
1551  verse = (intros) ? 0 : 1;
1552  chapter = (intros) ? 0 : 1;
1553  book = (intros) ? 0 : 1;
1554  testament = itestament;
1555  normalize(true);
1556 }
signed int chapter
Definition: versekey.h:97
signed char testament
Definition: versekey.h:95
signed char suffix
Definition: versekey.h:99
signed int verse
Definition: versekey.h:98
char intros
Definition: versekey.h:69
virtual void normalize(bool autocheck=false)
Definition: versekey.cpp:1401
signed char book
Definition: versekey.h:96
virtual void VerseKey::setText ( const char *  ikey,
bool  checkNormalize 
)
inlinevirtualinherited

Definition at line 220 of file versekey.h.

220 { SWKey::setText(ikey); parse(checkNormalize); }
virtual void setText(const char *ikey)
Definition: swkey.cpp:162
virtual char parse(bool checkNormalize=true)
Definition: versekey.cpp:326
virtual void VerseKey::setText ( const char *  ikey)
inlinevirtualinherited

Sets this SWKey with a character string

Parameters
ikeystring used to set this key

Reimplemented from SWKey.

Definition at line 221 of file versekey.h.

221 { SWKey::setText(ikey); parse(); }
virtual void setText(const char *ikey)
Definition: swkey.cpp:162
virtual char parse(bool checkNormalize=true)
Definition: versekey.cpp:326
void TreeKey::PositionChangeListener::setTreeKey ( TreeKey tk)
inlineinherited

Definition at line 61 of file treekey.h.

61 { treeKey = tk; }
void VerseKey::setUpperBound ( const VerseKey ub)
inherited

sets the upper boundary for this VerseKey

Parameters
ubthe new upper boundary for this VerseKey

Definition at line 1135 of file versekey.cpp.

1136 {
1137  initBounds();
1138 
1139  upperBound = ub.getIndex();
1145 
1146  // see setLowerBound comment, above
1148  boundSet = true;
1149 }
bool boundSet
Definition: swkey.h:104
virtual char getSuffix() const
Definition: versekey.cpp:1630
VerseComponents upperBoundComponents
Definition: versekey.h:89
virtual int getChapter() const
Definition: versekey.cpp:1522
virtual char getBook() const
Definition: versekey.cpp:1510
virtual int getVerse() const
Definition: versekey.cpp:1534
void initBounds() const
Definition: versekey.cpp:1209
long lowerBound
Definition: versekey.h:84
long upperBound
Definition: versekey.h:84
virtual char getTestament() const
Definition: versekey.cpp:1498
virtual long getIndex() const
Definition: versekey.cpp:1681
void VerseKey::setVerse ( int  iverse)
virtualinherited

Sets verse

Parameters
iversevalue which to set verse

Definition at line 1622 of file versekey.cpp.

1623 {
1624  suffix = 0;
1625  verse = iverse;
1626  normalize(true);
1627 }
signed char suffix
Definition: versekey.h:99
signed int verse
Definition: versekey.h:98
virtual void normalize(bool autocheck=false)
Definition: versekey.cpp:1401
void VerseKey::setVersificationSystem ( const char *  name)
virtualinherited

Definition at line 298 of file versekey.cpp.

298  {
300  // TODO: cheese, but what should we do if requested v11n system isn't found?
301  if (!newRefSys) newRefSys = VersificationMgr::getSystemVersificationMgr()->getVersificationSystem("KJV");
302  if (refSys != newRefSys) {
303  refSys = newRefSys;
304  BMAX[0] = refSys->getBMAX()[0];
305  BMAX[1] = refSys->getBMAX()[1];
306 
307  // TODO: adjust bounds for versificaion system ???
308  // TODO: when we have mapping done, rethink this
309  //necessary as our bounds might not mean anything in the new v11n system
310  clearBounds();
311  }
312 
313 }
const VersificationMgr::System * refSys
Definition: versekey.h:61
const int * getBMAX() const
void clearBounds() const
Definition: versekey.cpp:1202
static VersificationMgr * getSystemVersificationMgr()
int BMAX[2]
Definition: versekey.h:120
const System * getVersificationSystem(const char *name) const
void VerseTreeKey::syncVerseToTree ( ) const
private

Definition at line 235 of file versetreekey.cpp.

235  {
236  internalPosChange = true;
237  SWBuf path;
238  if (!getTestament()) path = "/"; // "[ Module Heading ]";
239  else if (!getBook()) path.setFormatted("/[ Testament %d Heading ]", getTestament());
240  else path.setFormatted("/%s/%d/%d", getOSISBookName(), getChapter(), getVerse());
241  if (getSuffix()) path += getSuffix();
242  long bookmark = treeKey->getOffset();
243  treeKey->setText(path);
244 
245  // if our module has jacked inconsistencies, then let's put our tree back to where it was
246  if (treeKey->popError()) {
247  treeKey->setOffset(bookmark);
248  }
249 
250  internalPosChange = false;
251 }
virtual unsigned long getOffset() const =0
Definition: swbuf.h:47
virtual void setOffset(unsigned long offset)=0
virtual char getSuffix() const
Definition: versekey.cpp:1630
virtual int getChapter() const
Definition: versekey.cpp:1522
virtual char getBook() const
Definition: versekey.cpp:1510
virtual int getVerse() const
Definition: versekey.cpp:1534
TreeKey * treeKey
Definition: versetreekey.h:45
virtual char popError()
Definition: swkey.cpp:147
virtual void setText(const char *ikey)=0
bool internalPosChange
Definition: versetreekey.h:109
SWBuf & setFormatted(const char *format,...)
Definition: swbuf.cpp:50
virtual const char * getOSISBookName() const
Definition: versekey.cpp:1270
virtual char getTestament() const
Definition: versekey.cpp:1498
SWDEPRECATED char VerseKey::Testament ( ) const
inlineinherited
Deprecated:
Use getTestament() instead.

Definition at line 265 of file versekey.h.

265 { return getTestament(); } // deprecated
virtual char getTestament() const
Definition: versekey.cpp:1498
SWDEPRECATED char VerseKey::Testament ( char  itestament)
inlineinherited
Deprecated:
Use setTestament() instead.

Definition at line 315 of file versekey.h.

315 { char retVal = getTestament(); setTestament(itestament); return retVal; } // deprecated
virtual void setTestament(char itestament)
Definition: versekey.cpp:1548
virtual char getTestament() const
Definition: versekey.cpp:1498
SWDEPRECATED long VerseKey::TestamentIndex ( ) const
inlineinherited
Deprecated:
Use getTestamentIndex()

Definition at line 423 of file versekey.h.

423 { return getTestamentIndex(); } // deprecated, use getTestamentIndex()
virtual long getTestamentIndex() const
Definition: versekey.cpp:1704
SWDEPRECATED VerseKey& VerseKey::UpperBound ( const VerseKey ub)
inlineinherited
Deprecated:
Use setUpperBound / getUpperBound

Definition at line 182 of file versekey.h.

182 { setUpperBound(ub); return getUpperBound(); }
VerseKey & getUpperBound() const
Definition: versekey.cpp:1179
void setUpperBound(const VerseKey &ub)
Definition: versekey.cpp:1135
SWDEPRECATED VerseKey& VerseKey::UpperBound ( ) const
inlineinherited
Deprecated:
Use getUpperBound

Definition at line 200 of file versekey.h.

200 { return getUpperBound(); }
VerseKey & getUpperBound() const
Definition: versekey.cpp:1179
void VerseKey::validateCurrentLocale ( ) const
inherited

Definition at line 473 of file versekey.cpp.

473  {
474  if (SWLog::getSystemLog()->getLogLevel() >= SWLog::LOG_DEBUG) { //make sure log is wanted, this loop stuff costs a lot of time
475  for (int i = 0; i < refSys->getBookCount(); i++) {
477  if (bn != i+1) {
478  char *abbr = 0;
480  strstrip(abbr);
481  SWLog::getSystemLog()->logWarning("VerseKey::Book: %s does not have a matching toupper abbrevs entry! book number returned was: %d, should be %d. Required entry to add to locale:", abbr, bn, i);
482 
484  const bool hasUTF8Support = StringMgr::hasUTF8Support();
485  if (hasUTF8Support) { //we have support for UTF-8 handling; we expect UTF-8 encoded locales
486  stringMgr->upperUTF8(abbr, (unsigned int)(strlen(abbr)*2));
487  }
488  else {
489  stringMgr->upperLatin1(abbr);
490  }
491  SWLOGD("%s=%s\n", abbr, refSys->getBook(i)->getOSISName());
492  delete [] abbr;
493  }
494  }
495  }
496 }
static bool hasUTF8Support()
Definition: stringmgr.h:58
static SWLog * getSystemLog()
Definition: swlog.cpp:53
const VersificationMgr::System * refSys
Definition: versekey.h:61
static StringMgr * getSystemStringMgr()
Definition: stringmgr.cpp:197
else preg translate
Definition: regex.c:8111
SWORD_NAMESPACE_START char * stdstr(char **ipstr, const char *istr, unsigned int memPadFactor=1)
Definition: utilstr.h:44
const Book * getBook(int number) const
virtual int getBookFromAbbrev(const char *abbr) const
Definition: versekey.cpp:396
virtual char * upperUTF8(char *text, unsigned int max=0) const
Definition: stringmgr.cpp:223
const char * getOSISName() const
SWLocale * getPrivateLocale() const
Definition: swkey.cpp:111
void logWarning(const char *fmt,...) const
Definition: swlog.cpp:74
char * strstrip(char *istr)
Definition: utilstr.cpp:118
virtual char * upperLatin1(char *text, unsigned int max=0) const
Definition: stringmgr.cpp:327
const char * getLongName() const
#define SWLOGD(...)
Definition: defs.h:187
static const char LOG_DEBUG
Definition: swlog.h:46
SWDEPRECATED int VerseKey::Verse ( ) const
inlineinherited
Deprecated:
Use getVerse() instead.

Definition at line 298 of file versekey.h.

298 { return getVerse(); } // deprecated
virtual int getVerse() const
Definition: versekey.cpp:1534
SWDEPRECATED int VerseKey::Verse ( int  iverse)
inlineinherited
Deprecated:
Use setVerse() instead.

Definition at line 345 of file versekey.h.

345 { char retVal = getVerse(); setVerse(iverse); return retVal; } // deprecated;
virtual void setVerse(int iverse)
Definition: versekey.cpp:1622
virtual int getVerse() const
Definition: versekey.cpp:1534

Member Data Documentation

int VerseKey::BMAX[2]
inherited

Definition at line 120 of file versekey.h.

signed char VerseKey::book
protectedinherited

Definition at line 96 of file versekey.h.

bool SWKey::boundSet
mutableprotectedinherited

Definition at line 104 of file swkey.h.

signed int VerseKey::chapter
protectedinherited

Definition at line 97 of file versekey.h.

char SWKey::error
mutableprotectedinherited

Definition at line 106 of file swkey.h.

bool VerseTreeKey::internalPosChange
mutable

Definition at line 109 of file versetreekey.h.

char* SWKey::keytext
protectedinherited

Definition at line 102 of file swkey.h.

long VerseTreeKey::lastGoodOffset
private

Definition at line 50 of file versetreekey.h.

char* SWKey::localeName
protectedinherited

Definition at line 108 of file swkey.h.

const SWClass* SWObject::myClass
protectedinherited

Definition at line 55 of file swobject.h.

bool SWKey::persist
protectedinherited

Definition at line 105 of file swkey.h.

char* SWKey::rangeText
mutableprotectedinherited

Definition at line 103 of file swkey.h.

signed char VerseKey::suffix
protectedinherited

Definition at line 99 of file versekey.h.

signed char VerseKey::testament
protectedinherited

The Testament: 0 - Module Heading; 1 - Old; 2 - New

Definition at line 95 of file versekey.h.

TreeKey* VerseTreeKey::treeKey
private

Definition at line 45 of file versetreekey.h.

SW_u64 SWKey::userData
inherited

Definition at line 115 of file swkey.h.

signed int VerseKey::verse
protectedinherited

Definition at line 98 of file versekey.h.


The documentation for this class was generated from the following files: