فهرست منبع

* Patch from Zeljko Avramovic to add additional typehelpers for basic types. Fix issue #39268

Michaël Van Canneyt 3 سال پیش
والد
کامیت
e422743841

+ 1 - 0
packages/rtl-objpas/fpmake.pp

@@ -68,6 +68,7 @@ begin
 
     T:=P.Targets.AddUnit('strutils.pp',StrUtilsOses);
       T.ResourceStrings:=true;
+    T:=P.Targets.AddUnit('syshelpers.pp',StrUtilsOses);
     T:=P.Targets.AddUnit('widestrutils.pp',StrUtilsOses-ConvUtilOSes);
     T:=P.Targets.AddUnit('varutils.pp',VarUtilsOses);
     with T.Dependencies do

+ 394 - 0
packages/rtl-objpas/src/inc/syshelpers.pp

@@ -0,0 +1,394 @@
+{
+    This file is part of the Free Pascal run time library.
+    Copyright (c) 2021 by Zeljko Avramovic (user avra in Lazarus forum)
+
+    syshelpers - Type helpers for customizable boolean, binary and hexadecimal data internationalized string representation
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ **********************************************************************}
+
+unit syshelpers;
+
+{$mode objfpc}
+{$H+}
+{$modeswitch typehelpers}
+{$modeswitch advancedrecords}
+{$modeswitch allowinline}
+{$macro on}
+
+interface
+
+uses
+  classes, sysutils;
+
+///////////////////////
+//                   //
+//  Format settings  //
+//                   //
+///////////////////////
+
+type
+  TStringCaseFormat = (scfUnchangedCase, scfLowerCase, scfUpperCase);
+
+  TBitFormatSettings = record                        // for boolean to string conversion
+    BitTrueString:      string;
+    BitFalseString:     string;
+    //
+    BitOnString:        string;
+    BitOffString:       string;
+    //
+    BitOneString:       string;
+    BitZeroString:      string;
+    //
+    class operator Initialize(var aNewSettings: TBitFormatSettings);
+    //
+    procedure CopyToDefaultBoolStrings;
+    procedure CopyToDefaultBitFormatSettings; inline;
+  end;
+
+  TBinFormatSettings = record                        // for number to binary conversion
+    BinPrefixString:    string;
+    BinSufixString:     string;
+    BinNibbleSeparator: string;
+    BinByteSeparator:   string;
+    BinWordSeparator:   string;
+    BinDwordSeparator:  string;
+    //
+    class operator Initialize(var aNewSettings: TBinFormatSettings);
+    //
+    procedure CopyToDefaultBinFormatSettings; inline;
+  end;
+
+  THexFormatSettings = record                        // for number to hex conversion
+    HexPrefixString:    string;                      // $
+    HexSufixString:     string;
+    HexNibbleSeparator: string;                      // between hex digits
+    HexByteSeparator:   string;                      // between byte pairs of hex digits
+    HexWordSeparator:   string;                      // between word quads of hex digits
+    HexDwordSeparator:  string;                      // between dword octets of hex digits
+    //
+    class operator Initialize(var aNewSettings: THexFormatSettings);
+    //
+    procedure CopyToDefaultHexFormatSettings; inline;
+  end;
+
+var
+  DefaultBitFormatSettings: TBitFormatSettings;      // global boolean to string conversion defaults
+  DefaultBinFormatSettings: TBinFormatSettings;      // global number to binary conversion defaults
+  DefaultHexFormatSettings: THexFormatSettings;      // global number to hex conversion defaults
+
+  // global easy access boolean to string conversion defaults
+  BitOnString:          string absolute DefaultBitFormatSettings.BitOnString;
+  BitOffString:         string absolute DefaultBitFormatSettings.BitOffString;
+  //
+  BitTrueString:        string absolute DefaultBitFormatSettings.BitTrueString;
+  BitFalseString:       string absolute DefaultBitFormatSettings.BitFalseString;
+  //
+  BitOneString:         string absolute DefaultBitFormatSettings.BitOneString;
+  BitZeroString:        string absolute DefaultBitFormatSettings.BitZeroString;
+
+  // global easy access number to binary conversion defaults
+  BinPrefixString:      string absolute DefaultBinFormatSettings.BinPrefixString;
+  BinSufixString:       string absolute DefaultBinFormatSettings.BinSufixString;
+  BinNibbleSeparator:   string absolute DefaultBinFormatSettings.BinNibbleSeparator;
+  BinByteSeparator:     string absolute DefaultBinFormatSettings.BinByteSeparator;
+  BinWordSeparator:     string absolute DefaultBinFormatSettings.BinWordSeparator;
+  BinDwordSeparator:    string absolute DefaultBinFormatSettings.BinDwordSeparator;
+
+  // global easy access number to hex conversion defaults
+  HexPrefixString:      string absolute DefaultHexFormatSettings.HexPrefixString;
+  HexSufixString:       string absolute DefaultHexFormatSettings.HexSufixString;
+  HexNibbleSeparator:   string absolute DefaultHexFormatSettings.HexNibbleSeparator;
+  HexByteSeparator:     string absolute DefaultHexFormatSettings.HexByteSeparator;
+  HexWordSeparator:     string absolute DefaultHexFormatSettings.HexWordSeparator;
+  HexDwordSeparator:    string absolute DefaultHexFormatSettings.HexDwordSeparator;
+
+//////////////////////
+//                  //
+//  System helpers  //
+//                  //
+//////////////////////
+
+type
+
+  TByteSysHelper = type helper(TByteHelper) for Byte
+    {$i syshelpersoh.inc}
+  end;
+
+  TShortIntSysHelper = type helper(TShortIntHelper) for ShortInt
+    {$i syshelpersoh.inc}
+  end;
+
+  TWordSysHelper = type helper(TWordHelper) for Word
+    {$i syshelpersoh.inc}
+  end;
+
+  TSmallIntSysHelper = type helper(TSmallIntHelper) for SmallInt
+    {$i syshelpersoh.inc}
+  end;
+
+  TCardinalSysHelper = type helper(TCardinalHelper) for Cardinal
+    {$i syshelpersoh.inc}
+  end;
+
+  TIntegerSysHelper = type helper(TIntegerHelper) for Integer
+    {$i syshelpersoh.inc}
+  end;
+
+  TQwordSysHelper = type helper(TQwordHelper) for Qword
+    {$i syshelpersoh.inc}
+  end;
+
+  TInt64SysHelper = type helper(TInt64Helper) for Int64
+    {$i syshelpersoh.inc}
+  end;
+
+  TNativeIntSysHelper = type helper(TNativeIntHelper) for NativeInt
+    {$i syshelpersoh.inc}
+  end;
+
+  TNativeUIntSysHelper = type helper(TNativeUIntHelper) for NativeUInt
+    {$i syshelpersoh.inc}
+  end;
+
+
+  TBooleanSysHelper = type helper(TBooleanHelper) for Boolean
+    {$i syshelpersbh.inc}
+  end;
+
+  TByteBoolSysHelper = type helper(TByteBoolHelper) for ByteBool
+    {$i syshelpersbh.inc}
+  end;
+
+  TWordBoolSysHelper = type helper(TWordBoolHelper) for WordBool
+    {$i syshelpersbh.inc}
+  end;
+
+  TLongBoolSysHelper = type helper(TLongBoolHelper) for LongBool
+    {$i syshelpersbh.inc}
+  end;
+
+
+implementation
+
+uses sysconst;
+
+///////////////////////
+//                   //
+//  Format settings  //
+//                   //
+///////////////////////
+
+class operator TBitFormatSettings.Initialize(var aNewSettings: TBitFormatSettings);
+begin
+  aNewSettings.BitTrueString  := 'True';
+  aNewSettings.BitFalseString := 'False';
+  //
+  aNewSettings.BitOnString    := 'On';
+  aNewSettings.BitOffString   := 'Off';
+  //
+  aNewSettings.BitOneString   := '1';
+  aNewSettings.BitZeroString  := '0';
+end;
+
+procedure TBitFormatSettings.CopyToDefaultBoolStrings;
+begin // without this call, new bit strings will not be used in BoolToStr() and TryStrToBool()
+  if Length(TrueBoolStrs) < 3 then
+    SetLength(TrueBoolStrs, 3);
+
+  TrueBoolStrs[0] := Self.BitTrueString;   // used in BoolToStr() and TryStrToBool()
+  TrueBoolStrs[1] := Self.BitOnString;     // used in TryStrToBool()
+  TrueBoolStrs[2] := Self.BitOneString;    // used in TryStrToBool()
+
+  If Length(FalseBoolStrs) < 3 then
+    SetLength(FalseBoolStrs, 3);
+
+  FalseBoolStrs[0] := Self.BitFalseString; // used in BoolToStr() and TryStrToBool()
+  FalseBoolStrs[1] := Self.BitOffString;   // used in TryStrToBool()
+  FalseBoolStrs[2] := Self.BitZeroString;  // used in TryStrToBool()
+end;
+
+procedure TBitFormatSettings.CopyToDefaultBitFormatSettings;
+begin
+  DefaultBitFormatSettings := Self;
+end;
+
+class operator TBinFormatSettings.Initialize(var aNewSettings: TBinFormatSettings);
+begin
+  aNewSettings  := Default(TBinFormatSettings);
+end;
+
+procedure TBinFormatSettings.CopyToDefaultBinFormatSettings;
+begin
+  DefaultBinFormatSettings := Self;
+end;
+
+class operator THexFormatSettings.Initialize(var aNewSettings: THexFormatSettings);
+begin
+  aNewSettings  := Default(THexFormatSettings);
+end;
+
+procedure THexFormatSettings.CopyToDefaultHexFormatSettings;
+begin
+  DefaultHexFormatSettings := Self;
+end;
+
+
+//////////////////////
+//                  //
+//  System helpers  //
+//                  //
+//////////////////////
+
+
+{ ---------------------------------------------------------------------
+  TByteSysHelper
+  ---------------------------------------------------------------------}
+
+{$define TORDINALHELPER:=TByteSysHelper}
+{$define TORDINALBITINDEX:=TByteBitIndex}
+{$define TORDINALNIBBLEINDEX:=TByteNibbleIndex}
+{$i syshelperso.inc}
+
+{ ---------------------------------------------------------------------
+  TShortintSysHelper
+  ---------------------------------------------------------------------}
+
+{$define TORDINALHELPER:=TShortIntSysHelper}
+{$define TORDINALBITINDEX:=TShortIntBitIndex}
+{$define TORDINALNIBBLEINDEX:=TShortIntNibbleIndex}
+{$i syshelperso.inc}
+
+{ ---------------------------------------------------------------------
+  TSmallintSysHelper
+  ---------------------------------------------------------------------}
+
+{$define TORDINALHELPER:=TSmallIntSysHelper}
+{$define TORDINALBITINDEX:=TSmallIntBitIndex}
+{$define TORDINALNIBBLEINDEX:=TSmallIntNibbleIndex}
+{$i syshelperso.inc}
+
+{ ---------------------------------------------------------------------
+  TWordSysHelper
+  ---------------------------------------------------------------------}
+
+{$define TORDINALHELPER:=TWordSysHelper}
+{$define TORDINALBITINDEX:=TWordBitIndex}
+{$define TORDINALNIBBLEINDEX:=TWordNibbleIndex}
+{$i syshelperso.inc}
+
+{ ---------------------------------------------------------------------
+  TCardinalSysHelper
+  ---------------------------------------------------------------------}
+
+{$define TORDINALHELPER:=TCardinalSysHelper}
+{$define TORDINALBITINDEX:=TCardinalBitIndex}
+{$define TORDINALNIBBLEINDEX:=TCardinalNibbleIndex}
+{$i syshelperso.inc}
+
+
+{ ---------------------------------------------------------------------
+  TIntegerSysHelper
+  ---------------------------------------------------------------------}
+
+{$define TORDINALHELPER:=TIntegerSysHelper}
+{$define TORDINALBITINDEX:=TIntegerBitIndex}
+{$define TORDINALNIBBLEINDEX:=TIntegerNibbleIndex}
+{$i syshelperso.inc}
+
+
+{ ---------------------------------------------------------------------
+  TInt64SysHelper
+  ---------------------------------------------------------------------}
+
+{$define TORDINALHELPER:=TInt64SysHelper}
+{$define TORDINALBITINDEX:=TInt64BitIndex}
+{$define TORDINALNIBBLEINDEX:=TInt64NibbleIndex}
+{$i syshelperso.inc}
+
+
+{ ---------------------------------------------------------------------
+  TQWordSysHelper
+  ---------------------------------------------------------------------}
+
+{$define TORDINALHELPER:=TQWordSysHelper}
+{$define TORDINALBITINDEX:=TQwordBitIndex}
+{$define TORDINALNIBBLEINDEX:=TQwordNibbleIndex}
+{$i syshelperso.inc}
+
+
+{ ---------------------------------------------------------------------
+  TNativeIntSysHelper
+  ---------------------------------------------------------------------}
+
+{$define TORDINALHELPER:=TNativeIntSysHelper}
+{$define TORDINALBITINDEX:=TNativeIntBitIndex}
+{$ifdef cpu16}
+  {$define TORDINALNIBBLEINDEX:=TSmallIntNibbleIndex}
+{$endif}
+{$ifdef cpu32}
+  {$define TORDINALNIBBLEINDEX:=TIntegerNibbleIndex}
+{$endif}
+{$ifdef cpu64}
+  {$define TORDINALNIBBLEINDEX:=TInt64NibbleIndex}
+{$endif}
+{$i syshelperso.inc}
+
+{ ---------------------------------------------------------------------
+  TNativeUIntSysHelper
+  ---------------------------------------------------------------------}
+
+{$define TORDINALHELPER:=TNativeUIntSysHelper}
+{$define TORDINALBITINDEX:=TNativeUIntBitIndex}
+{$ifdef cpu16}
+  {$define TORDINALNIBBLEINDEX:=TWordNibbleIndex}
+{$endif}
+{$ifdef cpu32}
+  {$define TORDINALNIBBLEINDEX:=TDwordNibbleIndex}
+{$endif}
+{$ifdef cpu64}
+  {$define TORDINALNIBBLEINDEX:=TQwordNibbleIndex}
+{$endif}
+{$i syshelperso.inc}
+
+{ ---------------------------------------------------------------------
+  TBooleanSysHelper
+  ---------------------------------------------------------------------}
+
+{$define TBOOLHELPER:=TBooleanSysHelper}
+{$define TBOOLTYPE:=Boolean}
+{$i syshelpersb.inc}
+
+{ ---------------------------------------------------------------------
+  TByteBoolSysHelper
+  ---------------------------------------------------------------------}
+
+{$define TBOOLHELPER:=TByteBoolSysHelper}
+{$define TBOOLTYPE:=ByteBool}
+{$i syshelpersb.inc}
+
+{ ---------------------------------------------------------------------
+  TWordBoolSysHelper
+  ---------------------------------------------------------------------}
+
+{$define TBOOLHELPER:=TWordBoolSysHelper}
+{$define TBOOLTYPE:=WordBool}
+{$i syshelpersb.inc}
+
+{ ---------------------------------------------------------------------
+  TLongBoolSysHelper
+  ---------------------------------------------------------------------}
+
+
+{$define TBOOLHELPER:=TLongBoolSysHelper}
+{$define TBOOLTYPE:=LongBool}
+{$i syshelpersb.inc}
+
+end.
+

