StrKey Class Reference

#include <strkey.h>

Inheritance diagram for StrKey:
Inheritance graph
[legend]
Collaboration diagram for StrKey:
Collaboration graph
[legend]

List of all members.

Public Member Functions

virtual void clearBound () const
virtual SWKeyclone () const
virtual int compare (const SWKey &ikey)
virtual void copyFrom (const SWKey &ikey)
virtual void decrement (int steps=1)
virtual bool equals (const SWKey &ikey)
SWDEPRECATED char Error ()
const SWClassgetClass () const
virtual long getIndex () const
char * getLocale () const
virtual const char * getOSISRefRangeText () const
virtual const char * getRangeText () const
virtual const char * getShortText () const
virtual const char * getText () const
virtual void increment (int steps=1)
virtual bool isBoundSet () const
bool isPersist () const
virtual bool isTraversable () const
SWDEPRECATED char Persist (signed char ipersist)
SWDEPRECATED char Persist () const
virtual char popError ()
virtual void positionFrom (const SWKey &ikey)
virtual void setError (char err)
virtual void setIndex (long iindex)
void setLocale (const char *name)
void setPersist (bool ipersist)
virtual void setPosition (SW_POSITION)
virtual void setText (const char *ikey)
 StrKey (const char *ikey=0)
virtual ~StrKey ()

Public Attributes

__u64 userData

Protected Member Functions

SWLocalegetPrivateLocale () const

Protected Attributes

bool boundSet
char error
char * keytext
char * localeName
SWClassmyclass
bool persist
char * rangeText

Private Member Functions

void init ()

Static Private Attributes

static SWClass classdef

Detailed Description

a standard string key class (used for modules that index on single strings (eg. cities, names, words, etc.)

Definition at line 36 of file strkey.h.


Constructor & Destructor Documentation

StrKey::StrKey ( const char *  ikey = 0  ) 

initializes instance of StrKey

Parameters:
ikey text key (word, city, name, etc.)

Definition at line 39 of file strkey.cpp.

00039                                : SWKey(ikey)
00040 {
00041     init();
00042 }

StrKey::~StrKey (  )  [virtual]

cleans up instance of StrKey

Definition at line 56 of file strkey.cpp.

00056                 {
00057 }


Member Function Documentation

virtual void SWKey::clearBound (  )  const [inline, virtual, inherited]

Definition at line 181 of file swkey.h.

00181 { boundSet = false; }

SWKey * SWKey::clone (  )  const [virtual, inherited]

Returns a new exact clone of this SWKey object. This allocates a new SWKey which must be deleted by the caller

Returns:
new clone of this key

Reimplemented in ListKey, TreeKeyIdx, VerseKey, and VerseTreeKey.

Definition at line 74 of file swkey.cpp.

00075 {
00076     return new SWKey(*this);
00077 }

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 }

void SWKey::copyFrom ( const SWKey ikey  )  [virtual, inherited]

Copies as much info (position, range, etc.) as possible from another SWKey object

Parameters:
ikey other SWKey object from which to copy

Reimplemented in ListKey, TreeKeyIdx, and VerseKey.

Definition at line 172 of file swkey.cpp.

00172                                       {
00173 // not desirable    Persist(ikey.Persist());
00174     setLocale(ikey.getLocale());
00175     setText((const char *)ikey);
00176 }

void SWKey::decrement ( int  steps = 1  )  [virtual, inherited]

Decrements key a number of entry positions This is only valid if isTraversable is true

Parameters:
steps Number of entries to jump backward

Reimplemented in ListKey, TreeKey, TreeKeyIdx, VerseKey, and VerseTreeKey.

Definition at line 260 of file swkey.cpp.

00260                          {
00261     error = KEYERR_OUTOFBOUNDS;
00262 }

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.

00195 { return !compare(ikey); }

SWDEPRECATED char SWKey::Error (  )  [inline, inherited]

Gets and clears error status

Returns:
error status

Definition at line 159 of file swkey.h.

00159 { return popError(); }

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 SWKey::getIndex (  )  const [inline, virtual, inherited]

Use this function to get an index position within a module.

Reimplemented in ListKey, TreeKey, and VerseKey.

Definition at line 220 of file swkey.h.

00220 { return index; }

char* SWKey::getLocale (  )  const [inline, inherited]

Definition at line 215 of file swkey.h.

00215 { return localeName; }

const char * SWKey::getOSISRefRangeText (  )  const [virtual, inherited]

Reimplemented in ListKey, and VerseKey.

Definition at line 202 of file swkey.cpp.

00202                                              {
00203     return getRangeText();
00204 }

SWLocale * SWKey::getPrivateLocale (  )  const [protected, inherited]

Definition at line 110 of file swkey.cpp.

00110                                         {
00111     if (!locale) {
00112         if ((!localeCache.name) || (strcmp(localeCache.name, localeName))) {
00113             stdstr(&(localeCache.name), localeName);
00114             // this line is the entire bit of work we're trying to avoid with the cache
00115             // worth it?  compare time examples/cmdline/search KJV "God love world" to
00116             // same with this method reduced to:
00117             // if (!local) local = ... (call below); return locale;
00118             localeCache.locale = LocaleMgr::getSystemLocaleMgr()->getLocale(localeName);
00119         }
00120         locale = localeCache.locale;
00121     }
00122     return locale;
00123 }

