1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313
|
.TH "SWKey" 3 "5 Oct 2001" "The Sword Project" \" -*- nroff -*-
.ad l
.nh
.SH NAME
SWKey \- SWKey is the basis for all types of keys for indexing into modules (e.g.
.SH SYNOPSIS
.br
.PP
\fC#include <swkey.h>\fR
.PP
Inherits \fBSWObject\fR.
.PP
Inherited by \fBListKey\fR, \fBStrKey\fR, and \fBVerseKey\fR.
.PP
.SS Public Methods
.in +1c
.ti -1c
.RI "\fBSWKey\fR (const char *ikey=0)"
.br
.RI "\fIinitializes instance of SWKey.\fR"
.ti -1c
.RI "\fBSWKey\fR (SWKey const &k)"
.br
.RI "\fICopy Constructor.\fR"
.ti -1c
.RI "virtual \fB~SWKey\fR ()"
.br
.RI "\fIDestructor, cleans up this instance of SWKey.\fR"
.ti -1c
.RI "virtual SWKey* \fBclone\fR () const"
.br
.RI "\fIReturns a copy of this SWKey object.\fR"
.ti -1c
.RI "char \fBPersist\fR () const"
.br
.RI "\fIGets whether this object itself persists within a module that it was used to SetKey or just a copy.\fR"
.ti -1c
.RI "char \fBPersist\fR (char ikey)"
.br
.RI "\fISet/gets whether this object itself persists within a module that it was used to SetKey or just a copy.\fR"
.ti -1c
.RI "virtual char \fBError\fR ()"
.br
.RI "\fIGets and clears error status.\fR"
.ti -1c
.RI "virtual void \fBsetText\fR (const char *ikey)"
.br
.RI "\fIEquates this SWKey to a character string.\fR"
.ti -1c
.RI "virtual void \fBcopyFrom\fR (const SWKey &ikey)"
.br
.RI "\fIEquates this SWKey to another SWKey object.\fR"
.ti -1c
.RI "virtual const char* \fBgetText\fR () const"
.br
.RI "\fIreturns text key if (char *) cast is requested.\fR"
.ti -1c
.RI "virtual int \fBcompare\fR (const SWKey &ikey)"
.br
.RI "\fICompares another \fBVerseKey\fR object.\fR"
.ti -1c
.RI "virtual bool \fBequals\fR (const SWKey &ikey)"
.br
.RI "\fICompares another \fBVerseKey\fR object.\fR"
.ti -1c
.RI "virtual void \fBsetPosition\fR (SW_POSITION)"
.br
.ti -1c
.RI "virtual void \fBdecrement\fR (int steps=1)"
.br
.RI "\fIDecrements key a number of entries.\fR"
.ti -1c
.RI "virtual void \fBincrement\fR (int steps=1)"
.br
.RI "\fIIncrements key a number of entries.\fR"
.ti -1c
.RI "virtual char \fBTraversable\fR ()"
.br
.ti -1c
.RI "virtual long \fBIndex\fR () const"
.br
.RI "\fIUse this function to get te current position withing a module.\fR"
.ti -1c
.RI "virtual long \fBIndex\fR (long iindex)"
.br
.in -1c
.SS Protected Attributes
.in +1c
.ti -1c
.RI "char* \fBkeytext\fR"
.br
.ti -1c
.RI "char \fBpersist\fR"
.br
.ti -1c
.RI "char \fBerror\fR"
.br
.in -1c
.SS Private Methods
.in +1c
.ti -1c
.RI "void \fBinit\fR ()"
.br
.in -1c
.SS Private Attributes
.in +1c
.ti -1c
.RI "long \fBindex\fR"
.br
.in -1c
.SS Static Private Attributes
.in +1c
.ti -1c
.RI "\fBSWClass\fR \fBclassdef\fR"
.br
.in -1c
.SH DETAILED DESCRIPTION
.PP
SWKey is the basis for all types of keys for indexing into modules (e.g.
.PP
verse, word, place, etc.)
.PP
Definition at line 76 of file swkey.h.
.SH CONSTRUCTOR & DESTRUCTOR DOCUMENTATION
.PP
.SS SWKey::SWKey (const char * ikey = 0)
.PP
initializes instance of SWKey.
.PP
\fBParameters: \fR
.in +1c
.TP
\fB\fIikey\fR\fR
text key
.SS SWKey::SWKey (SWKey const & k)
.PP
Copy Constructor.
.PP
\fBParameters: \fR
.in +1c
.TP
\fB\fIThe\fR\fR
SWKey object to copy.
.SH MEMBER FUNCTION DOCUMENTATION
.PP
.SS char SWKey::Error ()\fC [virtual]\fR
.PP
Gets and clears error status.
.PP
\fBReturns: \fR
.in +1c
error status
.SS long SWKey::Index () const\fC [inline, virtual]\fR
.PP
Use this function to get te current position withing a module.
.PP
Here's a small example how to use this function and Index(long). This function uses the GerLut module and chooses a random verse from the Bible and returns it.
.PP
.nf
const char* randomVerse() {
VerseKey vk;
SWMgr mgr;
LocaleMgr::systemLocaleMgr.setDefaultLocaleName("de");
SWModule* module = mgr->Modules("GerLut");
srand( time(0) );
const double newIndex = (double(rand())/RAND_MAX)*(24108+8224);
vk.Index(newIndex);
module->SetKey(vk);
char* text;
sprintf(text, "%s: %s",(const char*)vk ,module->StripText(&vk));
return text;
.fi
.PP
Reimplemented in \fBListKey\fR, and \fBVerseKey\fR.
.PP
Definition at line 204 of file swkey.h.
.PP
Referenced by ListKey::Index().
.SS char SWKey::Persist (char ikey)
.PP
Set/gets whether this object itself persists within a module that it was used to SetKey or just a copy.
.PP
(1 - persists in module; 0 - a copy is attempted
.PP
\fBParameters: \fR
.in +1c
.TP
\fB\fIipersist\fR\fR
value which to set persist; [-1] - only get
.PP
\fBReturns: \fR
.in +1c
value of persist
.SS char SWKey::Persist () const
.PP
Gets whether this object itself persists within a module that it was used to SetKey or just a copy.
.PP
(1 - persists in module; 0 - a copy is attempted
.PP
\fBReturns: \fR
.in +1c
value of persist
.SS SWKey * SWKey::clone () const\fC [virtual]\fR
.PP
Returns a copy of this SWKey object.
.PP
This is useful to get a 1:1 copy of an SWKey based object.
.PP
\fBReturns: \fR
.in +1c
SWKey
.PP
Reimplemented in \fBListKey\fR, and \fBVerseKey\fR.
.SS int SWKey::compare (const SWKey & ikey)\fC [virtual]\fR
.PP
Compares another \fBVerseKey\fR object.
.PP
\fBParameters: \fR
.in +1c
.TP
\fB\fIikey\fR\fR
key to compare with this one
.PP
\fBReturns: \fR
.in +1c
>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
.PP
Reimplemented in \fBVerseKey\fR.
.PP
Referenced by equals().
.SS void SWKey::copyFrom (const SWKey & ikey)\fC [virtual]\fR
.PP
Equates this SWKey to another SWKey object.
.PP
\fBParameters: \fR
.in +1c
.TP
\fB\fIikey\fR\fR
other swkey object
.PP
Reimplemented in \fBListKey\fR, and \fBVerseKey\fR.
.PP
Referenced by ListKey::copyFrom().
.SS void SWKey::decrement (int step = 1)\fC [virtual]\fR
.PP
Decrements key a number of entries.
.PP
\fBParameters: \fR
.in +1c
.TP
\fB\fIsteps\fR\fR
Number of entries to jump backward
.PP
\fBReturns: \fR
.in +1c
*this
.PP
Reimplemented in \fBListKey\fR, and \fBVerseKey\fR.
.SS bool SWKey::equals (const SWKey & ikey)\fC [inline, virtual]\fR
.PP
Compares another \fBVerseKey\fR object.
.PP
\fBParameters: \fR
.in +1c
.TP
\fB\fIikey\fR\fR
key to compare with this one
.PP
\fBReturns: \fR
.in +1c
true if the keys are the same
.PP
Definition at line 163 of file swkey.h.
.SS void SWKey::increment (int step = 1)\fC [virtual]\fR
.PP
Increments key a number of entries.
.PP
\fBParameters: \fR
.in +1c
.TP
\fB\fIincrement\fR\fR
Number of entries to jump forward
.PP
\fBReturns: \fR
.in +1c
*this
.PP
Reimplemented in \fBListKey\fR, and \fBVerseKey\fR.
.SS void SWKey::setText (const char * ikey)\fC [virtual]\fR
.PP
Equates this SWKey to a character string.
.PP
\fBParameters: \fR
.in +1c
.TP
\fB\fIikey\fR\fR
string to set this key to
.PP
Reimplemented in \fBVerseKey\fR.
.PP
Referenced by VerseKey::setText().
.SH AUTHOR
.PP
Generated automatically by Doxygen for The Sword Project from the source code.
|