TCardinalHelper
Helper for a Cardinal-typed ordinal value.
Declaration Source position: syshelph.inc line 1086
type
TCardinalHelper = type helper for Cardinal
const
MaxValue = High( Cardinal) ;
MinValue = Low( Cardinal) ;
MaxBit = High( TCardinalBitIndex) ;
MinBit = Low( TCardinalBitIndex) ;
MaxNibble = High( TCardinalNibbleIndex) ;
MinNibble = Low( TCardinalNibbleIndex) ;
MaxByte = High( TCardinalByteIndex) ;
MinByte = Low( TCardinalByteIndex) ;
MaxWord = High( TCardinalWordIndex) ;
MinWord = Low( TCardinalWordIndex) ;
public
class function Parse : Cardinal;
class function Size : Integer;
class function ToString ( const AValue: Cardinal) : string; overload;
function ToString : string; overload;
class function TryParse : Boolean;
function ToBoolean : Boolean;
function ToDouble : Double;
function ToExtended : Extended;
function ToBinString : string;
function ToHexString ( const AMinDigits: Integer) : string; overload;
function ToHexString : string; overload;
function ToSingle : Single;
function SetBit : Cardinal;
function ClearBit : Cardinal;
function ToggleBit : Cardinal;
function TestBit : Boolean;
procedure Clear ;
function HighestSetBitPos : Int8;
function LowestSetBitPos : Int8;
function SetBitsCount : Byte;
property Bits [ aIndex : TCardinalBitIndex = 0 . . 31 ] : Boolean; {rw}
property Nibbles [ aIndex : TCardinalNibbleIndex = TDwordNibbleIndex] : nibble; {rw}
property Bytes [ aIndex : TCardinalByteIndex = TDwordByteIndex] : Byte; {rw}
property Words [ aIndex : TCardinalWordIndex = TDwordWordIndex] : Word; {rw}
end ;
Description TCardinalHelper contains some auxiliary routines for a Cardinal-typed ordinal value. It consists mainly of conversion routines to and from other types.
Properties
Member
Visibility
Description
Bits
public
Read or write a bit.
Bytes
public
Read or write a byte.
Nibbles
public
Read or write a nibble.
Words
public
Read or write a word.
Methods
Member
Visibility
Description
Clear
public
Set value to 0.
ClearBit
public
Set bit to 0.
HighestSetBitPos
public
Return the position of the leftmost bit set.
LowestSetBitPos
public
Return the position of the rightmost bit set.
Parse
public
Convert from a string.
SetBit
public
Set bit to 1.
SetBitsCount
public
Count number of bits set.
Size
public
Size, in bytes, of the Cardinal value.
TestBit
public
Check bit.
ToBinString
public
Convert to a binary string representation.
ToBoolean
public
Convert to a boolean value.
ToDouble
public
Convert to a double-sized floating point value.
ToExtended
public
Convert to an extended-sized floating point value.
ToggleBit
public
Invert bit.
ToHexString
public
Convert to a hexadecimal string representation.
ToSingle
public
Convert to an single-sized floating point value.
ToString
public
Convert the value to string.
TryParse
public
Try to convert a string to a Cardinal, report success or failure.