Files
MycLib/Src/Data/Myc.Data.Types.Float.pas
T
Michael Schimmel ce653c83b1 Data Types next
2025-08-25 14:01:22 +02:00

80 lines
1.7 KiB
ObjectPascal

unit Myc.Data.Types.Float;
interface
uses
System.SysUtils,
Myc.Data.Types;
type
// Implements the float data value.
TImplDataFloatValue = class(TInterfacedObject, IDataValue, IDataFloatValue)
private
FValue: Double;
public
constructor Create(const AValue: Double);
// IDataValue
function GetDataType: IDataType;
// IDataFloatValue
function GetValue: Double;
end;
// Implements the float data type.
TImplDataFloatType = class(TInterfacedObject, IDataType, IDataFloatType)
strict private
class var
FSingleton: IDataFloatType;
class constructor CreateClass;
public
function GetName: String;
function GetKind: TDataKind;
function CreateValue(Init: Double): IDataFloatValue;
class property Singleton: IDataFloatType read FSingleton;
end;
implementation
{ TImplDataFloatValue }
constructor TImplDataFloatValue.Create(const AValue: Double);
begin
inherited Create;
FValue := AValue;
end;
function TImplDataFloatValue.GetDataType: IDataType;
begin
Result := TImplDataFloatType.Singleton;
end;
function TImplDataFloatValue.GetValue: Double;
begin
Result := FValue;
end;
{ TImplDataFloatType }
class constructor TImplDataFloatType.CreateClass;
begin
FSingleton := TImplDataFloatType.Create;
end;
function TImplDataFloatType.GetName: String;
begin
Result := 'Float';
end;
function TImplDataFloatType.GetKind: TDataKind;
begin
Result := dkFloat;
end;
function TImplDataFloatType.CreateValue(Init: Double): IDataFloatValue;
begin
Result := TImplDataFloatValue.Create(Init);
end;
end.