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.
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.
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.
ReplyDeletegithub.com - BufferedStreamReader
Asbjørn Heid I'm tired of all thoses little things that you can "just add" to make the things going right.
ReplyDeletegithub.com - Delphi
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