Data Types next
This commit is contained in:
@@ -0,0 +1,73 @@
|
||||
unit Myc.Data.Types.Timestamp;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
System.SysUtils,
|
||||
Myc.Data.Types;
|
||||
|
||||
type
|
||||
TImplDataTimestampType = class(TInterfacedObject, IDataType, IDataTimestampType)
|
||||
strict private
|
||||
class var
|
||||
FSingleton: IDataTimestampType;
|
||||
class constructor CreateClass;
|
||||
public
|
||||
function GetName: String;
|
||||
function GetKind: TDataKind;
|
||||
function CreateValue(const AValue: TDateTime): IDataTimestampValue;
|
||||
class property Singleton: IDataTimestampType read FSingleton;
|
||||
end;
|
||||
|
||||
TImplDataTimestampValue = class(TInterfacedObject, IDataValue, IDataTimestampValue)
|
||||
private
|
||||
FValue: TDateTime;
|
||||
function GetDataType: IDataType;
|
||||
function GetValue: TDateTime;
|
||||
public
|
||||
constructor Create(const AValue: TDateTime);
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
{ TImplDataTimestampType }
|
||||
|
||||
class constructor TImplDataTimestampType.CreateClass;
|
||||
begin
|
||||
FSingleton := TImplDataTimestampType.Create;
|
||||
end;
|
||||
|
||||
function TImplDataTimestampType.CreateValue(const AValue: TDateTime): IDataTimestampValue;
|
||||
begin
|
||||
Result := TImplDataTimestampValue.Create(AValue);
|
||||
end;
|
||||
|
||||
function TImplDataTimestampType.GetName: String;
|
||||
begin
|
||||
Result := 'Timestamp';
|
||||
end;
|
||||
|
||||
function TImplDataTimestampType.GetKind: TDataKind;
|
||||
begin
|
||||
Result := dkTimestamp;
|
||||
end;
|
||||
|
||||
{ TImplDataTimestampValue }
|
||||
|
||||
constructor TImplDataTimestampValue.Create(const AValue: TDateTime);
|
||||
begin
|
||||
inherited Create;
|
||||
FValue := AValue;
|
||||
end;
|
||||
|
||||
function TImplDataTimestampValue.GetDataType: IDataType;
|
||||
begin
|
||||
Result := TImplDataTimestampType.Singleton;
|
||||
end;
|
||||
|
||||
function TImplDataTimestampValue.GetValue: TDateTime;
|
||||
begin
|
||||
Result := FValue;
|
||||
end;
|
||||
|
||||
end.
|
||||
Reference in New Issue
Block a user