The Sword Project: sword::ListKey Class Reference |
#include <listkey.h>
Inheritance diagram for sword::ListKey:
Public Member Functions | |
ListKey (const char *ikey=0) | |
initializes instance of ListKey | |
ListKey (ListKey const &k) | |
virtual | ~ListKey () |
cleans up instance of ListKey | |
virtual SWKey * | clone () const |
Returns a new exact clone of this SWKey object. | |
virtual void | clear () |
Clears out elements of list. | |
virtual void | ClearList () |
deprecated, use clear(), instead | |
virtual int | Count () |
Returns number of elements in list. | |
virtual void | Remove () |
Removes current element from list. | |
virtual char | SetToElement (int ielement, SW_POSITION=SW_POSITION(((char) 1))) |
Sets key to element number. | |
virtual SWKey * | getElement (int pos=-1) |
Gets a key element number. | |
virtual SWKey * | GetElement (int pos=-1) |
ListKey & | operator<< (const SWKey &ikey) |
Adds an element to the list. | |
virtual void | add (const SWKey &ikey) |
virtual void | copyFrom (const ListKey &ikey) |
Equates this ListKey to another ListKey object. | |
virtual void | copyFrom (const SWKey &ikey) |
Copies as much info (position, range, etc. | |
virtual void | setPosition (SW_POSITION pos) |
Positions this key. | |
virtual void | decrement (int step) |
Decrements a number of elements. | |
virtual void | increment (int step) |
Increments a number of elements. | |
virtual bool | isTraversable () const |
Whether or not this key can be ++ -- incremented. | |
virtual long | Index () const |
Use this function to get an index position within a module. | |
virtual const char * | getRangeText () const |
virtual long | Index (long index) |
Returns the index for the new one given as as parameter. | |
virtual const char * | getText () const |
returns string representation of this key | |
virtual void | setText (const char *ikey) |
Sets this SWKey with a character string. | |
virtual void | sort () |
SWKey & | operator= (const char *ikey) |
SWKey & | operator= (const SWKey &ikey) |
SWKey & | operator= (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) |
SWKey & | operator-= (int steps) |
SWKey & | operator+= (int steps) |
SWKey & | operator++ (int) |
SWKey & | operator-- (int) |
ListKey & | operator= (const ListKey &key) |
Protected Attributes | |
int | arraypos |
int | arraymax |
int | arraycnt |
SWKey ** | array |
Private Member Functions | |
void | init () |
Static Private Attributes | |
static SWClass | classdef |
a list of verses, place, etc.)
Definition at line 38 of file listkey.h.
sword::ListKey::ListKey | ( | const char * | ikey = 0 |
) |
virtual SWKey* sword::ListKey::clone | ( | ) | const [virtual] |
Returns a new exact clone of this SWKey object.
This allocates a new SWKey which must be deleted by the caller
Reimplemented from sword::SWKey.
virtual int sword::ListKey::Count | ( | ) | [virtual] |
Returns number of elements in list.
virtual char sword::ListKey::SetToElement | ( | int | ielement, | |
SW_POSITION | = SW_POSITION(((char) 1)) | |||
) | [virtual] |
Sets key to element number.
ielement | element number to set to |
virtual SWKey* sword::ListKey::getElement | ( | int | pos = -1 |
) | [virtual] |
Gets a key element number.
pos | element number to get (or default current) |
virtual void sword::ListKey::copyFrom | ( | const ListKey & | ikey | ) | [virtual] |
virtual void sword::ListKey::copyFrom | ( | const SWKey & | ikey | ) | [inline, virtual] |
Copies as much info (position, range, etc.
) as possible from another SWKey object
ikey | other SWKey object from which to copy |
Reimplemented from sword::SWKey.
virtual void sword::ListKey::setPosition | ( | SW_POSITION | pos | ) | [virtual] |
virtual long sword::ListKey::Index | ( | ) | const [inline, virtual] |
Use this function to get an index position within a module.
Here's a small example how to use this function and Index(long). This function uses the GerLut module and chooses a random verse from the Bible and returns it.
const char* randomVerse() { VerseKey vk; SWMgr mgr; LocaleMgr::getSystemLocaleMgr()->setDefaultLocaleName("de"); SWModule* module = mgr->Modules("GerLut"); srand( time(0) ); const double newIndex = (double(rand())/RAND_MAX)*(24108+8224); vk.Index(newIndex); module->setKey(vk); char* text; sprintf(text, "%s: %s",(const char*)vk ,module->StripText(&vk)); return text;
Reimplemented from sword::SWKey.
virtual long sword::ListKey::Index | ( | long | index | ) | [inline, virtual] |
Returns the index for the new one given as as parameter.
The first parameter is the new index.
Reimplemented from sword::SWKey.
Definition at line 134 of file listkey.h.
References sword::SWKey::Index().
virtual void sword::ListKey::setText | ( | const char * | ikey | ) | [virtual] |
Sets this SWKey with a character string.
ikey | string used to set this key |
Reimplemented from sword::SWKey.
The SWORD Project; P. O. Box 2528; Tempe, AZ 85280-2528 USA |