sword::VerseKey Class Reference

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

#include <versekey.h>

Inheritance diagram for sword::VerseKey:

Inheritance graph
[legend]
Collaboration diagram for sword::VerseKey:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 VerseKey (const char *ikey=0)
 VerseKey Constructor - initializes Instance of VerseKey.
 VerseKey (const SWKey *ikey)
 VerseKey Constructor - initializes instance of VerseKey.
 VerseKey (const char *min, const char *max)
 VerseKey Constructor - initializes instance of VerseKey with boundariess - see also LowerBound() and UpperBound().
 VerseKey (const SWKey &k)
 VerseKey Copy Constructor - will create a new VerseKey based on an existing SWKey.
 VerseKey (const VerseKey &k)
 VerseKey Copy Constructor - will create a new VerseKey based on an existing one.
virtual ~VerseKey ()
 VerseKey Destructor Cleans up an instance of VerseKey.
VerseKeyLowerBound (const char *lb)
 sets the lower boundary for this VerseKey and returns the new boundary
VerseKeyUpperBound (const char *ub)
 sets the upper boundary for this VerseKey and returns the new boundary
VerseKeyLowerBound () const
 gets the lower boundary of this VerseKey
VerseKeyUpperBound () const
 gets the upper boundary of this VerseKey
void ClearBounds ()
 clears the boundaries of this VerseKey
virtual SWKeyclone () const
 Creates a new SWKey based on the current VerseKey see also the Copy Constructor.
virtual const char * getText () const
 refreshes keytext before returning if cast to a (char *) is requested
virtual const char * getShortText () const
virtual void setText (const char *ikey)
 Sets this SWKey with a character string.
