17.17 TStringList

A TStringList object can be used to read a collection of strings stored in a stream. If you register this object with the RegisterType (549) function, you cannot register the TStrListMaker object.

This is the public declaration of the TStringList object:

 TYPE
    TStrIndexRec = Packed RECORD
       Key, Count, Offset: Word;
    END;
 
    TStrIndex = Array [0..9999] Of TStrIndexRec;
    PStrIndex = ^TStrIndex;
 
    TStringList = OBJECT (TObject)
       Constructor Load (Var S: TStream);
       Destructor Done; Virtual;
       Function Get (Key: Sw_Word): String;
    END;
    PStringList = ^TStringList;

TStringList.Load

Declaration:
Constructor TstringList.Load (Var S: TStream);
Description:
The Load constructor reads the TStringList object from the stream S. It also reads the descriptions of the strings from the stream. The string descriptions are stored as an array of TstrIndexrec records, where each record describes a string on the stream. These records are kept in memory.
Errors:
If an error occurs, a stream error is triggered.
See also:
Done (640)

TStringList.Done

Declaration:
Destructor TstringList.Done; Virtual;
Description:
The Done destructor frees the memory occupied by the string descriptions, and destroys the object.
Errors:
None.
See also:
Load (640), TObject.Done (564)

TStringList.Get

Declaration:
Function TStringList.Get (Key: Sw_Word): String;
Description:
Get reads the string with key Key from the list of strings on the stream, and returns this string. If there is no string with such a key, an empty string is returned.
Errors:
If no string with key Key is found, an empty string is returned. A stream error may result if the stream doesn’t contain the needed strings.
See also:
TStrListMaker.Put (642)