  Platform eXtended Library (PXL)Units Class Hierarchy Classes, Interfaces, Objects and Records Types Variables Constants Functions and Procedures Identifiers |
Class TStreamHelper
Unit
PXL.Classes
Declaration
type TStreamHelper = class helper(TObject) for TStream
Description
Extensions to TStream class for reading and writing different values depending on platform. Although TStream in recent versions of FPC and Delphi introduced similar functions, this extension class provides a more comprehensive and unified set of functions that work across all platforms.
Hierarchy
Overview
Internal Types
Methods
Description
Internal Types
 |
TStreamByte = SizeUInt; |
|
Value stored as unsigned 8-bit integer, but represented as unsigned 32-bit or 64-bit value depending on platform.
|
 |
TStreamByteBool = Boolean; |
|
Value stored as 8-bit unsigned integer, but represented as Boolean.
|
 |
TStreamByteIndex = SizeInt; |
|
Value stored as unsigned 8-bit integer, but represented as signed 32-bit or 64-bit index depending on platform.
|
 |
TStreamDouble = Double; |
|
Value stored and represented as 64-bit (double-precision) floating-point.
|
 |
TStreamInt64 = Int64; |
|
Value stored and represented as signed 64-bit integer.
|
 |
TStreamLongInt = SizeInt ; |
|
Value stored as 32-bit signed integer, but represented as signed 32-bit or 64-bit value depending on platform.
|
 |
TStreamLongWord = SizeUInt ; |
|
Value stored as unsigned 32-bit integer, but represented as unsigned 32-bit or 64-bit value depending on platform.
|
 |
TStreamShortInt = SizeInt; |
|
Value stored as 8-bit signed integer, but represented as signed 32-bit or 64-bit value depending on platform.
|
 |
TStreamSingle = Single; |
|
Value stored and represented as 32-bit (single-precision) floating-point.
|
 |
TStreamSmallInt = SizeInt; |
|
Value stored as 16-bit signed integer, but represented as signed 32-bit or 64-bit value depending on platform.
|
 |
TStreamUInt64 = UInt64; |
|
Value stored and represented as unsigned 64-bit integer.
|
 |
TStreamWord = SizeUInt; |
|
Value stored as unsigned 16-bit integer, but represented as unsigned 32-bit or 64-bit value depending on platform.
|
 |
TStreamWordIndex = SizeInt ; |
|
Value stored as unsigned 16-bit integer, but represented as signed 32-bit or 64-bit index depending on platform.
|
Methods
 |
function GetByte: TStreamByte; inline; |
|
Loads 8-bit unsigned integer from the stream.
|
 |
function GetByteBool: TStreamByteBool; inline; |
|
Loads Boolean value from the stream previously saved by PutByteBool. The resulting value is treated as 8-bit unsigned integer with values of [0..127] considered as True and values of [128..255] considered as False.
|
 |
function GetByteIndex: TStreamByteIndex; inline; |
|
Loads 8-bit unsigned index from the stream. The range of returned values is [0..254], the value of 255 is returned as -1.
|
 |
function GetBytePoint2px: TPoint2i; |
|
Loads 2D integer point from the stream. Each coordinate is loaded as 8-bit unsigned integer.
|
 |
function GetDouble: TStreamDouble; inline; |
|
Loads 64-bit floating-point value (double-precision) from the stream.
|
 |
function GetFloat34: Single; |
|
Loads floating-point value as 8-bit signed byte from the stream using 1:3:4 fixed-point format. The possible values are in [-8..7.9375] range.
|
 |
function GetFloat43: Single; |
|
Loads floating-point value as 8-bit signed byte from the stream using 1:4:3 fixed-point format. The possible values are in [-16..15.875] range.
|
 |
function GetInt64: TStreamInt64; inline; |
|
Loads 64-bit signed integer from the stream.
|
 |
function GetLongInt: TStreamLongInt; inline; |
|
Loads 32-bit signed integer from the stream.
|
 |
function GetLongPoint2px: TPoint2i; |
|
Loads 2D integer point from the stream. Each coordinate is loaded as 32-bit signed integer.
|
 |
function GetLongString: UniString; |
|
Loads Unicode string from the stream in UTF-8 encoding previously saved by PutLongString.
|
 |
function GetLongWord: TStreamLongWord; inline; |
|
Loads 32-bit unsigned integer from the stream.
|
 |
function GetMediumString: UniString; |
|
Loads Unicode string from the stream in UTF-8 encoding previously saved by PutMediumString.
|
 |
function GetShortInt: TStreamShortInt; inline; |
|
Loads 8-bit signed integer from the stream.
|
 |
function GetShortString: UniString; |
|
Loads Unicode string from the stream in UTF-8 encoding previously saved by PutShortString.
|
 |
function GetSingle: TStreamSingle; inline; |
|
Loads 32-bit floating-point value (single-precision) from the stream.
|
 |
function GetSmallInt: TStreamSmallInt; inline; |
|
Loads 16-bit signed integer from the stream.
|
 |
function GetUInt64: TStreamUInt64; inline; |
|
Loads 64-bit unsigned integer from the stream.
|
 |
function GetWord: TStreamWord; inline; |
|
Loads 16-bit unsigned integer value from the stream.
|
 |
function GetWordIndex: TStreamWordIndex; inline; |
|
Loads 16-bit unsigned index from the stream. The range of returned values is [0..65534], the value of 65535 is returned as -1.
|
 |
