summaryrefslogtreecommitdiff
path: root/src/keys/swkey.cpp
diff options
context:
space:
mode:
authorRoberto C. Sanchez <roberto@connexer.com>2014-03-29 10:53:49 -0400
committerRoberto C. Sanchez <roberto@connexer.com>2014-03-29 10:53:49 -0400
commit8c8aa6b07e595cfac56838b5964ab3e96051f1b2 (patch)
treeda38e2c1979148dbd3b0c7b87f930746f5ba7f44 /src/keys/swkey.cpp
parent8d3fc864d094eeadc721f8e93436b37a5fab173e (diff)
Imported Upstream version 1.5.7
Diffstat (limited to 'src/keys/swkey.cpp')
-rw-r--r--src/keys/swkey.cpp46
1 files changed, 33 insertions, 13 deletions
diff --git a/src/keys/swkey.cpp b/src/keys/swkey.cpp
index 0ed2e75..994402f 100644
--- a/src/keys/swkey.cpp
+++ b/src/keys/swkey.cpp
@@ -6,7 +6,8 @@
#include <swkey.h>
#include <utilfuns.h>
-#include <string.h>
+
+SWORD_NAMESPACE_START
static const char *classes[] = {"SWKey", "SWObject", 0};
SWClass SWKey::classdef(classes);
@@ -19,26 +20,31 @@ SWClass SWKey::classdef(classes);
SWKey::SWKey(const char *ikey)
{
- index = 0;
- persist = 0;
- keytext = 0;
- error = 0;
+ index = 0;
+ persist = 0;
+ keytext = 0;
+ rangeText = 0;
+ error = 0;
+ userData = 0;
stdstr(&keytext, ikey);
init();
}
SWKey::SWKey(SWKey const &k)
{
- index = k.index;
- persist = k.persist;
- keytext = 0;
- error = k.error;
- stdstr(&keytext, k.keytext);
+ index = k.index;
+ persist = k.persist;
+ userData = k.userData;
+ keytext = 0;
+ rangeText = 0;
+ error = k.error;
+ setText(k.getText());
init();
}
void SWKey::init() {
myclass = &classdef;
+ boundSet = false;
}
SWKey *SWKey::clone() const
@@ -53,12 +59,14 @@ SWKey *SWKey::clone() const
SWKey::~SWKey() {
if (keytext)
delete [] keytext;
+ if (rangeText)
+ delete [] rangeText;
}
/******************************************************************************
* SWKey::Persist - Gets whether this object itself persists within a
- * module that it was used to SetKey or just a copy.
+ * module that it was used to setKey or just a copy.
* (1 - persists in module; 0 - a copy is attempted
*
* RET: value of persist
@@ -72,7 +80,7 @@ char SWKey::Persist() const
/******************************************************************************
* SWKey::Persist - Set/gets whether this object itself persists within a
- * module that it was used to SetKey or just a copy.
+ * module that it was used to setKey or just a copy.
* (1 - persists in module; 0 - a copy is attempted
*
* ENT: ipersist - value which to set persist
@@ -129,7 +137,7 @@ void SWKey::copyFrom(const SWKey &ikey) {
/******************************************************************************
- * SWKey::getText - returns text key if (char *) cast is requested
+ * SWKey::getText - returns text key if (const char *) cast is requested
*/
const char *SWKey::getText() const {
@@ -138,6 +146,16 @@ const char *SWKey::getText() const {
/******************************************************************************
+ * SWKey::getRangeText - returns parsable range text for this key
+ */
+
+const char *SWKey::getRangeText() const {
+ stdstr(&rangeText, keytext);
+ return rangeText;
+}
+
+
+/******************************************************************************
* SWKey::compare - Compares another VerseKey object
*
* ENT: ikey - key to compare with this one
@@ -193,3 +211,5 @@ void SWKey::increment(int) {
void SWKey::decrement(int) {
error = KEYERR_OUTOFBOUNDS;
}
+
+SWORD_NAMESPACE_END