+ 48 - 0
packages/rtl-objpas/src/inc/syshelpersb.inc

@@ -0,0 +1,48 @@
+class function TBOOLHELPER.ToString(const aValue: boolean; const aTrueStr, aFalseStr: string; const aCharsCase: TStringCaseFormat = scfUnchangedCase): string; overload; static;
+begin
+  if aValue then
+    case aCharsCase of
+      scfLowerCase:        Result := aTrueStr.ToLower;
+      scfUpperCase:        Result := aTrueStr.ToUpper;
+    else
+      {scfUnchangedCase:}  Result := aTrueStr;
+    end
+  else
+    case aCharsCase of
+      scfLowerCase:        Result := aFalseStr.ToLower;
+      scfUpperCase:        Result := aFalseStr.ToUpper;
+    else
+      {scfUnchangedCase:}  Result := aFalseStr;
+    end;
+end;
+
+function TBOOLHELPER.ToString(const aBitFormatSettings: TBitFormatSettings; const aCharsCase: TStringCaseFormat = scfUnchangedCase): string; overload; inline;
+begin
+  Result := ToString(Self, aBitFormatSettings.BitTrueString, aBitFormatSettings.BitFalseString, aCharsCase);
+end;
+
+function TBOOLHELPER.ToString(const aTrueStr, aFalseStr: string; const aCharsCase: TStringCaseFormat = scfUnchangedCase): string; overload; inline;
+begin
+  Result := ToString(Self, aTrueStr, aFalseStr, aCharsCase);
+end;
+
+function TBOOLHELPER.ToString(const aCharsCase: TStringCaseFormat = scfUnchangedCase): string; overload; inline;
+begin
+  Result := ToString(Self, BitTrueString, BitFalseString, aCharsCase);
+end;
+
+function TBOOLHELPER.ToOneZeroString(const aCharsCase: TStringCaseFormat = scfUnchangedCase): string; inline;
+begin
+  Result := ToString(BitOneString, BitZeroString, aCharsCase);
+end;
+
+function TBOOLHELPER.ToOnOffString(const aCharsCase: TStringCaseFormat = scfUnchangedCase): string; inline;
+begin
+  Result := ToString(BitOnString, BitOffString, aCharsCase);
+end;
+
+function TBOOLHELPER.ToTrueFalseString(const aCharsCase: TStringCaseFormat = scfUnchangedCase): string; inline;
+begin
+  Result := ToString(BitTrueString, BitFalseString, aCharsCase);
+end;
+

