Data Types
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user