Selaa lähdekoodia

* 2 Patches from Silvio Clecio

git-svn-id: trunk@32947 -
michael 9 vuotta sitten
vanhempi
commit
4e7115a956
1 muutettua tiedostoa jossa 8 lisäystä ja 2 poistoa
  1. 8 2
      rtl/objpas/fgl.pp

+ 8 - 2
rtl/objpas/fgl.pp

@@ -305,7 +305,8 @@ type
     function Add(const AKey: TKey; const AData: TData): Integer; {$ifdef CLASSESINLINE} inline; {$endif}
     function Add(const AKey: TKey): Integer; {$ifdef CLASSESINLINE} inline; {$endif}
     function Find(const AKey: TKey; out Index: Integer): Boolean; {$ifdef CLASSESINLINE} inline; {$endif}
-    function TryGetValue(const AKey: TKey; out AData: TData): Boolean; {$ifdef CLASSESINLINE} inline; {$endif}
+    function TryGetData(const AKey: TKey; out AData: TData): Boolean; {$ifdef CLASSESINLINE} inline; {$endif}
+    procedure AddOrSetData(const AKey: TKey; const AData: TData); {$ifdef CLASSESINLINE} inline; {$endif}
     function IndexOf(const AKey: TKey): Integer; {$ifdef CLASSESINLINE} inline; {$endif}
     function IndexOfData(const AData: TData): Integer;
     procedure InsertKey(Index: Integer; const AKey: TKey);
@@ -1482,7 +1483,7 @@ begin
   Result := inherited Find(@AKey, Index);
 end;
 
-function TFPGMap.TryGetValue(const AKey: TKey; out AData: TData): Boolean;
+function TFPGMap.TryGetData(const AKey: TKey; out AData: TData): Boolean;
 var
   I: Integer;
 begin
@@ -1493,6 +1494,11 @@ begin
     AData := Default(TData);
 end;
 
+procedure TFPGMap.AddOrSetData(const AKey: TKey; const AData: TData);
+begin
+  inherited PutKeyData(@AKey, @AData);
+end;
+
 function TFPGMap.IndexOf(const AKey: TKey): Integer;
 begin
   Result := inherited IndexOf(@AKey);