Doubly linked list object


Usage:

OBJECT x = CREATE "dynamic", "list"

If an application wishes to use the Doubly linked list object then it should load it once and keep it loaded. Loading it each time it is used is very inefficient.

The writeToString method as implemented in KCML 6.20 has a memory leak. See the notes on the method on how to avoid it.

For further information see ObjList.htm


List
Element

List

List object

With this object you can create a doubly linked list in which list element objects can be ordered. Objects can be added or removed from any position on the list.

A list element can contain either a simple string, which must not have embedded HEX(00) characters, or a DEFRECORD defined record, which may contain any type.

This collection can be iterated with FOR OBJECT ... NEXT OBJECT

MethodReturnsPurpose
Append(OBJECT oElem)voidAppends an element to the end of a list
CreateElement([key$])ElementCreates a list element
Empty()voidDestroy all the elements from a list
Find(key$)ElementReturns the list element that exactly matches the key
Index(offset)ElementReturns the list element at the position specified (counted from 1)
Prepend(OBJECT oElem)voidPrepends an element to the start of a list
PropertyTypeReturnsPurpose
estimateWintEstimated size of list, set before first insert
hashsizeRWintSize of hash index
headRElementReturns the first element in the list
lengthRintReturns the number of elements in the list
tailRElementReturns the last element in the list

Element

List element object

MethodReturnsPurpose
GetRecord(BYREF rec$)voidRetrieve a record from the element
LinkAfter(OBJECT oElem)voidAppends an element after this one
LinkBefore(OBJECT oElem)voidPrepends an element before this one
SetRecord(BYREF rec$)voidInstall a record into the element
voidUnlink an element from the list
PropertyTypeReturnsPurpose
key$RstringGet any index key string
nextRElementGet next element in the list
parentRListGets the list object that contains this element
previousRElementGet previous element in the list
value$RWstringGet or set the elements value string