Data Types

This commit is contained in:
Michael Schimmel
2025-08-25 18:00:15 +02:00
parent 42110e8471
commit 947060566d
11 changed files with 642 additions and 28 deletions
+17
View File
@@ -21,6 +21,9 @@ type
implementation
uses
System.Rtti;
type
TDataTextValue = class(TInterfacedObject, IDataValue, IDataTextValue)
private
@@ -28,6 +31,7 @@ type
function GetDataType: IDataType;
function GetAsString: string;
function GetValue: string;
function AsTValue: TValue;
public
constructor Create(const AValue: string);
end;
@@ -37,11 +41,13 @@ type
strict private
class var
FSingleton: IDataTextValue;
FEmptyTValue: TValue;
class constructor CreateClass;
private
function GetDataType: IDataType;
function GetAsString: string;
function GetValue: string;
function AsTValue: TValue;
public
class property Singleton: IDataTextValue read FSingleton;
end;
@@ -95,11 +101,17 @@ begin
Result := FValue;
end;
function TDataTextValue.AsTValue: TValue;
begin
Result := TValue.From<string>(FValue);
end;
{ TDataTextValueEmpty }
class constructor TDataTextValueEmpty.CreateClass;
begin
FSingleton := TDataTextValueEmpty.Create;
FEmptyTValue := TValue.From<string>('');
end;
function TDataTextValueEmpty.GetAsString: string;
@@ -117,4 +129,9 @@ begin
Result := '';
end;
function TDataTextValueEmpty.AsTValue: TValue;
begin
Result := FEmptyTValue;
end;
end.