mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-15 21:09:27 +02:00
* Add operators to TMethod, for Delphi compatibility
This commit is contained in:
parent
bc714c0fd7
commit
30a20cc209
@ -1396,6 +1396,40 @@ end;
|
|||||||
Various Delphi constructs
|
Various Delphi constructs
|
||||||
****************************************************************************}
|
****************************************************************************}
|
||||||
|
|
||||||
|
class operator TMethod.=(const aLeft, aRight: TMethod): Boolean; inline;
|
||||||
|
begin
|
||||||
|
Result:=(aLeft.Data=aRight.Data) and (aLeft.Code=aRight.Code);
|
||||||
|
end;
|
||||||
|
|
||||||
|
class operator TMethod.<>(const aLeft, aRight: TMethod): Boolean; inline;
|
||||||
|
begin
|
||||||
|
Result:=(aLeft.Data<>aRight.Data) or (aLeft.Code<>aRight.Code);
|
||||||
|
end;
|
||||||
|
|
||||||
|
class operator TMethod.>(const aLeft, aRight: TMethod): Boolean; inline;
|
||||||
|
begin
|
||||||
|
Result:=(PtrUInt(aLeft.Data)>PtrUInt(aRight.Data))
|
||||||
|
or
|
||||||
|
((aLeft.Data=aRight.Data) and (PtrUInt(aLeft.Code)>PtrUint(aRight.Code)));
|
||||||
|
end;
|
||||||
|
|
||||||
|
class operator TMethod.>=(const aLeft, aRight: TMethod): Boolean; inline;
|
||||||
|
begin
|
||||||
|
Result:=(aLeft>aRight) or (aLeft=aRight);
|
||||||
|
end;
|
||||||
|
|
||||||
|
class operator TMethod.<(const aLeft, aRight: TMethod): Boolean; inline;
|
||||||
|
begin
|
||||||
|
Result:=(PtrUInt(aLeft.Data)<PtrUInt(aRight.Data))
|
||||||
|
or
|
||||||
|
((aLeft.Data=aRight.Data) and (PtrUInt(aLeft.Code)<PtrUint(aRight.Code)));
|
||||||
|
end;
|
||||||
|
|
||||||
|
class operator TMethod.<=(const aLeft, aRight: TMethod): Boolean; inline;
|
||||||
|
begin
|
||||||
|
Result:=(aLeft<aRight) or (aLeft=aRight);
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
function TPtrWrapper.ToPointer: Pointer;
|
function TPtrWrapper.ToPointer: Pointer;
|
||||||
begin
|
begin
|
||||||
@ -1863,3 +1897,4 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
|
@ -210,6 +210,13 @@
|
|||||||
TMethod = record
|
TMethod = record
|
||||||
Code : CodePointer;
|
Code : CodePointer;
|
||||||
Data : Pointer;
|
Data : Pointer;
|
||||||
|
public
|
||||||
|
class operator =(const aLeft, aRight: TMethod): Boolean; inline;
|
||||||
|
class operator <>(const aLeft, aRight: TMethod): Boolean; inline;
|
||||||
|
class operator >(const aLeft, aRight: TMethod): Boolean; inline;
|
||||||
|
class operator >=(const aLeft, aRight: TMethod): Boolean; inline;
|
||||||
|
class operator <(const aLeft, aRight: TMethod): Boolean; inline;
|
||||||
|
class operator <=(const aLeft, aRight: TMethod): Boolean; inline;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// "Maximum" available stringtype : Shortstring, AnsiString or WideString
|
// "Maximum" available stringtype : Shortstring, AnsiString or WideString
|
||||||
|
Loading…
Reference in New Issue
Block a user