const char * SWKey::getRangeText (  )  const [virtual, inherited]

Reimplemented in ListKey, and VerseKey.

Definition at line 192 of file swkey.cpp.

00192                                       {
00193     stdstr(&rangeText, keytext);
00194     return rangeText;
00195 }

virtual const char* SWKey::getShortText (  )  const [inline, virtual, inherited]

Reimplemented in ListKey, and VerseKey.

Definition at line 177 of file swkey.h.

00177 { return getText(); }

const char * SWKey::getText (  )  const [virtual, inherited]

returns string representation of this key

Reimplemented in ListKey, TreeKey, TreeKeyIdx, and VerseKey.

Definition at line 183 of file swkey.cpp.

00183                                  {
00184     return keytext;
00185 }

void SWKey::increment ( int  steps = 1  )  [virtual, inherited]

Increments key a number of entry positions This is only valid if isTraversable is true

Parameters:
steps Number of entries to jump forward

Reimplemented in ListKey, TreeKey, TreeKeyIdx, VerseKey, and VerseTreeKey.

Definition at line 247 of file swkey.cpp.

00247                          {
00248     error = KEYERR_OUTOFBOUNDS;
00249 }

void StrKey::init (  )  [private]

Reimplemented from SWKey.

Definition at line 45 of file strkey.cpp.

00045                   {
00046     myclass = &classdef;
00047 }

virtual bool SWKey::isBoundSet (  )  const [inline, virtual, inherited]

Definition at line 180 of file swkey.h.

00180 { return boundSet; }

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 SWKey::isTraversable (  )  const [inline, virtual, inherited]

Whether or not this key can be ++ -- incremented

Reimplemented in ListKey, TreeKey, TreeKeyIdx, VerseKey, and VerseTreeKey.

Definition at line 213 of file swkey.h.

00213 { return false; }

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.

00153 { setPersist(ipersist); return isPersist(); }

SWDEPRECATED char SWKey::Persist (  )  const [inline, inherited]

Definition at line 146 of file swkey.h.

00146 { return isPersist(); }

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 }

virtual void SWKey::positionFrom ( const SWKey ikey  )  [inline, virtual, inherited]

Definition at line 172 of file swkey.h.

00172 { copyFrom(ikey); }

virtual void SWKey::setError ( char  err  )  [inline, virtual, inherited]

Definition at line 161 of file swkey.h.

00161 { error = err; }

virtual void SWKey::setIndex ( long  iindex  )  [inline, virtual, inherited]

See documentation for Index()

Reimplemented in ListKey, TreeKey, and VerseKey.

Definition at line 224 of file swkey.h.

00224 { index = iindex; }

void SWKey::setLocale ( const char *  name  )  [inline, inherited]

Definition at line 216 of file swkey.h.

00216 { stdstr(&localeName, name); locale = 0;    } // this will force an on demand lookup of our locale

void SWKey::setPersist ( bool  ipersist  )  [inherited]

Definition at line 134 of file swkey.cpp.

00135 {
00136     persist = ipersist;
00137 }

void SWKey::setPosition ( SW_POSITION  p  )  [virtual, inherited]

Reimplemented in ListKey, TreeKey, TreeKeyIdx, VerseKey, and VerseTreeKey.

Definition at line 227 of file swkey.cpp.

00227                                      {
00228     switch (p) {
00229     case POS_TOP:
00230 //      *this = "";
00231         break;
00232     case POS_BOTTOM:
00233 //      *this = "zzzzzzzzz";
00234         break;
00235     } 
00236 }

void SWKey::setText ( const char *  ikey  )  [virtual, inherited]

Sets this SWKey with a character string

Parameters:
ikey string used to set this key

Reimplemented in ListKey, TreeKey, TreeKeyIdx, and VerseKey.

Definition at line 161 of file swkey.cpp.

00161                                     {
00162     stdstr(&keytext, ikey);
00163 }


Member Data Documentation

bool SWKey::boundSet [mutable, protected, inherited]

Definition at line 105 of file swkey.h.

SWClass StrKey::classdef [static, private]

Reimplemented from SWKey.

Definition at line 38 of file strkey.h.

char SWKey::error [protected, inherited]

Definition at line 107 of file swkey.h.

char* SWKey::keytext [protected, inherited]

Definition at line 103 of file swkey.h.

char* SWKey::localeName [protected, inherited]

Definition at line 109 of file swkey.h.

SWClass* SWObject::myclass [protected, inherited]

Definition at line 53 of file swobject.h.

bool SWKey::persist [protected, inherited]

Definition at line 106 of file swkey.h.

char* SWKey::rangeText [mutable, protected, inherited]

Definition at line 104 of file swkey.h.

__u64 SWKey::userData [inherited]

Definition at line 116 of file swkey.h.


The documentation for this class was generated from the following files:

Generated on 18 Mar 2013 for The SWORD Project by  doxygen 1.6.1