Reference

versekey(3)

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

NAME

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

SYNOPSIS

#include <versekey.h>

Inherits SWKey.

Public Methods

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 (VerseKey const &k)
VerseKey Copy Constructor - will create a new VerseKey based on an existing one. virtual ~VerseKey ()
VerseKey Destructor Cleans up an instance of VerseKey. VerseKey& LowerBound (const char *lb)
sets the lower boundary for this VerseKey and returns the new boundary. VerseKey& UpperBound (const char *ub)
sets the upper boundary for this VerseKey and returns the new boundary. VerseKey& LowerBound () const
gets the lower boundary of this VerseKey. VerseKey& UpperBound () const
gets the upper boundary of this VerseKey. void ClearBounds ()
clears the boundaries of this VerseKey. virtual SWKey* clone () 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 void setText (const char *ikey)
Equates this SWKey to a character string. virtual void copyFrom (const SWKey &ikey)
Equates this SWKey to another SWKey object. virtual void copyFrom (const VerseKey &ikey)
Equates this VerseKey to another VerseKey. virtual void setPosition (SW_POSITION)
Positions this key. virtual void decrement (int step)
Decrements key a number of verses. virtual void increment (int step)
Increments key a number of verses. virtual char Traversable ()
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=MAXPOS(char))
Sets/gets flag that tells VerseKey to automatically normalize itself when modified. virtual char Headings (char iheadings=MAXPOS(char))
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 ListKey ParseVerseList (const char *buf, const char *defaultKey=Genesis1:1",boolexpandRange=false)"
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 SWKEY_OPERATORS SWKey& operator= (const VerseKey &ikey)

Public Attributes

const char* BMAX
struct sbook** books

Static Public Attributes

const char builtin_BMAX [2]
struct sbook* builtin_books [2]
const struct abbrev builtin_abbrevs []

Private Methods

int getBookAbbrev (char *abbr)
void initBounds () const
void initstatics ()
initialize and allocate books array. void init ()
initializes this VerseKey(). 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. 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
const struct abbrev* abbrevs
int abbrevsCnt
char testament
The Testament: 0 - Old; 1 - New. char book
int chapter
int verse
char autonorm
flag for auto normalization. char headings
flag for headings on/off. VerseKey* lowerBound
VerseKey * upperBound

Static Private Attributes

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

DETAILED DESCRIPTION

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

Definition at line 66 of file versekey.h.

CONSTRUCTOR & DESTRUCTOR DOCUMENTATION

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)

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)

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

VerseKey::VerseKey (VerseKey const & k)

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

Parameters:

k

the VerseKey to copy from

MEMBER FUNCTION DOCUMENTATION

char VerseKey::AutoNormalize (char iautonorm = MAXPOS (char)) [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

char 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

char VerseKey::Book () const [virtual]

Gets book.

Returns: value of book

int 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

int VerseKey::Chapter () const [virtual]

Gets chapter.

Returns: value of chapter

char VerseKey::Headings (char iheadings = MAXPOS (char)) [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

long VerseKey::Index (long index) [virtual]

Sets index based upon current verse.

Parameters:

iindex

value to set index to

Returns: offset

Reimplemented from SWKey.

long VerseKey::Index () const [virtual]

Gets index based upon current verse.

Returns: offset

Reimplemented from SWKey.

VerseKey & VerseKey::LowerBound () const

gets the lower boundary of this VerseKey.

Returns: the lower boundary of this VerseKey

VerseKey & 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

void 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

char 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

char VerseKey::Testament () const [virtual]

Gets testament.

Returns: value of testament

VerseKey & VerseKey::UpperBound () const

gets the upper boundary of this VerseKey.

Returns: the upper boundary of this VerseKey

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

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

Parameters:

lb

the new upper boundary for this VerseKey

Returns: the upper boundary the key was set to

int 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

int VerseKey::Verse () const [virtual]

Gets verse.

Returns: value of verse

int 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

int 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 SWKey.

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

Equates this SWKey to another SWKey object.

Parameters:

ikey

other swkey object

Reimplemented from SWKey.

void VerseKey::decrement (int step) [virtual]

Decrements key a number of verses.

Parameters:

decrement

Number of verses to jump backward

Returns: *this

Reimplemented from SWKey.

int 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

void VerseKey::increment (int step) [virtual]

Increments key a number of verses.

Parameters:

increment

Number of verses to jump forward

Returns: *this

Reimplemented from SWKey.

void VerseKey::setPosition (SW_POSITION) [virtual]

Positions this key.

Parameters:

p

position

Returns: *this

Reimplemented from SWKey.

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

Equates this SWKey to a character string.

Parameters:

ikey

string to set this key to

Reimplemented from SWKey.

Definition at line 228 of file versekey.h.

AUTHOR

Generated automatically by Doxygen for The Sword Project from the source code.