// deprecated
{$MODE OBJFPC}
{$MODESWITCH autoderef}
unit dstream_op;

interface

uses
  dtypes,
  dstream;

const
  LINE_ENDING: TString = LineEnding;

type
TSpecialStreamEnd = (TAB, EOL, EOS);

{$IF FPC_VERSION > 20604}
operator << (Stream: PStream; I: TInt32): PStream; inline;
operator << (Stream: PStream; C: Char): PStream; inline;
operator << (Stream: PStream; const S: TString): PStream; inline;
operator << (Stream: PStream; S: TSpecialStreamEnd): PStream; inline;
{$ENDIF}

procedure Nop(const V); inline;

implementation

{$IF FPC_VERSION > 20604}
operator << (Stream: PStream; I: TInt32): PStream;
begin
  Stream.WriteInt(I);
  Result := Stream;
end;

operator << (Stream: PStream; C: Char): PStream; inline;
begin
  Stream.WriteByte(Byte(C));
  Result := Stream;
end;

operator << (Stream: PStream; const S: TString): PStream;
begin
  Stream.WriteBuffer(S[1], Length(S));
  Result := Stream;
end;

operator << (Stream: PStream; S: TSpecialStreamEnd): PStream; inline;
begin
  case S of
    TAB: Result := Stream << Byte(9);
    EOL: Result := Stream << LINE_ENDING;
    EOS:
	  begin
	    Stream.Free;
        Result := nil;
	  end;
  end;
end;
{$ENDIF}

procedure Nop(const V);
begin
end;

end.
