[prev] [prev-tail] [tail] [up]

### 17.18 TStrListMaker

The TStrListMaker object can be used to generate a stream with strings, which can be read with the TStringList object. If you register this object with the RegisterType (549) function, you cannot register the TStringList object.

This is the public declaration of the TStrListMaker object:

     TYPE
        TStrListMaker = OBJECT (TObject)
           Constructor Init (AStrSize, AIndexSize: Sw_Word);
           Destructor Done; Virtual;
           Procedure Put (Key: SwWord; S: String);
           Procedure Store (Var S: TStream);
        END;
        PStrListMaker = ^TStrListMaker;

#### TStrListMaker.Init

Declaration:
  Constructor TStrListMaker.Init (AStrSize, AIndexSize: SwWord);
Description:
  The Init constructor creates a new instance of the TstrListMaker object. It allocates AStrSize bytes on the heap to hold all the strings you wish to store. It also allocates enough room for AIndexSize key description entries (of the type TStrIndexrec).

  AStrSize must be large enough to contain all the strings you wish to store. If not enough memory is allocated, other memory will be overwritten. The same is true for AIndexSize : maximally AIndexSize strings can be written to the stream.

Errors:
  None.
See also:
  TObject.Init (563), Done (642)

#### TStrListMaker.Done

Declaration:
  Destructor TStrListMaker.Done; Virtual;
Description:
  The Done destructor de-allocates the memory for the index description records and the string data, and then destroys the object.
Errors:
  None.
See also:
  TObject.Done (564), Init (642)

#### TStrListMaker.Put

Declaration:
  Procedure TStrListMaker.Put (Key: Sw_Word; S: String);
Description:
  Put adds they string S with key Key to the collection of strings. This action doesn’t write the string to a stream. To write the strings to the stream, see the Store (643) method.
Errors:
  None.
See also:
  Store (643).

#### TStrListMaker.Store

Declaration:
  Procedure TStrListMaker.Store (Var S: TStream);
Description:
  Store writes the collection of strings to the stream S. The collection can then be read with the TStringList object.
Errors:
  A stream error may occur when writing the strings to the stream.
See also:
  TStringList.Load (640), Put (642).

[prev] [prev-tail] [front] [up]