#include <treekeyidx.h>
Inheritance diagram for TreeKeyIdx:
Public Methods | |
TreeKeyIdx (const TreeKeyIdx &ikey) | |
TreeKeyIdx (const char *idxPath, int fileMode=-1) | |
~TreeKeyIdx () | |
virtual const char * | getLocalName () |
virtual const char * | setLocalName (const char *) |
virtual const char * | getUserData (int *size=0) |
virtual void | setUserData (const char *userData, int size=0) |
virtual const char * | getFullName () const |
virtual void | root () |
virtual bool | parent () |
virtual bool | firstChild () |
virtual bool | nextSibling () |
virtual bool | previousSibling () |
virtual bool | hasChildren () |
virtual void | append () |
virtual void | appendChild () |
virtual void | insertBefore () |
virtual void | remove () |
virtual void | save () |
virtual void | copyFrom (const TreeKeyIdx &ikey) |
virtual void | copyFrom (const SWKey &ikey) |
Equates this SWKey to another SWKey object. More... | |
virtual SWKey & | operator= (const TreeKeyIdx &ikey) |
void | setOffset (unsigned long offset) |
unsigned long | getOffset () const |
virtual SWKEY_OPERATORS void | setText (const char *ikey) |
Equates this SWKey to a character string. More... | |
virtual void | setPosition (SW_POSITION p) |
virtual const char * | getText () const |
returns text key if (char *) cast is requested. | |
virtual int | _compare (const TreeKeyIdx &ikey) |
virtual int | compare (const SWKey &ikey) |
Compares another VerseKey object. More... | |
virtual void | decrement (int steps=1) |
Decrements key a number of entries. More... | |
virtual void | increment (int steps=1) |
Increments key a number of entries. More... | |
virtual char | Traversable () |
Static Public Methods | |
signed char | create (const char *path) |
Private Methods | |
void | getTreeNodeFromDatOffset (long ioffset, TreeNode *buf) const |
char | getTreeNodeFromIdxOffset (long ioffset, TreeNode *node) const |
void | saveTreeNode (TreeNode *node) |
void | saveTreeNodeOffsets (TreeNode *node) |
Private Attributes | |
TreeKeyIdx::TreeNode | currentNode |
char * | path |
FileDesc * | idxfd |
FileDesc * | datfd |
Static Private Attributes | |
SWClass | classdef |
Definition at line 35 of file treekeyidx.h.
|
Compares another VerseKey object.
Implements TreeKey. Definition at line 511 of file treekeyidx.cpp. References SWKey::compare.
00511 { 00512 TreeKeyIdx *treeKey = SWDYNAMIC_CAST(TreeKeyIdx, (&ikey)); 00513 if (treeKey) 00514 return _compare(*treeKey); 00515 return SWKey::compare(ikey); 00516 } |
|
Equates this SWKey to another SWKey object.
Reimplemented from SWKey. Definition at line 485 of file treekeyidx.cpp. References SWKey::copyFrom.
00485 { 00486 SWKey::copyFrom(ikey); 00487 } |
|
Decrements key a number of entries.
Implements TreeKey. Definition at line 519 of file treekeyidx.cpp.
00519 { 00520 error = getTreeNodeFromIdxOffset(currentNode.offset - (4*steps), ¤tNode); 00521 } |
|
Increments key a number of entries.
Implements TreeKey. Definition at line 523 of file treekeyidx.cpp.
00523 { 00524 error = getTreeNodeFromIdxOffset(currentNode.offset + (4*steps), ¤tNode); 00525 00526 /* 00527 // assert positive 00528 if (steps < 0) { 00529 decrement(steps * -1); 00530 return; 00531 } 00532 00533 while (steps > 0) { 00534 if (!firstChild()) { 00535 if (!nextSibbling() { 00536 error = KEYERR_OUTOFBOUNDS; 00537 return; 00538 } 00539 } 00540 steps--; 00541 } 00542 */ 00543 } |
|
Equates this SWKey to a character string.
Implements TreeKey. Definition at line 457 of file treekeyidx.cpp. References SWKey::Error.
00457 { 00458 char *buf = 0; 00459 stdstr(&buf, ikey); 00460 char *leaf = strtok(buf, "/"); 00461 root(); 00462 while ((leaf) && (!Error())) { 00463 bool ok, inChild = false; 00464 for (ok = firstChild(); ok; ok = nextSibling()) { 00465 inChild = true; 00466 if (!stricmp(leaf, getLocalName())) 00467 break; 00468 } 00469 leaf = strtok(0, "/"); 00470 if (!ok) { 00471 if (inChild) { // if we didn't find a matching child node, default to first child 00472 parent(); 00473 firstChild(); 00474 } 00475 if (leaf) 00476 error = KEYERR_OUTOFBOUNDS; 00477 break; 00478 } 00479 } 00480 delete [] buf; 00481 } |