virtual void copyFrom (const SWKey &ikey)
 Copies as much info (position, range, etc.
virtual void copyFrom (const VerseKey &ikey)
 Equates this VerseKey to another VerseKey.
virtual void setPosition (SW_POSITION newpos)
 Positions this key.
virtual void decrement (int steps)
 Decrements key a number of verses.
virtual void increment (int steps)
 Increments key a number of verses.
virtual bool isTraversable () const
 Whether or not this key can be ++ -- incremented.
virtual const char * getBookName () const
virtual const char * getBookAbbrev () const
virtual char Testament () const
 Gets testament.
virtual char Book () const
 Gets book.
virtual int Chapter () const
 Gets chapter.
virtual int Verse () const
 Gets verse.
virtual char Testament (char itestament)
 Sets/gets testament.
virtual char Book (char ibook)
 Sets/gets book.
virtual int Chapter (int ichapter)
 Sets/gets chapter.
virtual int Verse (int iverse)
 Sets/gets verse.
virtual void Normalize (char autocheck=0)
 checks limits and normalizes if necessary (e.g.
virtual char AutoNormalize (char iautonorm=((char)((unsignedchar)(1L<< (sizeof(char)*8-1))-1)))
 Sets/gets flag that tells VerseKey to automatically normalize itself when modified.
virtual char Headings (char iheadings=((char)((unsignedchar)(1L<< (sizeof(char)*8-1))-1)))
 Sets/gets flag that tells VerseKey to include chapter/book/testament/module headings.
virtual long NewIndex () const
virtual long Index () const
 Gets index based upon current verse.
virtual long Index (long iindex)
 Sets index based upon current verse.
virtual const char * getOSISRef () const
virtual ListKey ParseVerseList (const char *buf, const char *defaultKey=0, bool expandRange=false)
virtual const char * getRangeText () const
virtual int compare (const SWKey &ikey)
 Compares another SWKey object.
virtual int _compare (const VerseKey &ikey)
 Compares another VerseKey object.
virtual void setBookAbbrevs (const struct abbrev *bookAbbrevs, unsigned int size=0)
virtual void setBooks (const char *iBMAX, struct sbook **ibooks)
virtual void setLocale (const char *name)
virtual const char * getLocale () const
SWKeyoperator= (const char *ikey)
SWKeyoperator= (const SWKey &ikey)
SWKeyoperator= (SW_POSITION pos)
 operator const char * () const
bool operator== (const SWKey &ikey)
bool operator!= (const SWKey &ikey)
virtual bool operator> (const SWKey &ikey)
virtual bool operator< (const SWKey &ikey)
virtual bool operator>= (const SWKey &ikey)
virtual bool operator<= (const SWKey &ikey)
SWKeyoperator-= (int steps)
SWKeyoperator+= (int steps)
SWKeyoperator++ (int)
SWKeyoperator-- (int)
virtual SWKeyoperator= (const VerseKey &ikey)

Static Public Member Functions

static const int getOSISBookNum (const char *bookab)
static const char * convertToOSIS (const char *inRef, const SWKey *defaultKey)
 Tries to parse a string and convert it into an OSIS reference.

Public Attributes

const char * BMAX
sbook ** books

Static Public Attributes

static const char builtin_BMAX [2]
static struct sbookbuiltin_books [2]
static struct abbrev builtin_abbrevs []

Protected Member Functions

void freshtext () const
 Refresh keytext based on testament|book|chapter|verse default auto normalization to true default display headings option is false.
virtual char parse ()
 Parse a character array into testament|book|chapter|verse.

Private Member Functions

int getBookAbbrev (const char *abbr)
void initBounds () const
void initstatics ()
 initialize and allocate books array
void init ()
 initializes this VerseKey()
int findindex (long *array, int size, long value)
 Binary search to find the index closest, but less than the given value.

Private Attributes

ListKey internalListKey
abbrevabbrevs
char * locale
int abbrevsCnt
signed char testament
 The Testament: 0 - Old; 1 - New.
signed char book
signed int chapter
signed int verse
char autonorm
 flag for auto normalization
char headings
 flag for headings on/off
VerseKeylowerBound
VerseKeyupperBound

Static Private Attributes

static SWClass classdef
static long * offsets [2][2]
static int offsize [2][2]
static int instance
 number of instantiated VerseKey objects or derivitives
static struct sbook otbooks []
static struct sbook ntbooks []
static char * osisotbooks []
static char * osisntbooks []
static char ** osisbooks []
static long otbks []
static long otcps []
static long ntbks []
static long ntcps []
static int vm []
static LocaleCache localeCache

Classes

class  LocaleCache

Detailed Description

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

Definition at line 74 of file versekey.h.


Constructor & Destructor Documentation

sword::VerseKey::VerseKey ( const char *  ikey = 0  ) 

VerseKey Constructor - initializes Instance of VerseKey.

Parameters:
ikey text key (will take various forms of 'BOOK CH:VS'. See parse() for more detailed information)

sword::VerseKey::VerseKey ( const SWKey ikey  ) 

VerseKey Constructor - initializes instance of VerseKey.

Parameters:
ikey base key (will take various forms of 'BOOK CH:VS'. See parse() for more detailed information)

sword::VerseKey::VerseKey ( const char *  min,
const char *  max 
)

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

Parameters:
min the lower boundary of the new VerseKey
max the upper boundary of the new VerseKey

sword::VerseKey::VerseKey ( const SWKey k  ) 

VerseKey Copy Constructor - will create a new VerseKey based on an existing SWKey.

Parameters:
k the VerseKey to copy from

sword::VerseKey::VerseKey ( const VerseKey k  ) 

VerseKey Copy Constructor - will create a new VerseKey based on an existing one.

Parameters:
k the VerseKey to copy from


Member Function Documentation

int sword::VerseKey::findindex ( long *  array,
int  size,
long  value 
) [private]

Binary search to find the index closest, but less than the given value.

Parameters:
array long * to array to search
size number of elements in the array
value value to find
Returns:
the index into the array that is less than but closest to value

VerseKey& sword::VerseKey::LowerBound ( const char *  lb  ) 

sets the lower boundary for this VerseKey and returns the new boundary

Parameters:
lb the new lower boundary for this VerseKey
Returns:
the lower boundary the key was set to

VerseKey& sword::VerseKey::UpperBound ( const char *  ub  ) 

sets the upper boundary for this VerseKey and returns the new boundary

Parameters:
ub the new upper boundary for this VerseKey
Returns:
the upper boundary the key was set to

VerseKey& sword::VerseKey::LowerBound (  )  const

gets the lower boundary of this VerseKey

Returns:
the lower boundary of this VerseKey

VerseKey& sword::VerseKey::UpperBound (  )  const

gets the upper boundary of this VerseKey

Returns:
the upper boundary of this VerseKey

virtual void sword::VerseKey::setText ( const char *  ikey  )  [inline, virtual]

Sets this SWKey with a character string.

Parameters:
ikey string used to set this key

Reimplemented from sword::SWKey.

Definition at line 263 of file versekey.h.

virtual void sword::VerseKey::copyFrom ( const SWKey ikey  )  [virtual]

Copies as much info (position, range, etc.

) as possible from another SWKey object

Parameters:
ikey other SWKey object from which to copy

Reimplemented from sword::SWKey.

Referenced by sword::VerseTreeKey::operator=().

virtual void sword::VerseKey::setPosition ( SW_POSITION  newpos  )  [virtual]

Positions this key.

Parameters:
newpos Position to set to.
Returns:
*this

Reimplemented from sword::SWKey.

virtual void sword::VerseKey::decrement ( int  steps  )  [virtual]

Decrements key a number of verses.

Parameters:
steps Number of verses to jump backward
Returns:
*this

Reimplemented from sword::SWKey.

virtual void sword::VerseKey::increment ( int  steps  )  [virtual]

Increments key a number of verses.

Parameters:
steps Number of verses to jump forward
Returns:
*this

Reimplemented from sword::SWKey.

virtual char sword::VerseKey::Testament (  )  const [virtual]

Gets testament.

Returns:
value of testament

virtual char sword::VerseKey::Book (  )  const [virtual]

Gets book.

Returns:
value of book

virtual int sword::VerseKey::Chapter (  )  const [virtual]

Gets chapter.

Returns:
value of chapter

virtual int sword::VerseKey::Verse (  )  const [virtual]

Gets verse.

Returns:
value of verse

virtual char sword::VerseKey::Testament ( char  itestament  )  [virtual]

Sets/gets testament.

Parameters:
itestament value which to set testament [MAXPOS(char)] - only get
Returns:
if unchanged -> value of testament, if changed -> previous value of testament

virtual char sword::VerseKey::Book ( char  ibook  )  [virtual]

Sets/gets book.

Parameters:
ibook value which to set book [MAXPOS(char)] - only get
Returns:
if unchanged -> value of book, if changed -> previous value of book

virtual int sword::VerseKey::Chapter ( int  ichapter  )  [virtual]

Sets/gets chapter.

Parameters:
ichapter value which to set chapter [MAXPOS(int)] - only get
Returns:
if unchanged -> value of chapter, if changed -> previous value of chapter

virtual int sword::VerseKey::Verse ( int  iverse  )  [virtual]

Sets/gets verse.

Parameters:
iverse value which to set verse [MAXPOS(int)] - only get
Returns:
if unchanged -> value of verse, if changed -> previous value of verse

virtual void sword::VerseKey::Normalize ( char  autocheck = 0  )  [virtual]

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

Returns:
*this

virtual char sword::VerseKey::AutoNormalize ( char  iautonorm = ((char)((unsignedchar)(1L<< (sizeof(char)*8-1))-1))  )  [virtual]

Sets/gets flag that tells VerseKey to automatically normalize itself when modified.

Parameters:
iautonorm value which to set autonorm [MAXPOS(char)] - only get
Returns:
if unchanged -> value of autonorm, if changed -> previous value of autonorm

virtual char sword::VerseKey::Headings ( char  iheadings = ((char)((unsignedchar)(1L<< (sizeof(char)*8-1))-1))  )  [virtual]

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

Parameters:
iheadings value which to set headings [MAXPOS(char)] - only get
Returns:
if unchanged -> value of headings, if changed -> previous value of headings

virtual long sword::VerseKey::Index (  )  const [virtual]

Gets index based upon current verse.

Returns:
offset

Reimplemented from sword::SWKey.

virtual long sword::VerseKey::Index ( long  iindex  )  [virtual]

Sets index based upon current verse.

Parameters:
iindex value to set index to
Returns:
offset

Reimplemented from sword::SWKey.

static const char* sword::VerseKey::convertToOSIS ( const char *  inRef,
const SWKey defaultKey 
) [static]

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

Parameters:
inRef reference string to try to parse
defaultKey@see ParseVerseList(..., defaultKey, ...)

virtual int sword::VerseKey::compare ( const SWKey ikey  )  [virtual]

Compares another SWKey object.

Parameters:
ikey key 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 sword::SWKey.

virtual int sword::VerseKey::_compare ( const VerseKey ikey  )  [virtual]

Compares another VerseKey object.

Parameters:
ikey key 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


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