IROStrings

Overview

The IROStrings interface wraps access to a Delphi TStrings instance to provide a reference-counted, interface-based reference that can be freed automatically as it goes out of scope. IROStrings exposes all the basic methods and properties of TStrings, and also exposes the underlying wrapped object via the Strings property. Use one of the overloads of the global NewROStrings function to instantiate a new IROStrings instance.

Location


 

Add

Adds a string to the list and returns the index of the new string.

function Add(const aString: string): Integer

Parameters:

  • aString: string that should be inserted.

AddObject

Adds a string to the list and associates an object with the string. It returns the index of the new string and object.

function AddObject(const aString: string; aObject: TObject): Integer

Parameters:

  • aString: string that should be inserted.
  • aObject: object that should be inserted.

AddStrings

Adds a group of strings to the list.

procedure AddStrings(aList: TStrings)

Parameters:

  • aList: a group of strings

Clear

Deletes all the strings from the list. All references to associated objects are also removed. However, the objects themselves are not freed.

procedure Clear

CommaText

The strings in the TStrings object in system data format (SDF).

property CommaText: string read write

Count

The number of strings in the list

property Count: Integer read

CustomSort

Sorts the strings in the list for which the sort order is defined by the Compare parameter.

procedure CustomSort(Compare: TStringListSortCompare)

Parameters:

  • Compare: function for comparing.

Delete

Deletes a specified string from the list.

procedure Delete(Index: Integer)

Parameters:

  • Index: position

Duplicates

Describes what to do in case a duplicate value is added to the list:

  • dupIgnore - Duplicate values will not be be added to the list, but no error will be triggered.
  • dupError - If an attempt is made to add a duplicate value to the list, an EStringListError exception is raised.
  • dupAccept - Duplicate values can be added to the list. If the string list is not sorted, the Duplicates setting is ignored.
property Duplicates: TDuplicates read write

ExtractValue

Returns the string associated with the given name and deletes it from the list, on strings that are name-value pairs.

function ExtractValue(const aName: string): string

Parameters:

  • aName: the given name

Find

Locates the index for a string in a sorted list.

function Find(const aString: string): Integer

Parameters:

  • aString: the given string

IndexOf

Returns the position of a string in the list.

function IndexOf(const aString: string): Integer

Parameters:

  • aString: string whose index will be returned.

IndexOfName

Returns the position of the first name-value pair with the specified name.

function IndexOfName(const aName: string): Integer

Parameters:

  • aName: specified name

Insert

Inserts the string S into the list at the position specified by the Index.

procedure Insert(Index: Integer; const S: string)

Parameters:

  • Index: position
  • S: string that should be inserted

InsertObject

Inserts the string S into the list at the position identified by the Index, and associates it with the object AObject.

procedure InsertObject(Index: Integer; const S: string; AObject: TObject)

Parameters:

  • Index: position
  • S: string that should be inserted
  • AObject: object that should be inserted

Names

The name part of strings that are name-value pairs.

property Names[Index: Integer]: string read

Objects

The object associated with the string at the specified index.

property Objects[Index: Integer]: TObject read write

RenameName

Sets a new name for name-value pairs specified in aName parameter. This function is useful when you want to change a register of some letters.

function RenameName(const aName: string): Boolean

Parameters:

  • aName: a new name

Sorted

Determines whether the strings in the list should be sorted automatically.

property Sorted: Boolean read write

StringAccess

Associates a string at a particular position Index.

property StringAccess[Index: Integer]: string read write

Strings

Access to the TStrings object.

property Strings: TStrings read

Text

All the strings in the TStrings object in a single string delimited by carriage return, line feed pairs.

property Text: string read write

Values

Associates a string with a given name, on strings that are name-value pairs.

property Values[aName: string]: string read write

 

CommaText

The strings in the TStrings object in system data format (SDF).

property CommaText: string read write

Count

The number of strings in the list

property Count: Integer read

Duplicates

Describes what to do in case a duplicate value is added to the list:

  • dupIgnore - Duplicate values will not be be added to the list, but no error will be triggered.
  • dupError - If an attempt is made to add a duplicate value to the list, an EStringListError exception is raised.
  • dupAccept - Duplicate values can be added to the list. If the string list is not sorted, the Duplicates setting is ignored.
property Duplicates: TDuplicates read write

Names

The name part of strings that are name-value pairs.

property Names[Index: Integer]: string read

Objects

The object associated with the string at the specified index.

property Objects[Index: Integer]: TObject read write

Sorted

Determines whether the strings in the list should be sorted automatically.

property Sorted: Boolean read write

StringAccess

Associates a string at a particular position Index.

property StringAccess[Index: Integer]: string read write

Strings

Access to the TStrings object.

property Strings: TStrings read

Text

All the strings in the TStrings object in a single string delimited by carriage return, line feed pairs.

property Text: string read write

Values

Associates a string with a given name, on strings that are name-value pairs.

property Values[aName: string]: string read write

 

Add

Adds a string to the list and returns the index of the new string.

function Add(const aString: string): Integer

Parameters:

  • aString: string that should be inserted.

AddObject

Adds a string to the list and associates an object with the string. It returns the index of the new string and object.

function AddObject(const aString: string; aObject: TObject): Integer

Parameters:

  • aString: string that should be inserted.
  • aObject: object that should be inserted.

AddStrings

Adds a group of strings to the list.

procedure AddStrings(aList: TStrings)

Parameters:

  • aList: a group of strings

Clear

Deletes all the strings from the list. All references to associated objects are also removed. However, the objects themselves are not freed.

procedure Clear

CustomSort

Sorts the strings in the list for which the sort order is defined by the Compare parameter.

procedure CustomSort(Compare: TStringListSortCompare)

Parameters:

  • Compare: function for comparing.

Delete

Deletes a specified string from the list.

procedure Delete(Index: Integer)

Parameters:

  • Index: position

ExtractValue

Returns the string associated with the given name and deletes it from the list, on strings that are name-value pairs.

function ExtractValue(const aName: string): string

Parameters:

  • aName: the given name

Find

Locates the index for a string in a sorted list.

function Find(const aString: string): Integer

Parameters:

  • aString: the given string

IndexOf

Returns the position of a string in the list.

function IndexOf(const aString: string): Integer

Parameters:

  • aString: string whose index will be returned.

IndexOfName

Returns the position of the first name-value pair with the specified name.

function IndexOfName(const aName: string): Integer

Parameters:

  • aName: specified name

Insert

Inserts the string S into the list at the position specified by the Index.

procedure Insert(Index: Integer; const S: string)

Parameters:

  • Index: position
  • S: string that should be inserted

InsertObject

Inserts the string S into the list at the position identified by the Index, and associates it with the object AObject.

procedure InsertObject(Index: Integer; const S: string; AObject: TObject)

Parameters:

  • Index: position
  • S: string that should be inserted
  • AObject: object that should be inserted

RenameName

Sets a new name for name-value pairs specified in aName parameter. This function is useful when you want to change a register of some letters.

function RenameName(const aName: string): Boolean

Parameters:

  • aName: a new name