Răsfoiți Sursa

+ add = and <> operators to TValue based on the existing SameValue()

Sven/Sarah Barth 1 zi în urmă
părinte
comite
20022beca8
1 a modificat fișierele cu 12 adăugiri și 0 ștergeri
  1. 12 0
      packages/rtl-objpas/src/inc/rtti.pp

+ 12 - 0
packages/rtl-objpas/src/inc/rtti.pp

@@ -286,6 +286,8 @@ type
     class operator := (AValue: TDateTime): TValue; inline;
     class operator := (AValue: TDate): TValue; inline;
     class operator := (AValue: TTime): TValue; inline;
+    class operator = (const ALeft, ARight: TValue): Boolean; inline;
+    class operator <> (const ALeft, ARight: TValue): Boolean; inline;
     property DataSize: SizeInt read GetDataSize;
     property Kind: TTypeKind read GetTypeKind;
     property TypeData: PTypeData read GetTypeDataProp;
@@ -2797,6 +2799,16 @@ begin
   Make(@AValue, System.TypeInfo(TTime), Result);
 end;
 
+class operator TValue.= (const ALeft, ARight: TValue): Boolean;
+begin
+  Result := SameValue(ALeft, ARight);
+end;
+
+class operator TValue.<> (const ALeft, ARight: TValue): Boolean;
+begin
+  Result := not SameValue(ALeft, ARight);
+end;
+
 function TValue.AsString: string;
 begin
   if System.GetTypeKind(String) = tkUString then