From 33bd5edc31756827b81f3ce72f00e4ba4f0ec23d Mon Sep 17 00:00:00 2001 From: peter Date: Mon, 6 Mar 2006 09:29:08 +0000 Subject: [PATCH] * add TFPLIst.ForEachCall() git-svn-id: trunk@2780 - --- fcl/inc/contnrs.pp | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/fcl/inc/contnrs.pp b/fcl/inc/contnrs.pp index f8c388dfa4..b11dc8c82f 100644 --- a/fcl/inc/contnrs.pp +++ b/fcl/inc/contnrs.pp @@ -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;