TreeKey Class Reference
#include <treekey.h>
List of all members.
Detailed Description
Class TreeKey The base class for all tree-based key implementations in Sword.
Definition at line 37 of file treekey.h.
Constructor & Destructor Documentation
| TreeKey::TreeKey |
( |
|
) |
[inline] |
| TreeKey::~TreeKey |
( |
|
) |
[inline] |
Member Function Documentation
| virtual void TreeKey::append |
( |
|
) |
[pure virtual] |
| virtual void TreeKey::appendChild |
( |
|
) |
[pure virtual] |
| void 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
- Parameters:
-
| keyPath | path to set/create; if unsupplied, then use any unsnapped setText value. |
Definition at line 39 of file treekey.cpp.
00039 {
00040
00041 if (!keyBuffer) {
00042 keyBuffer = unsnappedKeyText;
00043
00044 if (!*keyBuffer)
00045 return;
00046 }
00047
00048 char *keybuf = 0;
00049 stdstr(&keybuf, keyBuffer);
00050
00051 root();
00052
00053
00054 SWBuf tok = strtok(keybuf, "/");
00055 tok.trim();
00056 while (tok.size()) {
00057 bool foundkey = false;
00058 if (hasChildren()) {
00059 firstChild();
00060 if (tok == getLocalName()) {
00061 foundkey = true;
00062 }
00063 else {
00064 while (nextSibling()) {
00065 if (getLocalName()) {
00066 if (tok == getLocalName()) {
00067 foundkey = true;
00068 break;
00069 }
00070 }
00071 }
00072 }
00073 if (!foundkey) {
00074 append();
00075 setLocalName(tok);
00076 save();
00077 }
00078 }
00079 else {
00080 appendChild();
00081 setLocalName(tok);
00082 save();
00083 }
00084
00085 #ifdef DEBUG
00086
00087 #endif
00088
00089 tok = strtok(0, "/");
00090 tok.trim();
00091
00092 }
00093 delete [] keybuf;
00094 }
| virtual void SWKey::clearBound |
( |
|
) |
const [inline, virtual, inherited] |
| SWKey * SWKey::clone |
( |
|
) |
const [virtual, inherited] |
| int SWKey::compare |
( |
const SWKey & |
ikey |
) |
[virtual, inherited] |
Compares this key object to another SWKey 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
Definition at line 217 of file swkey.cpp.
00218 {
00219 return strcmp((const char *)*this, (const char *)ikey);
00220 }
| virtual int TreeKey::compare |
( |
const SWKey & |
ikey |
) |
[pure virtual] |
| void SWKey::copyFrom |
( |
const SWKey & |
ikey |
) |
[virtual, inherited] |
| virtual void TreeKey::decrement |
( |
int |
steps = 1 |
) |
[pure virtual] |
Decrements key a number of entry positions This is only valid if isTraversable is true
- Parameters:
-
| steps | Number of entries to jump backward |
Reimplemented from SWKey.
Implemented in TreeKeyIdx.
| virtual bool SWKey::equals |
( |
const SWKey & |
ikey |
) |
[inline, virtual, inherited] |
test equality of this SWKey object's position with another SWKey
- Parameters:
-
| ikey | key to compare with this one |
- Returns:
- true if the key positions are equal
Definition at line 195 of file swkey.h.
| SWDEPRECATED char SWKey::Error |
( |
|
) |
[inline, inherited] |
Gets and clears error status
- Returns:
- error status
Definition at line 159 of file swkey.h.
| virtual bool TreeKey::firstChild |
( |
|
) |
[pure virtual] |
Go to the first child of the current node
- Returns:
- success or failure
Implemented in TreeKeyIdx.
| const SWClass* SWObject::getClass |
( |
|
) |
const [inline, inherited] |
Use this to get the class definition and inheritance order.
- Returns:
- The class definition of this object
Definition at line 59 of file swobject.h.
00059 {
00060 return myclass;
00061 }
| virtual long TreeKey::getIndex |
( |
|
) |
const [inline, virtual] |
Use this function to get an index position within a module.
Reimplemented from SWKey.
Definition at line 126 of file treekey.h.
| virtual int TreeKey::getLevel |
( |
|
) |
[inline, virtual] |
| char* SWKey::getLocale |
( |
|
) |
const [inline, inherited] |
| virtual const char* TreeKey::getLocalName |
( |
|
) |
[pure virtual] |
| virtual unsigned long TreeKey::getOffset |
( |
|
) |
const [pure virtual] |
| const char * SWKey::getOSISRefRangeText |
( |
|
) |
const [virtual, inherited] |
| SWLocale * SWKey::getPrivateLocale |
( |
|
) |
const [protected, inherited] |
| const char * SWKey::getRangeText |
( |
|
) |
const [virtual, inherited] |
| virtual const char* SWKey::getShortText |
( |
|
) |
const [inline, virtual, inherited] |
| virtual const char* TreeKey::getText |
( |
|
) |
const [pure virtual] |
returns string representation of this key
Reimplemented from SWKey.
Implemented in TreeKeyIdx.
| virtual const char* TreeKey::getUserData |
( |
int * |
size = 0 |
) |
const [pure virtual] |
| virtual bool TreeKey::hasChildren |
( |
|
) |
[pure virtual] |
Does the current node have children?
- Returns:
- whether or not it does
Implemented in TreeKeyIdx.
| virtual void TreeKey::increment |
( |
int |
steps = 1 |
) |
[pure virtual] |
Increments key a number of entry positions This is only valid if isTraversable is true
- Parameters:
-
| steps | Number of entries to jump forward |
Reimplemented from SWKey.
Implemented in TreeKeyIdx.
| void TreeKey::init |
( |
|
) |
[private] |
| virtual void TreeKey::insertBefore |
( |
|
) |
[pure virtual] |
| virtual bool SWKey::isBoundSet |
( |
|
) |
const [inline, virtual, inherited] |
| bool SWKey::isPersist |
( |
|
) |
const [inherited] |
Gets whether this key should persist in any module to which it is set otherwise just a copy will be used in the module.
- Returns:
- 1 - persists in module; 0 - a copy is attempted
Definition at line 98 of file swkey.cpp.
00099 {
00100 return persist;
00101 }
| virtual bool TreeKey::isTraversable |
( |
|
) |
const [inline, virtual] |
Whether or not this key can be ++ -- incremented
Reimplemented from SWKey.
Reimplemented in TreeKeyIdx.
Definition at line 125 of file treekey.h.
| virtual bool TreeKey::nextSibling |
( |
|
) |
[pure virtual] |
Go to the next sibling of the current node
- Returns:
- success or failure
Implemented in TreeKeyIdx.
| virtual bool TreeKey::parent |
( |
|
) |
[pure virtual] |
Go to the parent of the current node
- Returns:
- success or failure
Implemented in TreeKeyIdx.
| SWDEPRECATED char SWKey::Persist |
( |
signed char |
ipersist |
) |
[inline, inherited] |
Sets whether this key should persist in any module to which it is set otherwise just a copy will be used in the module.
- Parameters:
-
| ipersist | value which to set persist; |
- Returns:
- 1 - persists in module; 0 - a copy is attempted
Definition at line 153 of file swkey.h.
| SWDEPRECATED char SWKey::Persist |
( |
|
) |
const [inline, inherited] |
| char SWKey::popError |
( |
|
) |
[virtual, inherited] |
Definition at line 146 of file swkey.cpp.
00147 {
00148 char retval = error;
00149
00150 error = 0;
00151 return retval;
00152 }
| void TreeKey::positionChanged |
( |
|
) |
[inline, protected] |
| virtual void SWKey::positionFrom |
( |
const SWKey & |
ikey |
) |
[inline, virtual, inherited] |
| virtual bool TreeKey::previousSibling |
( |
|
) |
[pure virtual] |
Go to the previous sibling of the current node
- Returns:
- success or failure
Implemented in TreeKeyIdx.
| virtual void TreeKey::remove |
( |
|
) |
[pure virtual] |
| virtual void TreeKey::root |
( |
|
) |
[pure virtual] |
| virtual void TreeKey::save |
( |
|
) |
[inline, virtual] |
| virtual void SWKey::setError |
( |
char |
err |
) |
[inline, virtual, inherited] |
| virtual void TreeKey::setIndex |
( |
long |
iindex |
) |
[inline, virtual] |
See documentation for Index()
Reimplemented from SWKey.
Definition at line 127 of file treekey.h.
| void SWKey::setLocale |
( |
const char * |
name |
) |
[inline, inherited] |
| virtual const char* TreeKey::setLocalName |
( |
const char * |
|
) |
[pure virtual] |
| virtual void TreeKey::setOffset |
( |
unsigned long |
offset |
) |
[pure virtual] |
| void SWKey::setPersist |
( |
bool |
ipersist |
) |
[inherited] |
| virtual void TreeKey::setPosition |
( |
SW_POSITION |
p |
) |
[pure virtual] |
| virtual void TreeKey::setText |
( |
const char * |
ikey |
) |
[pure virtual] |
Sets this SWKey with a character string
- Parameters:
-
| ikey | string used to set this key |
Reimplemented from SWKey.
Implemented in TreeKeyIdx.
| virtual void TreeKey::setUserData |
( |
const char * |
userData, |
|
|
int |
size = 0 | |
|
) |
| | [pure virtual] |
Member Data Documentation
The documentation for this class was generated from the following files: