diff options
Diffstat (limited to 'src/keys')
-rw-r--r-- | src/keys/listkey.cpp | 25 | ||||
-rw-r--r-- | src/keys/swkey.cpp | 1 | ||||
-rw-r--r-- | src/keys/treekeyidx.cpp | 9 |
3 files changed, 29 insertions, 6 deletions
diff --git a/src/keys/listkey.cpp b/src/keys/listkey.cpp index 3d5a897..08a1015 100644 --- a/src/keys/listkey.cpp +++ b/src/keys/listkey.cpp @@ -145,8 +145,9 @@ void ListKey::increment(int step) { Error(); // clear error for(; step && !Error(); step--) { if (arraypos < arraycnt) { - (*(array[arraypos]))++; - if (array[arraypos]->Error()) { + if (array[arraypos]->isBoundSet()) + (*(array[arraypos]))++; + if ((array[arraypos]->Error()) || (!array[arraypos]->isBoundSet())) { SetToElement(arraypos+1); } else *this = (const char *)(*array[arraypos]); @@ -168,8 +169,9 @@ void ListKey::decrement(int step) { Error(); // clear error for(; step && !Error(); step--) { if (arraypos > -1) { - (*(array[arraypos]))--; - if (array[arraypos]->Error()) { + if (array[arraypos]->isBoundSet()) + (*(array[arraypos]))--; + if ((array[arraypos]->Error()) || (!array[arraypos]->isBoundSet())) { SetToElement(arraypos-1, BOTTOM); } else *this = (const char *)(*array[arraypos]); @@ -259,7 +261,7 @@ void ListKey::Remove() { /****************************************************************************** - * VerseKey::getRangeText - returns parsable range text for this key + * ListKey::getRangeText - returns parsable range text for this key */ const char *ListKey::getRangeText() const { @@ -271,6 +273,19 @@ const char *ListKey::getRangeText() const { strcat(buf, "; "); } stdstr(&rangeText, buf); + delete [] buf; return rangeText; } + +/****************************************************************************** + * ListKey::getText - returns text key if (const char *) cast is requested + */ + +const char *ListKey::getText() const { + SWKey *key = GetElement(); + return (key) ? key->getText() : keytext; +} + + + diff --git a/src/keys/swkey.cpp b/src/keys/swkey.cpp index f2491c4..1551284 100644 --- a/src/keys/swkey.cpp +++ b/src/keys/swkey.cpp @@ -42,6 +42,7 @@ SWKey::SWKey(SWKey const &k) void SWKey::init() { myclass = &classdef; + boundSet = false; } SWKey *SWKey::clone() const diff --git a/src/keys/treekeyidx.cpp b/src/keys/treekeyidx.cpp index acd9b5a..f5d21b5 100644 --- a/src/keys/treekeyidx.cpp +++ b/src/keys/treekeyidx.cpp @@ -1,7 +1,7 @@ /****************************************************************************** * versekey.h - code for class 'versekey'- a standard Biblical verse key * - * $Id: treekeyidx.cpp,v 1.7 2002/04/15 21:26:44 scribe Exp $ + * $Id: treekeyidx.cpp,v 1.8 2002/09/11 07:04:20 scribe Exp $ * * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org) * CrossWire Bible Society @@ -588,3 +588,10 @@ TreeKeyIdx::TreeNode::~TreeNode() { if (userData) delete [] userData; } + + +SWKey *TreeKeyIdx::clone() const +{ + return new TreeKeyIdx(*this); +} + |