* misc single and double helpers. No endianess atm.

git-svn-id: trunk@33041 -
This commit is contained in:
marco 2016-02-02 09:25:31 +00:00
parent 9b25ce2007
commit 475d388fdc

View File

@ -179,6 +179,7 @@ type
TStreamHelper = class helper for TStream
function ReadWordLE :word;
function ReadDWordLE:dword;
function ReadQWordLE:qword;
@ -191,6 +192,11 @@ type
procedure WriteWordBE (w:word);
procedure WriteDWordBE(dw:dword);
procedure WriteQWordBE(dq:qword);
function ReadSingle:Single;
function ReadDouble:Double;
procedure WriteSingle(s:Single);
procedure WriteDouble(d:double);
{$ifndef FPC}
function ReadByte : Byte;
function ReadWord : Word;
@ -603,6 +609,24 @@ begin
WriteQWord(NtoLE(dq));
end;
function TStreamHelper.ReadSingle:Single;
begin
self.Read(result,sizeof(result));
end;
function TStreamHelper.ReadDouble:Double;
begin
self.Read(result,sizeof(result));
end;
procedure TStreamHelper.WriteSingle(s:Single);
begin
self.Write(s,sizeof(s));
end;
procedure TStreamHelper.WriteDouble(d:double);
begin
self.Write(d,sizeof(d));
end;
{$ifndef FPC}
// there can only be one helper per class, and I use these in Delphi for FPC compatibility.
function TStreamHelper.ReadByte: Byte;