File: lookupstringlist.xml

package info (click to toggle)
lazarus 4.0%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 275,760 kB
  • sloc: pascal: 2,341,904; xml: 509,420; makefile: 348,726; cpp: 93,608; sh: 3,387; java: 609; perl: 297; sql: 222; ansic: 137
file content (419 lines) | stat: -rw-r--r-- 13,463 bytes parent folder | download
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
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
<?xml version="1.0" encoding="UTF-8"?>
<!--

Documentation for LCL (Lazarus Component Library) and LazUtils (Lazarus 
Utilities) are published under the Creative Commons Attribution-ShareAlike 4.0 
International public license.

https://creativecommons.org/licenses/by-sa/4.0/legalcode.txt
https://gitlab.com/freepascal.org/lazarus/lazarus/-/blob/main/docs/cc-by-sa-4-0.txt

Copyright (c) 1997-2025, by the Lazarus Development Team.

-->
<fpdoc-descriptions>
<package name="lazutils">
<!--
====================================================================
LookupStringList
====================================================================
-->
<module name="LookupStringList">
<short>
Contains TLookupStringList, an unsorted StringList with a fast lookup feature.
</short>
<descr>
<p>
<file>lookupstringlist.pas</file> contains TLookupStringList, an unsorted 
StringList with a fast lookup feature. <file>lookupstringlist.pas</file> is 
part of the <file>LazUtils</file> package.
</p>
<p>
Authors: Juha Manninen / Antônio Galvão
</p>
</descr>

<!-- class Visibility: default -->
<element name="TLookupStringList">
<short>
Implements an unsorted StringList with a fast lookup feature.
</short>
<descr>
<p>
<var>TLookupStringList</var> is a <var>TStringList</var> descendant that 
implements an unsorted string list with a fast lookup feature. Internally it 
uses a map container, <var>TStringMap</var> from unit <var>AvgLvlTree</var>,
which is a balanced tree. The strings are stored in 2 places, in the string list
itself and in the map container. The map is used in <var>Contains</var>,
<var>IndexOf</var> and <var>Find</var> methods. The map container does not
reserve too much memory because the strings are reference counted and not copied.
</p>
<p>
All values for the <var>Duplicates</var> property are fully supported, including
dupIgnore and dupError (unlike in unsorted TStringList class).
</p>
<p>
This class is useful when you must preserve the order in list, but also need 
to do fast lookups to see if a string exists, or must prevent duplicates.
</p>
<p>
Authors: Juha Manninen / Antônio Galvão
</p>
</descr>
<seealso>
<link id="#rtl.classes.TStringList">TStringList</link>
</seealso>
</element>

<!-- variable Visibility: private -->
<element name="TLookupStringList.FMap"/>

<!-- procedure Visibility: protected -->
<element name="TLookupStringList.InsertItem">
<short>
Adds a new value to the items and the string map with duplicate enforcement.
</short>
<descr>
<p>
<var>InsertItem</var> is an overridden method which ensures that the internal 
<var>String</var> map and the <var>Duplicates</var> property are used when an 
item value is inserted. When <var>Sorted</var> contains <b>False</b>, the 
value in Duplicates determines the actions taken.
</p>
<dl>
<dt>dupAccept</dt>
<dd>
Duplicates are allowed. Inserts the item and adds it to the string map.
</dd>
<dt>dupIgnore</dt>
<dd>
Ignores duplicates. No actions are performed when S is already in the string 
map.
</dd>
<dt>dupError</dt>
<dd>
Raises an Exception if S is already in the string map.
</dd>
</dl>
<p>
InsertItem calls the inherited method, and adds the value in <var>S</var> to 
the internal string map.
</p>
</descr>
<errors>
<p>
Raises an <var>Exception</var> when adding a duplicated value and Duplicates 
contains <var>dupError</var>. Raised with the message 
'TLookupStringList.InsertItem: Duplicates are not allowed.'
</p>
</errors>
<seealso>
<link id="#rtl.classes.TStringList">TStringList</link>
</seealso>
</element>
<!-- argument Visibility: default -->
<element name="TLookupStringList.InsertItem.Index">
<short>Position for the new item.</short>
</element>
<!-- argument Visibility: default -->
<element name="TLookupStringList.InsertItem.S">
<short>Value for the new item.</short>
</element>

<!-- constructor Visibility: public -->
<element name="TLookupStringList.Create">
<short>
Constructor for the class instance.
</short>
<descr>
<p>
<var>Create</var> is the constructor for the class instance, and calls the 
inherited constructor. Create allocates the internal <var>TStringMap</var> 
instance used in the class.
</p>
</descr>
<seealso>
<link id="#rtl.classes.TStrings.Create">TStrings.Create</link>
</seealso>
</element>

