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

74 lines
1.6 KiB
ObjectPascal

unit Myc.Data.Types.Text;
interface
uses
System.SysUtils,
Myc.Data.Types;
type
TImplDataTextType = class(TInterfacedObject, IDataType, IDataTextType)
strict private
class var
FSingleton: IDataTextType;
class constructor CreateClass;
public
function GetName: String;
function GetKind: TDataKind;
function CreateValue(const AValue: string): IDataTextValue;
class property Singleton: IDataTextType read FSingleton;
end;
TImplDataTextValue = class(TInterfacedObject, IDataValue, IDataTextValue)
private
FValue: string;
function GetDataType: IDataType;
function GetValue: string;
public
constructor Create(const AValue: string);
end;
implementation
{ TImplDataTextType }
class constructor TImplDataTextType.CreateClass;
begin
FSingleton := TImplDataTextType.Create;
end;
function TImplDataTextType.CreateValue(const AValue: string): IDataTextValue;
begin
Result := TImplDataTextValue.Create(AValue);
end;
function TImplDataTextType.GetName: String;
begin
Result := 'Text';
end;
function TImplDataTextType.GetKind: TDataKind;
begin
Result := dkText;
end;
{ TImplDataTextValue }
constructor TImplDataTextValue.Create(const AValue: string);
begin
inherited Create;
FValue := AValue;
end;
function TImplDataTextValue.GetDataType: IDataType;
begin
Result := TImplDataTextType.Singleton;
end;
function TImplDataTextValue.GetValue: string;
begin
Result := FValue;
end;
end.