The Sword Project: sword::TreeKey Class Reference |
#include <treekey.h>
Inheritance diagram for sword::TreeKey:
Public Member Functions | |
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 void | root ()=0 |
Go to the root node. | |
virtual bool | parent ()=0 |
Go to the parent of the current node. | |
virtual bool | firstChild ()=0 |
Go to the first child of the current node. | |
virtual bool | nextSibling ()=0 |
Go to the next sibling of the current node. | |
virtual bool | previousSibling ()=0 |
Go to the previous sibling of the current node. | |
virtual bool | hasChildren ()=0 |
Does the current node have children? | |
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 |
Sets this SWKey with a character string. | |
virtual void | setPosition (SW_POSITION p)=0 |
virtual const char * | getText () const=0 |
returns string representation of this key | |
virtual int | compare (const SWKey &ikey)=0 |
Compares this key object to another SWKey object. | |
virtual void | decrement (int steps=1)=0 |
Decrements key a number of entry positions This is only valid if isTraversable is true. | |
virtual void | increment (int steps=1)=0 |
Increments key a number of entry positions This is only valid if isTraversable is true. | |
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 long | Index (long iindex) |
See documentation for Index(). | |
virtual void | assureKeyPath (const char *keyPath=0) |
Set the key to this path. | |
virtual void | save () |
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) |
Protected Attributes | |
SWBuf | unsnappedKeyText |
Private Member Functions | |
void | init () |
Static Private Attributes | |
static SWClass | classdef |
Definition at line 37 of file treekey.h.
virtual bool sword::TreeKey::parent | ( | ) | [pure virtual] |
virtual bool sword::TreeKey::firstChild | ( | ) | [pure virtual] |
Go to the first child of the current node.
Implemented in sword::TreeKeyIdx.
virtual bool sword::TreeKey::nextSibling | ( | ) | [pure virtual] |
Go to the next sibling of the current node.
Implemented in sword::TreeKeyIdx.
virtual bool sword::TreeKey::previousSibling | ( | ) | [pure virtual] |
Go to the previous sibling of the current node.
Implemented in sword::TreeKeyIdx.
virtual bool sword::TreeKey::hasChildren | ( | ) | [pure virtual] |
Does the current node have children?
Implemented in sword::TreeKeyIdx.
virtual void sword::TreeKey::setText | ( | const char * | ikey | ) | [pure virtual] |
Sets this SWKey with a character string.
ikey | string used to set this key |
Reimplemented from sword::SWKey.
Implemented in sword::TreeKeyIdx.
virtual int sword::TreeKey::compare | ( | const SWKey & | ikey | ) | [pure virtual] |
Compares this key object to another SWKey object.
ikey | key to compare with this one |
Reimplemented from sword::SWKey.
Implemented in sword::TreeKeyIdx.
virtual void sword::TreeKey::decrement | ( | int | steps = 1 |
) | [pure virtual] |
Decrements key a number of entry positions This is only valid if isTraversable is true.
steps | Number of entries to jump backward |
Reimplemented from sword::SWKey.
Implemented in sword::TreeKeyIdx.
virtual void sword::TreeKey::increment | ( | int | steps = 1 |
) | [pure virtual] |
Increments key a number of entry positions This is only valid if isTraversable is true.
steps | Number of entries to jump forward |
Reimplemented from sword::SWKey.
Implemented in sword::TreeKeyIdx.
virtual long sword::TreeKey::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 void sword::TreeKey::assureKeyPath | ( | const char * | keyPath = 0 |
) | [virtual] |
Set the key to this path.
If the path doesn't exist, then nodes are created as necessary = path to set/create; if unsupplied, then use any unsnapped setText value.
The SWORD Project; P. O. Box 2528; Tempe, AZ 85280-2528 USA |