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