mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-19 13:19:37 +02:00
+ add TRttiOrdinalType and TRttiInt64Type (what's left of the "ordinal like" ones is TRttiEnumerationType, TRttiSetType and a non-Delphi compatible TRttiBooleanType (due to FPC supporting multiple Boolean types))
git-svn-id: trunk@42719 -
This commit is contained in:
parent
92c6d166a8
commit
7d9b249def
@ -255,6 +255,31 @@ type
|
||||
property FloatType: TFloatType read GetFloatType;
|
||||
end;
|
||||
|
||||
TRttiOrdinalType = class(TRttiType)
|
||||
private
|
||||
function GetMaxValue: LongInt; inline;
|
||||
function GetMinValue: LongInt; inline;
|
||||
function GetOrdType: TOrdType; inline;
|
||||
protected
|
||||
function GetTypeSize: Integer; override;
|
||||
public
|
||||
property OrdType: TOrdType read GetOrdType;
|
||||
property MinValue: LongInt read GetMinValue;
|
||||
property MaxValue: LongInt read GetMaxValue;
|
||||
end;
|
||||
|
||||
TRttiInt64Type = class(TRttiType)
|
||||
private
|
||||
function GetMaxValue: Int64; inline;
|
||||
function GetMinValue: Int64; inline;
|
||||
function GetUnsigned: Boolean; inline;
|
||||
protected
|
||||
function GetTypeSize: integer; override;
|
||||
public
|
||||
property MinValue: Int64 read GetMinValue;
|
||||
property MaxValue: Int64 read GetMaxValue;
|
||||
property Unsigned: Boolean read GetUnsigned;
|
||||
end;
|
||||
|
||||
TRttiStringKind = (skShortString, skAnsiString, skWideString, skUnicodeString);
|
||||
|
||||
@ -1051,7 +1076,6 @@ begin
|
||||
for cc := Low(TCallConv) to High(TCallConv) do
|
||||
FuncCallMgr[cc] := NoFunctionCallManager;
|
||||
end;
|
||||
|
||||
{ TRttiPool }
|
||||
|
||||
function TRttiPool.GetTypes: specialize TArray<TRttiType>;
|
||||
@ -1094,6 +1118,11 @@ begin
|
||||
tkClass : Result := TRttiInstanceType.Create(ATypeInfo);
|
||||
tkInterface: Result := TRttiRefCountedInterfaceType.Create(ATypeInfo);
|
||||
tkInterfaceRaw: Result := TRttiRawInterfaceType.Create(ATypeInfo);
|
||||
tkInt64,
|
||||
tkQWord: Result := TRttiInt64Type.Create(ATypeInfo);
|
||||
tkInteger,
|
||||
tkChar,
|
||||
tkWChar: Result := TRttiOrdinalType.Create(ATypeInfo);
|
||||
tkSString,
|
||||
tkLString,
|
||||
tkAString,
|
||||
@ -2643,6 +2672,63 @@ begin
|
||||
Result := FParams;
|
||||
end;
|
||||
|
||||
{ TRttiInt64Type }
|
||||
|
||||
function TRttiInt64Type.GetMaxValue: Int64;
|
||||
begin
|
||||
Result := FTypeData^.MaxInt64Value;
|
||||
end;
|
||||
|
||||
function TRttiInt64Type.GetMinValue: Int64;
|
||||
begin
|
||||
Result := FTypeData^.MinInt64Value;
|
||||
end;
|
||||
|
||||
function TRttiInt64Type.GetUnsigned: Boolean;
|
||||
begin
|
||||
Result := FTypeData^.OrdType = otUQWord;
|
||||
end;
|
||||
|
||||
function TRttiInt64Type.GetTypeSize: integer;
|
||||
begin
|
||||
Result := SizeOf(QWord);
|
||||
end;
|
||||
|
||||
{ TRttiOrdinalType }
|
||||
|
||||
function TRttiOrdinalType.GetMaxValue: LongInt;
|
||||
begin
|
||||
Result := FTypeData^.MaxValue;
|
||||
end;
|
||||
|
||||
function TRttiOrdinalType.GetMinValue: LongInt;
|
||||
begin
|
||||
Result := FTypeData^.MinValue;
|
||||
end;
|
||||
|
||||
function TRttiOrdinalType.GetOrdType: TOrdType;
|
||||
begin
|
||||
Result := FTypeData^.OrdType;
|
||||
end;
|
||||
|
||||
function TRttiOrdinalType.GetTypeSize: Integer;
|
||||
begin
|
||||
case OrdType of
|
||||
otSByte,
|
||||
otUByte:
|
||||
Result := SizeOf(Byte);
|
||||
otSWord,
|
||||
otUWord:
|
||||
Result := SizeOf(Word);
|
||||
otSLong,
|
||||
otULong:
|
||||
Result := SizeOf(LongWord);
|
||||
otSQWord,
|
||||
otUQWord:
|
||||
Result := SizeOf(QWord);
|
||||
end;
|
||||
end;
|
||||
|
||||
{ TRttiFloatType }
|
||||
|
||||
function TRttiFloatType.GetFloatType: TFloatType;
|
||||
|
Loading…
Reference in New Issue
Block a user