Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  

TreeKey Class Reference

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

#include <treekey.h>

Inheritance diagram for TreeKey:

Inheritance graph
[legend]
Collaboration diagram for TreeKey:

Collaboration graph
[legend]
List of all members.

Public Methods

 TreeKey ()
 ~TreeKey ()
virtual const char * getLocalName ()=0
virtual const char * setLocalName (const char *)=0
virtual const char * getUserData (int *size=0)=0
virtual void setUserData (const char *userData, int size=0)=0
virtual const char * getFullName () const=0
virtual void root ()=0
virtual bool parent ()=0
virtual bool firstChild ()=0
virtual bool nextSibling ()=0
virtual bool previousSibling ()=0
virtual bool hasChildren ()=0
virtual void append ()=0
virtual void appendChild ()=0
virtual void insertBefore ()=0
virtual void remove ()=0
virtual void setOffset (unsigned long offset)=0
virtual unsigned long getOffset () const=0
virtual void setText (const char *ikey)=0
 Equates this SWKey to a character string. More...

virtual void setPosition (SW_POSITION p)=0
virtual const char * getText () const=0
 returns text key if (char *) cast is requested.

virtual int compare (const SWKey &ikey)=0
 Compares another VerseKey object. More...

virtual void decrement (int steps=1)=0
 Decrements key a number of entries. More...

virtual void increment (int steps=1)=0
 Increments key a number of entries. More...

virtual char Traversable ()
virtual long Index () const
 Use this function to get te current position withing a module. More...

virtual long Index (long iindex)

Private Methods

void init ()

Static Private Attributes

SWClass classdef

Detailed Description

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

Definition at line 36 of file treekey.h.


Member Function Documentation

virtual int TreeKey::compare const SWKey   ikey [pure virtual]
 

Compares another VerseKey object.

Parameters:
ikey  key to compare with this one
Returns:
>0 if this key is greater than compare key; <0 if this key is smaller than compare key; 0 if the keys are the same

Reimplemented from SWKey.

Implemented in TreeKeyIdx.

virtual void TreeKey::decrement int    steps = 1 [pure virtual]
 

Decrements key a number of entries.

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

Reimplemented from SWKey.

Implemented in TreeKeyIdx.

virtual void TreeKey::increment int    steps = 1 [pure virtual]
 

Increments key a number of entries.

Parameters:
increment  Number of entries to jump forward
Returns:
*this

Reimplemented from SWKey.

Implemented in TreeKeyIdx.

virtual long TreeKey::Index   const [inline, virtual]
 

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.

Definition at line 81 of file treekey.h.

00081 { return getOffset(); }

virtual void TreeKey::setText const char *    ikey [pure virtual]
 

Equates this SWKey to a character string.

Parameters:
ikey  string to set this key to

Reimplemented from SWKey.

Implemented in TreeKeyIdx.


The documentation for this class was generated from the following files:
Generated on Thu Jun 20 22:13:04 2002 for The Sword Project by doxygen1.2.15