Hello

Hello,

Why do TEncoding strickly protect those very usefull methods ?

strict protected
function GetByteCount(Chars: PChar; CharCount: Integer): Integer; overload; virtual; abstract;
function GetBytes(Chars: PChar; CharCount: Integer; Bytes: PByte; ByteCount: Integer): Integer; overload; virtual; abstract;
function GetCharCount(Bytes: PByte; ByteCount: Integer): Integer; overload; virtual; abstract;

they could be used with any kind a memory data (TBytes, TMemoryStream, TWhatEver)...but the only available methods uses TBytes or Array of Byte.

Comments

  1. Well, at least they're protected, so easy to get to with a descendant class. I made this class helper for TEncoding so I could convert PByte + buffer length to string and TCharArray.
    github.com - BufferedStreamReader

    ReplyDelete
  2. Asbjørn Heid I'm tired of all thoses little things that you can "just add" to make the things going right.

    github.com - Delphi

    ReplyDelete
  3. Paul TOTH Yeah I was cursing to myself when I found I had to write that wrapper. Oh well, at least I could write it due to the methods being protected...

    ReplyDelete

Post a Comment