#include <listkey.h>
Inheritance diagram for ListKey:
Public Methods | |
ListKey (const char *ikey = 0) | |
initializes instance of ListKey. More... | |
ListKey (ListKey const &k) | |
virtual | ~ListKey () |
cleans up instance of ListKey. | |
virtual SWKey* | clone () const |
Returns a copy of this SWKey object. More... | |
virtual void | ClearList () |
Clears out elements of list. | |
virtual int | Count () |
Returns number of elements in list. More... | |
virtual void | Remove () |
Removes current element from list. | |
virtual char | SetToElement (int ielement, SW_POSITION = TOP) |
Sets key to element number. More... | |
virtual SWKey* | GetElement (int pos = -1) |
Gets a key element number. More... | |
virtual ListKey& | operator<< (const SWKey &ikey) |
Adds an element to the list. More... | |
virtual ListKey& | operator= (const ListKey & ikey) |
Equates this ListKey to another ListKey object. More... | |
virtual SWKey& | operator= (const char *ikey) |
Equates this SWKey to a character string. More... | |
virtual SWKey& | operator= (const SWKey & ikey) |
Equates this SWKey to another SWKey object. More... | |
virtual SWKey& | operator= (SW_POSITION) |
Positions this key. More... | |
virtual SWKey& | operator-= (int decrement) |
Decrements a number of elements. | |
virtual SWKey& | operator+= (int increment) |
Increments a number of elements. | |
virtual char | Traversable () |
virtual long | Index () const |
Use this function to get te current position withing a module. More... | |
virtual long | Index (long index) |
Returns the index for the new one given as as parameter. More... | |
Protected Attributes | |
int | arraypos |
int | arraymax |
int | arraycnt |
SWKey** | array |
Private Methods | |
void | init () |
Static Private Attributes | |
SWClass | classdef |
a list of verses, place, etc.)
Definition at line 36 of file listkey.h.
|
initializes instance of ListKey.
ikey | text key |
|
Returns number of elements in list.
|
Gets a key element number.
pos | element number to get (or default current) |
|
Returns the index for the new one given as as parameter.
The first parameter is the new index.
Reimplemented from SWKey.
|
Use this function to get te current position withing 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::systemLocaleMgr.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 SWKey.
|
Sets key to element number.
ielement | element number to set to |
Referenced by Index().
|
Returns a copy of this SWKey object.
This is useful to get a 1:1 copy of an SWKey based object.
Reimplemented from SWKey.
|
Adds an element to the list.
ikey | the element to add |
|
|
Equates this SWKey to another SWKey object.
ikey | other swkey object |
Reimplemented from SWKey.
|
Equates this SWKey to a character string.
ikey | string to set this key to |
Reimplemented from SWKey.
|
Equates this ListKey to another ListKey object.
ikey | other ListKey object |