#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) |
void | init () |
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 520 of file treekeyidx.cpp. References SWKey::compare().
00520 { 00521 TreeKeyIdx *treeKey = SWDYNAMIC_CAST(TreeKeyIdx, (&ikey)); 00522 if (treeKey) 00523 return _compare(*treeKey); 00524 return SWKey::compare(ikey); 00525 } |
|
Equates this SWKey to another SWKey object.
Reimplemented from SWKey. Definition at line 494 of file treekeyidx.cpp. References SWKey::copyFrom().
00494 { 00495 SWKey::copyFrom(ikey); 00496 } |
|
Decrements key a number of entries.
Implements TreeKey. Definition at line 528 of file treekeyidx.cpp.
00528 { 00529 error = getTreeNodeFromIdxOffset(currentNode.offset - (4*steps), ¤tNode); 00530 } |
|
Increments key a number of entries.
Implements TreeKey. Definition at line 532 of file treekeyidx.cpp.
00532 { 00533 error = getTreeNodeFromIdxOffset(currentNode.offset + (4*steps), ¤tNode); 00534 00535 /* 00536 // assert positive 00537 if (steps < 0) { 00538 decrement(steps * -1); 00539 return; 00540 } 00541 00542 while (steps > 0) { 00543 if (!firstChild()) { 00544 if (!nextSibbling() { 00545 error = KEYERR_OUTOFBOUNDS; 00546 return; 00547 } 00548 } 00549 steps--; 00550 } 00551 */ 00552 } |
|
Equates this SWKey to a character string.
Implements TreeKey. Definition at line 466 of file treekeyidx.cpp. References SWKey::Error().
00466 { 00467 char *buf = 0; 00468 stdstr(&buf, ikey); 00469 char *leaf = strtok(buf, "/"); 00470 root(); 00471 while ((leaf) && (!Error())) { 00472 bool ok, inChild = false; 00473 for (ok = firstChild(); ok; ok = nextSibling()) { 00474 inChild = true; 00475 if (!stricmp(leaf, getLocalName())) 00476 break; 00477 } 00478 leaf = strtok(0, "/"); 00479 if (!ok) { 00480 if (inChild) { // if we didn't find a matching child node, default to first child 00481 parent(); 00482 firstChild(); 00483 } 00484 if (leaf) 00485 error = KEYERR_OUTOFBOUNDS; 00486 break; 00487 } 00488 } 00489 delete [] buf; 00490 } |