function GetWordPoint2px: TPoint2i; |
|
Loads 2D integer point from the stream. Each coordinate is loaded as 16-bit unsigned integer.
|
 |
procedure GetFloats3311(out Value1, Value2: Single); |
|
Loads two floating-point values as a single 8-bit unsigned byte from the stream with each value stored in fixed-point 1:2:1 format. The possible values are in [-4..3.5] range.
|
 |
procedure GetFloats44(out Value1, Value2: Single); |
|
Loads two floating-point values as a single 8-bit unsigned byte from the stream with each value having 4-bits. The possible values are in [-8..7] range.
|
 |
procedure PutByte(const Value: TStreamByte); inline; |
|
Saves 8-bit unsigned integer to the stream. If the value is outside of [0..255] range, it will be clamped.
|
 |
procedure PutByteBool(const Value: TStreamByteBool); inline; |
|
Saves Boolean value to the stream as 8-bit unsigned integer. A value of False is saved as 255, while True is saved as 0.
|
 |
procedure PutByteIndex(const Value: TStreamByteIndex); inline; |
|
Saves 8-bit unsigned index to the stream. A value of -1 (and other negative values) is stored as 255. Positive numbers that are outside of [0..254] range will be clamped.
|
 |
procedure PutBytePoint2px(const Value: TPoint2i); |
|
Saves 2D integer point to the stream. Each coordinate is saved as 8-bit unsigned integer.
|
 |
procedure PutDouble(const Value: TStreamDouble); inline; |
|
Saves 64-bit floating-point value (double-precision) to the stream.
|
 |
procedure PutFloat34(const Value: Single); |
|
Saves floating-point value as 8-bit signed byte to the stream using 1:3:4 fixed-point format with values outside of [-8..7.9375] range will be clamped.
|
 |
procedure PutFloat43(const Value: Single); |
|
Saves floating-point value as 8-bit signed byte to the stream using 1:4:3 fixed-point format with values outside of [-16..15.875] range will be clamped.
|
 |
procedure PutFloats3311(const Value1, Value2: Single); |
|
Saves two floating-point values as a single 8-bit unsigned byte to the stream with each value stored in fixed-point 1:2:1 format. Values outside of [-4..3.5] range will be clamped.
|
 |
procedure PutFloats44(const Value1, Value2: Single); |
|
Saves two floating-point values as a single 8-bit unsigned byte to the stream with each value having 4-bits. Values outside of [-8..7] range will be clamped.
|
 |
procedure PutInt64(const Value: TStreamInt64); inline; |
|
Saves 64-bit signed integer to the stream.
|
 |
procedure PutLongInt(const Value: TStreamLongInt); inline; |
|
Saves 32-bit signed integer to the stream.
|
 |
procedure PutLongPoint2px(const Value: TPoint2i); |
|
Saves 2D integer point to the stream. Each coordinate is saved as 32-bit signed integer.
|
 |
procedure PutLongString(const Text: UniString); |
|
Stores Unicode string to the stream in UTF-8 encoding.
|
 |
procedure PutLongWord(const Value: TStreamLongWord); inline; |
|
Saves 32-bit unsigned integer to the stream.
|
 |
procedure PutMediumString(const Text: UniString; const MaxCount: Integer = 0); |
|
Saves Unicode string to the stream in UTF-8 encoding. The resulting UTF-8 string is limited to a maximum of 65535 characters; therefore, for certain charsets the actual string is limited to either 32767 or even 21845 characters in worst case. If MaxCount is not zero, the input string will be limited to the given number of characters.
|
 |
procedure PutShortInt(const Value: TStreamShortInt); inline; |
|
Saves 8-bit signed integer to the stream. If the value is outside of [-128..127] range, it will be clamped.
|
 |
procedure PutShortString(const Text: UniString; const MaxCount: Integer = 0); |
|
Saves Unicode string to the stream in UTF-8 encoding. The resulting UTF-8 string is limited to a maximum of 255 characters; therefore, for certain charsets the actual string is limited to either 127 or even 85 characters in worst case. If MaxCount is not zero, the input string will be limited to the given number of characters.
|
 |
procedure PutSingle(const Value: TStreamSingle); inline; |
|
Saves 32-bit floating-point value (single-precision) to the stream.
|
 |
procedure PutSmallInt(const Value: TStreamSmallInt); inline; |
|
Saves 16-bit signed integer to the stream. If the value is outside of [-32768..32767] range, it will be clamped.
|
 |
procedure PutUInt64(const Value: TStreamUInt64); inline; |
|
Saves 64-bit unsigned integer to the stream.
|
 |
procedure PutWord(const Value: TStreamWord); inline; |
|
Saves 16-bit unsigned integer to the stream. If the value is outside of [0..65535] range, it will be clamped.
|
 |
procedure PutWordIndex(const Value: TStreamWordIndex); inline; |
|
Saves 16-bit unsigned index to the stream. A value of -1 (and other negative values) is stored as 65535. Positive numbers that are outside of [0..65534] range will be clamped.
|
 |
procedure PutWordPoint2px(const Value: TPoint2i); |
|
Saves 2D integer point to the stream. Each coordinate is saved as 16-bit unsigned integer.
|
Copyright © 2000 - 2017 Yuriy Kotsarenko. Help files generated by PasDoc.
|