mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-07 21:28:03 +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
|
||||
****************************************************************************}
|
||||
|
||||
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;
|
||||
begin
|
||||
@ -1863,3 +1897,4 @@ begin
|
||||
end;
|
||||
|
||||
{$ENDIF}
|
||||
|
||||
|
@ -210,6 +210,13 @@
|
||||
TMethod = record
|
||||
Code : CodePointer;
|
||||
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;
|
||||
|
||||
// "Maximum" available stringtype : Shortstring, AnsiString or WideString
|
||||
|
Loading…
Reference in New Issue
Block a user