{$MODE FPC}
{$MODESWITCH OUT}
{$MODESWITCH RESULT}
unit dtypetraits;

interface

type
TTypeOfAnsiString = object
public type
  TValue = AnsiString;
  TValueRef = AnsiString;
public
  procedure Init(out Value: TValue); inline; static;
  procedure Done(var Value: TValue); inline; static;
  procedure InitCopy(out Value: TValue; const Src: TValue); inline; static;
  procedure InitMove(out Value: TValue; var Src: TValue); inline; static;
  procedure Copy(var Dst: TValue; const Src: TValue); inline; static;
  procedure Move(var Dst: TValue; var Src: TValue); inline; static;
  function Equal(const A, B: TValue): Boolean; inline; static;
end;

implementation

procedure TTypeOfAnsiString.Init(out Value: TValue);
begin
  Pointer(Value) := nil;
end;

procedure TTypeOfAnsiString.Done(var Value: TValue);
begin
  Value := '';
end;

procedure TTypeOfAnsiString.InitCopy(out Value: TValue; const Src: TValue);
begin
  Pointer(Value) := nil;
  Value := Src;
end;

procedure TTypeOfAnsiString.InitMove(out Value: TValue; var Src: TValue);
begin
  Pointer(Value) := Pointer(Src);
  Pointer(Src) := nil;
end;

procedure TTypeOfAnsiString.Copy(var Dst: TValue; const Src: TValue);
begin
  Dst := Src;
end;

procedure TTypeOfAnsiString.Move(var Dst: TValue; var Src: TValue);
begin
  Dst := '';
  Pointer(Dst) := Pointer(Src);
  Pointer(Src) := nil;
end;

function TTypeOfAnsiString.Equal(const A, B: TValue): Boolean;
begin
  Result := A = B;
end;

end.