+ 10 - 0
packages/rtl-objpas/src/inc/syshelpersbh.inc

@@ -0,0 +1,10 @@
+public
+  class function ToString(const aValue: boolean; const aTrueStr, aFalseStr: string; const aCharsCase: TStringCaseFormat = scfUnchangedCase): string; overload; static;
+public
+  function ToString(const aBitFormatSettings: TBitFormatSettings; const aCharsCase: TStringCaseFormat = scfUnchangedCase): string; overload; inline;
+  function ToString(const aTrueStr, aFalseStr: string; const aCharsCase: TStringCaseFormat = scfUnchangedCase): string; overload; inline;
+  function ToString(const aCharsCase: TStringCaseFormat = scfUnchangedCase): string; overload; inline;
+  function ToTrueFalseString(const aCharsCase: TStringCaseFormat = scfUnchangedCase): string; inline;
+  function ToOnOffString(const aCharsCase: TStringCaseFormat = scfUnchangedCase): string; inline;
+  function ToOneZeroString(const aCharsCase: TStringCaseFormat = scfUnchangedCase): string; inline;
+

+ 102 - 0
packages/rtl-objpas/src/inc/syshelperso.inc

@@ -0,0 +1,102 @@
+function TORDINALHELPER.ToBinString(const aBinFormatSettings: TBinFormatSettings; const aShowLeadingZeros: boolean; const aMinDigits: integer): string; overload;
+var
+  BitCounter: TORDINALBITINDEX;
+  LeadingZeros: boolean;
+begin
+  Result := aBinFormatSettings.BinPrefixString;
+  LeadingZeros := true;
+  for BitCounter := MaxBit downto MinBit do
+  begin
+    LeadingZeros := LeadingZeros and not Self.Bits[BitCounter];
+    if aShowLeadingZeros or (not LeadingZeros) or (BitCounter = MinBit) or (BitCounter < aMinDigits) then
+    begin
+      if BitCounter <> MaxBit then // time for separator ?
+        if ((BitCounter + 1) mod 32 = 0) then // every 32 bits we have a dword
+          Result := Result + aBinFormatSettings.BinDwordSeparator
+        else
+          if ((BitCounter + 1) mod 16 = 0) then // every 16 bits we have a word
+            Result := Result + aBinFormatSettings.BinWordSeparator
+          else
+            if ((BitCounter + 1) mod 8 = 0) then // every 8 bits we have a byte
+              Result := Result + aBinFormatSettings.BinByteSeparator
+            else
+              if ((BitCounter + 1) mod 4 = 0) then // every 4 bits we have a nibble
+                Result := Result + aBinFormatSettings.BinNibbleSeparator;
+      Result := Result + Self.Bits[BitCounter].ToOneZeroString;
+    end;
+  end;
+  Result := Result + aBinFormatSettings.BinSufixString;
+end;
+
+function TORDINALHELPER.ToBinString(const aBinFormatSettings: TBinFormatSettings; const aMinDigits: integer): string; overload;
+begin
+  Result := ToBinString(aBinFormatSettings, false, aMinDigits);
+end;
+
+function TORDINALHELPER.ToBinString(const aBinFormatSettings: TBinFormatSettings; aShowLeadingZeros: boolean = true): string; overload;
+begin
+  Result := ToBinString(aBinFormatSettings, aShowLeadingZeros, 0);
+end;
+
+function TORDINALHELPER.ToBinString(const aMinDigits: integer): string; overload;
+begin
+  Result := ToBinString(DefaultBinFormatSettings, false, aMinDigits);
+end;
+
+function TORDINALHELPER.ToBinString(const aShowLeadingZeros: boolean = true): string; overload;
+begin
+  Result := ToBinString(DefaultBinFormatSettings, aShowLeadingZeros, 0);
+end;
+
+function TORDINALHELPER.ToHexString(const aHexFormatSettings: THexFormatSettings; const aShowLeadingZeros: boolean; const aMinDigits: integer): string; overload;
+var
+  NibbleCounter: TORDINALNIBBLEINDEX;
+  LeadingZeros, PassedFirstNibble: boolean;
+begin
+  Result := aHexFormatSettings.HexPrefixString;
+  LeadingZeros := true;
+  PassedFirstNibble := false;
+  for NibbleCounter := MaxNibble downto MinNibble do
+  begin
+    LeadingZeros := LeadingZeros and (Self.Nibbles[NibbleCounter] = 0);
+    if aShowLeadingZeros or (not LeadingZeros) or (NibbleCounter = MinNibble) or (NibbleCounter < aMinDigits) then
+    begin
+      if PassedFirstNibble then // time for separator ?
+        if ((NibbleCounter + 1) mod 8 = 0) then // every 8 nibbles we have a dword
+          Result := Result + aHexFormatSettings.HexDwordSeparator
+        else
+          if ((NibbleCounter + 1) mod 4 = 0) then // every 4 nibbles we have a word
+            Result := Result + aHexFormatSettings.HexWordSeparator
+          else
+            if ((NibbleCounter + 1) mod 2 = 0) then // every 2 nibbles we have a byte
+              Result := Result + aHexFormatSettings.HexByteSeparator
+            else
+              if PassedFirstNibble then
+                Result := Result + aHexFormatSettings.HexNibbleSeparator;
+      Result := Result + HexDigits[Self.Nibbles[NibbleCounter]];
+      PassedFirstNibble := true;
+    end;
+  end;
+  Result := Result + aHexFormatSettings.HexSufixString;
+end;
+
+function TORDINALHELPER.ToHexString(const aHexFormatSettings: THexFormatSettings; const aMinDigits: integer): string; overload;
+begin
+  Result := ToHexString(aHexFormatSettings, false, aMinDigits);
+end;
+
+function TORDINALHELPER.ToHexString(const aHexFormatSettings: THexFormatSettings; aShowLeadingZeros: boolean = true): string; overload;
+begin
+  Result := ToHexString(aHexFormatSettings, aShowLeadingZeros, 0);
+end;
+
+function TORDINALHELPER.ToHexString(const aMinDigits: integer): string; overload;
+begin
+  Result := ToHexString(DefaultHexFormatSettings, false, aMinDigits);
+end;
+
+function TORDINALHELPER.ToHexString(const aShowLeadingZeros: boolean = true): string; overload;
+begin
+  Result := ToHexString(DefaultHexFormatSettings, aShowLeadingZeros, 0);
+end;
+

