Class TStringPairVector

Unit

Declaration

type TStringPairVector = class(TObjectVector)

Description

List of string pairs. This class contains only non-nil objects of class TStringPair.

Using this class instead of TStringList (with it's Name and Value properties) is often better, because this allows both Name and Value of each pair to safely contain any special characters (including '=' and newline markers). It's also faster, since it doesn't try to encode Name and Value into one string.

Hierarchy

Overview

Methods

Public function Text(const NameValueSepapator, ItemSeparator: string): string;
Public function FindName(const Name: string; IgnoreCase: boolean = true): Integer;
Public function DeleteName(const Name: string; IgnoreCase: boolean = true): boolean;
Public procedure LoadFromBinaryStream(Stream: TStream);
Public procedure SaveToBinaryStream(Stream: TStream);
Public function FirstName: string;

Properties

Public property Items[i:Integer]: TStringPair read GetItems write SetItems;

Description

Methods

Public function Text(const NameValueSepapator, ItemSeparator: string): string;

Returns all items Names and Values glued together. For every item, string Name + NameValueSepapator + Value is constructed. Then all such strings for every items all concatenated with ItemSeparator.

Remember that the very idea of TStringPair and TStringPairVector is that Name and Value strings may contain any special characters, including things you give here as NameValueSepapator and ItemSeparator. So it's practically impossible to later convert such Text back to items and Names/Value pairs.

Public function FindName(const Name: string; IgnoreCase: boolean = true): Integer;

Finds a string pair with given Name. Returns -1 if not found.

Public function DeleteName(const Name: string; IgnoreCase: boolean = true): boolean;

Removes first string pair with given Name. Returns if some pair was removed.

Public procedure LoadFromBinaryStream(Stream: TStream);

Load from a stream using the binary format. For each item, it's Name and Value are saved. (TStringPair.Data pointers are not saved.)

Public procedure SaveToBinaryStream(Stream: TStream);

Save to a stream, in a format readable by LoadFromBinaryStream.

Public function FirstName: string;

Name of first item, or '' if list empty.

Properties

Public property Items[i:Integer]: TStringPair read GetItems write SetItems;
 

Generated by PasDoc 0.15.0.