Browse Source

* add TFPHashList.FindIndexOf

git-svn-id: trunk@5906 -
peter 18 years ago
parent
commit
a526430509
1 changed files with 16 additions and 0 deletions
  1. 16 0
      compiler/cclasses.pas

+ 16 - 0
compiler/cclasses.pas

@@ -221,6 +221,7 @@ type
     function Extract(item: Pointer): Pointer;
     function IndexOf(Item: Pointer): Integer;
     function Find(const AName:string): Pointer;
+    function FindIndexOf(const AName:string): Integer;
     function FindWithHash(const AName:string;AHash:LongWord): Pointer;
     function Rename(const AOldName,ANewName:string): Integer;
     function Remove(Item: Pointer): Integer;
@@ -287,6 +288,7 @@ type
     function Remove(AObject: TObject): Integer;
     function IndexOf(AObject: TObject): Integer; {$ifdef CCLASSESINLINE}inline;{$endif}
     function Find(const s:string): TObject; {$ifdef CCLASSESINLINE}inline;{$endif}
+    function FindIndexOf(const s:string): Integer; {$ifdef CCLASSESINLINE}inline;{$endif}
     function FindWithHash(const AName:string;AHash:LongWord): Pointer;
     function Rename(const AOldName,ANewName:string): Integer; {$ifdef CCLASSESINLINE}inline;{$endif}
     function FindInstanceOf(AClass: TClass; AExact: Boolean; AStartAt: Integer): Integer;
@@ -1364,6 +1366,14 @@ begin
 end;
 
 
+function TFPHashList.FindIndexOf(const AName:string): Integer;
+var
+  PrevIndex : Integer;
+begin
+  Result:=InternalFind(FPHash(AName),AName,PrevIndex);
+end;
+
+
 function TFPHashList.FindWithHash(const AName:string;AHash:LongWord): Pointer;
 var
   Index,
@@ -1692,6 +1702,12 @@ begin
 end;
 
 
+function TFPHashObjectList.FindIndexOf(const s:string): Integer;
+begin
+  result:=FHashList.FindIndexOf(s);
+end;
+
+
 function TFPHashObjectList.FindWithHash(const AName:string;AHash:LongWord): Pointer;
 begin
   Result:=TObject(FHashList.FindWithHash(AName,AHash));