TMBCSEncoding

[Properties (by Name)][Methods (by Name)][Events (by Name)]

Multi-Byte character set encoding

Declaration

Source position: sysencodingh.inc line 112

Type
  TMBCSEncoding = class (TEncoding)
  strict private
    FCodePage : Integer;
    FMBToWCharFlags : Integer;
    FWCharToMBFlags : Integer;
  strict protected
    function GetByteCount(Chars: PUnicodeChar; CharCount: Integer) : Integer
                         ;  Override;  Overload;
    function GetBytes(Chars: PUnicodeChar; CharCount: Integer; 
                     Bytes: PByte; ByteCount: Integer) : Integer;  Override
                     ;  Overload;
    function GetCharCount(Bytes: PByte; ByteCount: Integer) : Integer
                         ;  Override;  Overload;
    function GetChars(Bytes: PByte; ByteCount: Integer; 
                     Chars: PUnicodeChar; CharCount: Integer) : Integer
                     ;  Override;  Overload;
    function GetAnsiBytes(Chars: PChar; CharCount: Integer) : TBytes
                         ;  Override;
    function GetAnsiString(Bytes: PByte; ByteCount: Integer) : string
                          ;  Override;
    function GetCodePage : Cardinal;  Override;
    function GetEncodingName : UnicodeString;  Override;
  public
    constructor Create;  Virtual;  Overload;
    constructor Create(ACodePage: Integer);  Virtual;  Overload;
    constructor Create(ACodePage: Integer; MBToWCharFlags: Integer; 
                      WCharToMBFlags: Integer);  Virtual;  Overload;
    function Clone : TEncoding;  Override;
    function GetMaxByteCount(CharCount: Integer) : Integer;  Override;
    function GetMaxCharCount(ByteCount: Integer) : Integer;  Override;
    function GetPreamble : TBytes;  Override;
  end
  ;

Description

TMBCSEncoding is the encoding class used for most of the encodings, except the actual Unicode encodings. The codepage is specified during creation, and is by default the system codepage.

The name is somewhat misleading, since the MBCS is also used for single-byte encodings.

Members

Member Type Visibility Description
Clone Method public Clone a TMBCSEncoding instance
Create Method public Create a new instance of a multi-byte character set encoding
FCodePage Field strict private
FMBToWCharFlags Field strict private
FWCharToMBFlags Field strict private
GetAnsiBytes Method strict protected
GetAnsiString Method strict protected
GetByteCount Method strict protected
GetBytes Method strict protected
GetCharCount Method strict protected
GetChars Method strict protected
GetCodePage Method strict protected
GetEncodingName Method strict protected
GetMaxByteCount Method public Return max number of bytes needed to represent a string
GetMaxCharCount Method public Return max number of characters that can be represented by an array of bytes
GetPreamble Method public Return BOM marker bytes

Inheritance

Class Description
TMBCSEncoding Multi-Byte character set encoding

See also

Name Description
Integer A signed 16-bits integer
Integer A signed 16-bits integer
Integer A signed 16-bits integer
TBigendianUnicodeEncoding Big-endian UTF-16 Unicode encoding
TUnicodeEncoding UTF-16 Unicode encoding
TUTF7Encoding UTF-7 Unicode encoding
TUTF8Encoding UTF-8 Unicode encoding