mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-03 20:50:39 +02:00
* add TFPLIst.ForEachCall()
git-svn-id: trunk@2780 -
This commit is contained in:
parent
5d6a002de0
commit
33bd5edc31
@ -14,6 +14,8 @@
|
||||
{$mode objfpc}
|
||||
{$endif}
|
||||
{$H+}
|
||||
{$ifdef CLASSESINLINE}{$inline on}{$endif}
|
||||
|
||||
unit contnrs;
|
||||
|
||||
interface
|
||||
@ -23,9 +25,6 @@ uses
|
||||
|
||||
|
||||
Type
|
||||
|
||||
{$inline on}
|
||||
|
||||
TFPObjectList = class(TObject)
|
||||
private
|
||||
FFreeObjects : Boolean;
|
||||
@ -33,8 +32,8 @@ Type
|
||||
function GetCount: integer;
|
||||
procedure SetCount(const AValue: integer);
|
||||
protected
|
||||
function GetItem(Index: Integer): TObject; {$ifdef HASINLINE} inline;{$endif}
|
||||
procedure SetItem(Index: Integer; AObject: TObject); {$ifdef HASINLINE} inline;{$endif}
|
||||
function GetItem(Index: Integer): TObject; {$ifdef CLASSESINLINE}inline;{$endif}
|
||||
procedure SetItem(Index: Integer; AObject: TObject); {$ifdef CLASSESINLINE}inline;{$endif}
|
||||
procedure SetCapacity(NewCapacity: Integer);
|
||||
function GetCapacity: integer;
|
||||
public
|
||||
@ -42,15 +41,15 @@ Type
|
||||
constructor Create(FreeObjects : Boolean);
|
||||
destructor Destroy; override;
|
||||
procedure Clear;
|
||||
function Add(AObject: TObject): Integer; {$ifdef HASINLINE} inline;{$endif}
|
||||
procedure Delete(Index: Integer); {$ifdef HASINLINE} inline;{$endif}
|
||||
function Add(AObject: TObject): Integer; {$ifdef CLASSESINLINE}inline;{$endif}
|
||||
procedure Delete(Index: Integer); {$ifdef CLASSESINLINE}inline;{$endif}
|
||||
procedure Exchange(Index1, Index2: Integer);
|
||||
function Expand: TFPObjectList;
|
||||
function Extract(Item: TObject): TObject;
|
||||
function Remove(AObject: TObject): Integer;
|
||||
function IndexOf(AObject: TObject): Integer;
|
||||
function FindInstanceOf(AClass: TClass; AExact: Boolean; AStartAt: Integer): Integer;
|
||||
procedure Insert(Index: Integer; AObject: TObject); {$ifdef HASINLINE} inline;{$endif}
|
||||
procedure Insert(Index: Integer; AObject: TObject); {$ifdef CLASSESINLINE}inline;{$endif}
|
||||
function First: TObject;
|
||||
function Last: TObject;
|
||||
procedure Move(CurIndex, NewIndex: Integer);
|
||||
@ -312,12 +311,12 @@ begin
|
||||
FList.Count := AValue;
|
||||
end;
|
||||
|
||||
function TFPObjectList.GetItem(Index: Integer): TObject; {$ifdef HASINLINE} inline;{$endif}
|
||||
function TFPObjectList.GetItem(Index: Integer): TObject; {$ifdef CLASSESINLINE}inline;{$endif}
|
||||
begin
|
||||
Result := TObject(FList[Index]);
|
||||
end;
|
||||
|
||||
procedure TFPObjectList.SetItem(Index: Integer; AObject: TObject); {$ifdef HASINLINE} inline;{$endif}
|
||||
procedure TFPObjectList.SetItem(Index: Integer; AObject: TObject); {$ifdef CLASSESINLINE}inline;{$endif}
|
||||
begin
|
||||
if OwnsObjects then
|
||||
TObject(FList[Index]).Free;
|
||||
@ -334,12 +333,12 @@ begin
|
||||
Result := FList.Capacity;
|
||||
end;
|
||||
|
||||
function TFPObjectList.Add(AObject: TObject): Integer; {$ifdef HASINLINE} inline;{$endif}
|
||||
function TFPObjectList.Add(AObject: TObject): Integer; {$ifdef CLASSESINLINE}inline;{$endif}
|
||||
begin
|
||||
Result := FList.Add(AObject);
|
||||
end;
|
||||
|
||||
procedure TFPObjectList.Delete(Index: Integer); {$ifdef HASINLINE} inline;{$endif}
|
||||
procedure TFPObjectList.Delete(Index: Integer); {$ifdef CLASSESINLINE}inline;{$endif}
|
||||
begin
|
||||
if OwnsObjects then
|
||||
TObject(FList[Index]).Free;
|
||||
@ -398,7 +397,7 @@ begin
|
||||
Inc(I);
|
||||
end;
|
||||
|
||||
procedure TFPObjectList.Insert(Index: Integer; AObject: TObject); {$ifdef HASINLINE} inline;{$endif}
|
||||
procedure TFPObjectList.Insert(Index: Integer; AObject: TObject); {$ifdef CLASSESINLINE}inline;{$endif}
|
||||
begin
|
||||
FList.Insert(Index, Pointer(AObject));
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user