+ 12 - 0
packages/rtl-objpas/src/inc/syshelpersoh.inc

@@ -0,0 +1,12 @@
+protected
+  function ToBinString(const aBinFormatSettings: TBinFormatSettings; const aShowLeadingZeros: boolean; const aMinDigits: integer): string; overload;
+  function ToHexString(const aHexFormatSettings: THexFormatSettings; const aShowLeadingZeros: boolean; const aMinDigits: integer): string; overload;
+public
+  function ToBinString(const aBinFormatSettings: TBinFormatSettings; const aMinDigits: integer): string; overload; inline;
+  function ToBinString(const aBinFormatSettings: TBinFormatSettings; aShowLeadingZeros: boolean = true): string; overload; inline;
+  function ToBinString(const aMinDigits: integer): string; overload; inline;
+  function ToBinString(const aShowLeadingZeros: boolean = true): string; overload; inline;
+  function ToHexString(const aHexFormatSettings: THexFormatSettings; const aMinDigits: integer): string; overload; inline;
+  function ToHexString(const aHexFormatSettings: THexFormatSettings; aShowLeadingZeros: boolean = true): string; overload; inline;
+  function ToHexString(const aMinDigits: integer): string; overload; inline;
+  function ToHexString(const aShowLeadingZeros: boolean = true): string; overload; inline;