Generic indicator factory

This commit is contained in:
Michael Schimmel
2025-07-27 21:58:15 +02:00
parent 7842c3bd87
commit 78e89f345e
4 changed files with 85 additions and 51 deletions
+2 -11
View File
@@ -35,7 +35,6 @@ type
procedure Copy(Src, Dst: Pointer);
function GetSize: Integer; inline;
function GetAlignedSize: Integer; inline;
public
@@ -44,7 +43,7 @@ type
property FieldType: TFieldType read FFieldType;
property Name: string read FName;
property Size: Integer read GetSize;
property Size: Integer read FSize;
property AlignedSize: Integer read GetAlignedSize;
property TypeInfo: PTypeInfo read FTypeInfo;
end;
@@ -286,17 +285,9 @@ begin
Copy(@Src, @Buffer[FOffset]);
end;
function TDataRecord.TField.GetSize: Integer;
const
DataSize: array[TDataRecord.TFieldType] of Integer =
(sizeof(Double), sizeof(Int64), sizeof(String), sizeof(TDateTime), sizeof(TDataRecord));
begin
Result := DataSize[FFieldType];
end;
function TDataRecord.TField.GetAlignedSize: Integer;
begin
Result := (GetSize + (Align - 1)) and not (Align - 1);
Result := (FSize + (Align - 1)) and not (Align - 1);
end;
procedure TDataRecord.TField.ToType(const [ref] Buffer: TBytes; var Dst);