<!-- destructor Visibility: public -->
<element name="TLookupStringList.Destroy">
<short>
Destructor for the class instance.
</short>
<descr>
<p>
<var>Destroy</var> is the destructor for the class instance. Destroy frees 
the internal <var>TStringMap</var> instance allocated in the constructor, and 
calls the inherited Destroy method.
</p>
</descr>
<seealso>
<link id="#rtl.classes.TStringList.Destroy">TStringList.Destroy</link>
</seealso>
</element>

<!-- procedure Visibility: public -->
<element name="TLookupStringList.Assign">
<short>
Implements object persistence in the class.
</short>
<descr>
<p>
<var>Assign</var> is an overridden method which implements the object 
persistence mechanism in the class. Assign ensures that property values in 
<var>Source</var> are stored in the current class instance. Assign calls the 
inherited method. When Source is a <var>TLookupStringList</var> class 
instance, the values in its internal string map are also stored in the 
current class instance.
</p>
</descr>
<seealso>
<link id="#rtl.classes.TStrings.Assign">TStrings.Assign</link>
</seealso>
</element>
<!-- argument Visibility: default -->
<element name="TLookupStringList.Assign.Source">
<short>Persistent object with property values for the class instance.</short>
</element>

<!-- procedure Visibility: public -->
<element name="TLookupStringList.Clear">
<short>
Clears the content stored in the class instance.
</short>
<descr>
<p>
<var>Clear</var> is an overridden method used to clear the content stored in 
<var>Strings</var>, <var>Objects</var>, and the internal string map. Clear 
calls the inherited method, and calls the <var>TStringMap.Clear</var> method 
in the internal string map.
</p>
</descr>
<seealso>
<link id="#rtl.classes.TStringList.Clear">TStringList.Clear</link>
</seealso>
</element>

<!-- procedure Visibility: public -->
<element name="TLookupStringList.Delete">
<short>
Deletes the value at the specified position.
</short>
<descr>
<p>
<var>Delete</var> is an overridden method which ensures that the internal 
string map is maintained when deleting the value stored at the specified 
position. The corresponding value in <var>Strings</var> is used to check for 
duplicates using <var>IndexOf</var>. When a duplicate exists, and 
<var>Duplicates</var> are not allowed, the value is also removed from the 
internal string map. Delete calls the inherited method to delete the values 
in Strings and Objects at the position in <var>Index</var>.
</p>
</descr>
<seealso>
<link id="#rtl.classes.TStringList.Delete">TStringList.Delete</link>
</seealso>
</element>
<!-- argument Visibility: default -->
<element name="TLookupStringList.Delete.Index">
<short>Ordinal position of the value to delete.</short>
</element>

<!-- function Visibility: public -->
<element name="TLookupStringList.Add">
<short>
Adds the specified value to the Strings in the list.
</short>
<descr>
<p>
<var>Add</var> is an overridden <var>Integer</var> function used to enforce 
handling of <var>Duplicates</var> when adding the specified value to 
<var>Strings</var>. Add checks the values in <var>Sorted</var> and Duplicates 
to see if duplicates are allowed in the unsorted string list.
</p>
<p>
The return value is <b>-1</b> if the value in <var>S</var> already exists in 
the string map, and no actions are performed in the method. Otherwise, the 
inherited Add method is called to store the value in S. The return value is 
the position in Strings where the new value was stored.
</p>
</descr>
<seealso>
<link id="#rtl.classes.TStringList.Add">TStringList.Add</link>
</seealso>
</element>
<!-- function result Visibility: default -->
<element name="TLookupStringList.Add.Result">
<short>
Ordinal position for the new value, or -1 when duplicates are not allowed.
</short>
</element>
<!-- argument Visibility: default -->
<element name="TLookupStringList.Add.S">
<short>Value to add to the Strings in the list.</short>
</element>

