summaryrefslogtreecommitdiff
path: root/doc/api-documentation/man/man3/listkey.3
blob: 268654b6d8fc0b949452c8f8a7b1d1774c122d3d (plain)
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
.TH "ListKey" 3 "5 Oct 2001" "The Sword Project" \" -*- nroff -*-
.ad l
.nh
.SH NAME
ListKey \- ListKey is the basis for all types of keys that have lists of specified indexes (e.g. 
.SH SYNOPSIS
.br
.PP
\fC#include <listkey.h>\fR
.PP
Inherits \fBSWKey\fR.
.PP
.SS Public Methods

.in +1c
.ti -1c
.RI "\fBListKey\fR (const char *ikey=0)"
.br
.RI "\fIinitializes instance of ListKey.\fR"
.ti -1c
.RI "\fBListKey\fR (ListKey const &k)"
.br
.ti -1c
.RI "virtual \fB~ListKey\fR ()"
.br
.RI "\fIcleans up instance of ListKey.\fR"
.ti -1c
.RI "virtual \fBSWKey\fR* \fBclone\fR () const"
.br
.RI "\fIReturns a copy of this \fBSWKey\fR object.\fR"
.ti -1c
.RI "virtual void \fBClearList\fR ()"
.br
.RI "\fIClears out elements of list.\fR"
.ti -1c
.RI "virtual int \fBCount\fR ()"
.br
.RI "\fIReturns number of elements in list.\fR"
.ti -1c
.RI "virtual void \fBRemove\fR ()"
.br
.RI "\fIRemoves current element from list.\fR"
.ti -1c
.RI "virtual char \fBSetToElement\fR (int ielement, SW_POSITION=TOP)"
.br
.RI "\fISets key to element number.\fR"
.ti -1c
.RI "virtual \fBSWKey\fR* \fBGetElement\fR (int pos=-1)"
.br
.RI "\fIGets a key element number.\fR"
.ti -1c
.RI "ListKey& \fBoperator<<\fR (const \fBSWKey\fR &ikey)"
.br
.RI "\fIAdds an element to the list.\fR"
.ti -1c
.RI "virtual void \fBadd\fR (const \fBSWKey\fR &ikey)"
.br
.ti -1c
.RI "virtual void \fBcopyFrom\fR (const ListKey &ikey)"
.br
.RI "\fIEquates this ListKey to another ListKey object.\fR"
.ti -1c
.RI "virtual void \fBcopyFrom\fR (const \fBSWKey\fR &ikey)"
.br
.RI "\fIEquates this \fBSWKey\fR to another \fBSWKey\fR object.\fR"
.ti -1c
.RI "virtual void \fBsetPosition\fR (SW_POSITION)"
.br
.RI "\fIPositions this key.\fR"
.ti -1c
.RI "virtual void \fBdecrement\fR (int step)"
.br
.RI "\fIDecrements a number of elements.\fR"
.ti -1c
.RI "virtual void \fBincrement\fR (int step)"
.br
.RI "\fIIncrements a number of elements.\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 index)"
.br
.RI "\fIReturns the index for the new one given as as parameter.\fR"
.ti -1c
.RI "SWKEY_OPERATORS ListKey& \fBoperator=\fR (const ListKey &key)"
.br
.in -1c
.SS Protected Attributes

.in +1c
.ti -1c
.RI "int \fBarraypos\fR"
.br
.ti -1c
.RI "int \fBarraymax\fR"
.br
.ti -1c
.RI "int \fBarraycnt\fR"
.br
.ti -1c
.RI "\fBSWKey\fR** \fBarray\fR"
.br
.in -1c
.SS Private Methods

.in +1c
.ti -1c
.RI "void \fBinit\fR ()"
.br
.in -1c
.SS Static Private Attributes

.in +1c
.ti -1c
.RI "\fBSWClass\fR \fBclassdef\fR"
.br
.in -1c
.SH DETAILED DESCRIPTION
.PP 
ListKey is the basis for all types of keys that have lists of specified indexes (e.g.
.PP
a list of verses, place, etc.) 
.PP
Definition at line 36 of file listkey.h.
.SH CONSTRUCTOR & DESTRUCTOR DOCUMENTATION
.PP 
.SS ListKey::ListKey (const char * ikey = 0)
.PP
initializes instance of ListKey.
.PP
\fBParameters: \fR
.in +1c
.TP
\fB\fIikey\fR\fR
text key 
.SH MEMBER FUNCTION DOCUMENTATION
.PP 
.SS int ListKey::Count ()\fC [virtual]\fR
.PP
Returns number of elements in list.
.PP
\fBReturns: \fR
.in +1c
number of elements in list 
.SS \fBSWKey\fR * ListKey::GetElement (int pos = -1)\fC [virtual]\fR
.PP
Gets a key element number.
.PP
\fBParameters: \fR
.in +1c
.TP
\fB\fIpos\fR\fR
element number to get (or default current) 
.PP
\fBReturns: \fR
.in +1c
Key or null on error 
.SS long ListKey::Index (long index)\fC [inline, virtual]\fR
.PP
Returns the index for the new one given as as parameter.
.PP
The first parameter is the new index. 
.PP
Reimplemented from \fBSWKey\fR.
.PP
Definition at line 112 of file listkey.h.
.SS long ListKey::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 \fBIndex\fR(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 from \fBSWKey\fR.
.PP
Definition at line 106 of file listkey.h.
.SS char ListKey::SetToElement (int ielement, SW_POSITION = TOP)\fC [virtual]\fR
.PP
Sets key to element number.
.PP
\fBParameters: \fR
.in +1c
.TP
\fB\fIielement\fR\fR
element number to set to 
.PP
\fBReturns: \fR
.in +1c
error status 
.PP
Referenced by Index().
.SS virtual \fBSWKey\fR* ListKey::clone () const\fC [virtual]\fR
.PP
Returns a copy of this \fBSWKey\fR object.
.PP
This is useful to get a 1:1 copy of an \fBSWKey\fR based object. 
.PP
\fBReturns: \fR
.in +1c
\fBSWKey\fR 
.PP
Reimplemented from \fBSWKey\fR.
.SS void ListKey::copyFrom (const \fBSWKey\fR & ikey)\fC [inline, virtual]\fR
.PP
Equates this \fBSWKey\fR to another \fBSWKey\fR object.
.PP
\fBParameters: \fR
.in +1c
.TP
\fB\fIikey\fR\fR
other swkey object 
.PP
Reimplemented from \fBSWKey\fR.
.PP
Definition at line 90 of file listkey.h.
.SS void ListKey::copyFrom (const ListKey & ikey)\fC [virtual]\fR
.PP
Equates this ListKey to another ListKey object.
.PP
\fBParameters: \fR
.in +1c
.TP
\fB\fIikey\fR\fR
other ListKey object 
.SS ListKey & ListKey::operator<< (const \fBSWKey\fR & ikey)\fC [inline]\fR
.PP
Adds an element to the list.
.PP
\fBParameters: \fR
.in +1c
.TP
\fB\fIikey\fR\fR
the element to add 
.PP
Definition at line 82 of file listkey.h.
.SS void ListKey::setPosition (SW_POSITION)\fC [virtual]\fR
.PP
Positions this key.
.PP
\fBParameters: \fR
.in +1c
.TP
\fB\fIp\fR\fR
position 
.PP
\fBReturns: \fR
.in +1c
*this 
.PP
Reimplemented from \fBSWKey\fR.

.SH AUTHOR
.PP 
Generated automatically by Doxygen for The Sword Project from the source code.