<!-- function Visibility: public -->
<element name="TLookupStringList.AddObject">
<short>
Adds the specified values to the Strings and Objects in the list.
</short>
<descr>
<p>
<var>AddObject</var> is an overridden <var>Integer</var> function used to add 
the specified values to the <var>Strings</var> and <var>Objects</var> in the 
list. AddObject calls the <var>Add</var> method to add the value in 
<var>S</var> to Strings.
</p>
<p>
The return value contains the ordinal position in Strings where the value was 
stored, or <b>-1</b> when duplicate values are not allowed. If the return 
value is not <b>-1</b>, the Objects property is updated to include the value 
in <var>AObject</var> at the specified position.
</p>
</descr>
<seealso>
<link id="#rtl.classes.TStrings.AddObject">TStrings.AddObject</link>
</seealso>
</element>
<!-- function result Visibility: default -->
<element name="TLookupStringList.AddObject.Result">
<short>
Ordinal position for the new values, or -1 when duplicates are not allowed.
</short>
</element>
<!-- argument Visibility: default -->
<element name="TLookupStringList.AddObject.S">
<short>Value added to the Strings property.</short>
</element>
<!-- argument Visibility: default -->
<element name="TLookupStringList.AddObject.AObject">
<short>Value added to the Objects property.</short>
</element>

<!-- function Visibility: public -->
<element name="TLookupStringList.Contains">
<short>
Determines if the specified value already exists in the string map.
</short>
<descr>
<p>
<var>Contains</var> is a <var>Boolean</var> function used to determine if the 
specified value already exists in the internal string map for the string 
list. The return value is <b>True</b> when <var>S</var> is already stored in 
the <var>TStringMap</var> for the class.
</p>
<p>
Contains is called from the <var>Add</var>, <var>InsertItem</var>, and 
<var>IndexOf</var> methods.
</p>
</descr>
<seealso></seealso>
</element>
<!-- function result Visibility: default -->
<element name="TLookupStringList.Contains.Result">
<short>
<b>True</b> when the value is already stored in the TStringMap for the class.
</short>
</element>
<!-- argument Visibility: default -->
<element name="TLookupStringList.Contains.S">
<short>Value to locate in the string map.</short>
</element>

<!-- function Visibility: public -->
<element name="TLookupStringList.Find">
<short>
Locates the specified value in the Strings property.
</short>
<descr>
<p>
<var>Find</var> is an overridden <var>Boolean</var> function used to locate 
the specified value in the <var>Strings</var> property. The value in 
<var>Index</var> contains the position in Strings where value was located 
using the <var>IndexOf</var> method. Index contains <b>-1</b> if the value in 
<var>S</var> is not stored in Strings. The return value if <b>True</b> when 
Index contains a value other than <b>-1</b>.
</p>
<p>
Please note: Find does <b>NOT</b> call the inherited method.
</p>
</descr>
<seealso>
<link id="#rtl.classes.TStringList.Find">TStringList.Find</link>
</seealso>
</element>
<!-- function result Visibility: default -->
<element name="TLookupStringList.Find.Result">
<short><b>True</b> when the value is located in the Strings property.</short>
</element>
<!-- argument Visibility: default -->
<element name="TLookupStringList.Find.S">
<short>Value to find in the Strings property.</short>
</element>
<!-- argument Visibility: default -->
<element name="TLookupStringList.Find.Index">
<short>Ordinal position where the value was found.</short>
</element>

<!-- function Visibility: public -->
<element name="TLookupStringList.IndexOf">
<short>
Gets the position in Strings where the specified value is stored.
</short>
<descr>
<p>
<var>IndexOf</var> is an overridden <var>Integer</var> function used to get 
the position in <var>Strings</var> where the specified value is stored. 
IndexOf uses the internal <var>String</var> map to determine if the value in 
<var>S</var> is stored in the string list. If S already exists, the inherited 
method is called.
</p>
<p>
The return value contains the ordinal position for the specified value, or 
<b>-1</b> when S does not exist in the string map.
</p>
</descr>
<seealso>
<link id="#rtl.classes.TStringList.IndexOf">TStringList.IndexOf</link>
</seealso>
</element>
<!-- function result Visibility: default -->
<element name="TLookupStringList.IndexOf.Result">
<short>
Ordinal position for the specified value, or -1 when it does not exist.
</short>
</element>
<!-- argument Visibility: default -->
<element name="TLookupStringList.IndexOf.S">
<short>Value to locate in Strings.</short>
</element>

<element name="Deduplicate">
<short>
Removes duplicate strings in the AStrings argument.
</short>
<descr>
<p>
Removes duplicate strings (with case sensitivity) from <var>AStrings</var>. 
Deduplicate creates a <var>TLookupStringList</var> instance that is used to 
remove the duplicate values in AStrings.
</p>
</descr>
<seealso>
<link id="TLookupStringList"/>
</seealso>
</element>
<element name="Deduplicate.AStrings">
<short>TStrings instance examined in the function.</short>
</element>
<element name="Deduplicate.Result">
<short>The number of duplicates removed from AStrings.</short>
</element>

</module>
<!-- LookupStringList -->
</package>
</fpdoc-descriptions>