Definition of a character set for DVB encoding. More...
Classes | |
class | DuplicateDVBCharset |
Exception thrown when registering duplicate charsets. More... | |
class | InvalidDVBCharset |
Exception thrown when registering invalid charsets. More... | |
Public Member Functions | |
virtual | ~DVBCharset () |
Virtual destructor. | |
virtual bool | canEncode (const UString &str, size_t start=0, size_t count=NPOS) const =0 |
Check if a string can be encoded using the charset (ie all characters can be represented). More... | |
virtual bool | decode (UString &str, const uint8_t *dvb, size_t dvbSize) const =0 |
Decode a DVB string from the specified byte buffer. More... | |
virtual size_t | encode (uint8_t *&buffer, size_t &size, const UString &str, size_t start=0, size_t count=NPOS) const =0 |
Encode a C++ Unicode string into a DVB string. More... | |
virtual size_t | encodeTableCode (uint8_t *&buffer, size_t &size) const |
Encode the character set table code. More... | |
UString | name () const |
Get the character set name. More... | |
uint32_t | tableCode () const |
Get the DVB table code for the character set. More... | |
Static Public Member Functions | |
static UStringList | GetAllNames () |
Find all registered character set names. More... | |
static bool | GetCharCodeTable (uint32_t &code, size_t &codeSize, const uint8_t *dvb, size_t dvbSize) |
This static function gets the character coding table at the beginning of a DVB string. More... | |
static DVBCharset * | GetCharset (const UString &name) |
Get a DVB character set by name. More... | |
static DVBCharset * | GetCharset (uint32_t tableCode) |
Get a DVB character set by table code. More... | |
Static Public Attributes | |
static constexpr uint16_t | DVB_CODEPOINT_CRLF = 0xE08A |
Code point for DVB-encoded CR/LF in two-byte character sets. | |
static constexpr uint8_t | DVB_SINGLE_BYTE_CRLF = 0x8A |
DVB-encoded CR/LF in single-byte character sets. | |
Protected Member Functions | |
DVBCharset (const UString &name, uint32_t tableCode) | |
Protected constructor. More... | |
Static Protected Member Functions | |
static void | Unregister (const DVBCharset *charset) |
Remove the specified charset. More... | |
Definition of a character set for DVB encoding.
|
protected |
Protected constructor.
[in] | name | charset name |
[in] | tableCode | DVB table code |
|
static |
This static function gets the character coding table at the beginning of a DVB string.
The character coding table is encoded on up to 3 bytes at the beginning of a DVB string. The following encodings are recognized, based on the first byte of the DVB string:
[out] | code | Returned character coding table value. |
[out] | codeSize | Size in bytes of character coding table in dvb. |
[in] | dvb | Address of a DVB string. |
[in] | dvbSize | Size in bytes of the DVB string. |
|
inline |
Get the character set name.
|
inline |
Get the DVB table code for the character set.
|
static |
Get a DVB character set by name.
[in] | name | Name of the requested character set. |
|
static |
Get a DVB character set by table code.
[in] | tableCode | Table code of the requested character set. |
|
static |
Find all registered character set names.
|
pure virtual |
Decode a DVB string from the specified byte buffer.
[out] | str | Returned decoded string. |
[in] | dvb | Address of a DVB string. |
[in] | dvbSize | Size in bytes of the DVB string. |
Implemented in ts::DVBCharsetSingleByte, ts::DVBCharsetUTF16, and ts::DVBCharsetUTF8.
|
pure virtual |
Check if a string can be encoded using the charset (ie all characters can be represented).
[in] | str | The string to encode. |
[in] | start | Starting offset in str. |
[in] | count | Maximum number of characters to encode. |
Implemented in ts::DVBCharsetSingleByte, ts::DVBCharsetUTF16, and ts::DVBCharsetUTF8.
|
virtual |
Encode the character set table code.
Stop either when the specified number of characters are serialized or when the buffer is full, whichever comes first.
[in,out] | buffer | Address of the buffer. The address is updated to point after the encoded value. |
[in,out] | size | Size of the buffer. Updated to remaining size. |
|
pure virtual |
Encode a C++ Unicode string into a DVB string.
Unmappable characters are skipped. Stop either when the specified number of characters are serialized or when the buffer is full, whichever comes first.
[in,out] | buffer | Address of the buffer. The address is updated to point after the encoded value. |
[in,out] | size | Size of the buffer. Updated to remaining size. |
[in] | str | The string to encode. |
[in] | start | Starting offset in str. |
[in] | count | Maximum number of characters to encode. |
Implemented in ts::DVBCharsetSingleByte, ts::DVBCharsetUTF16, and ts::DVBCharsetUTF8.
|
staticprotected |
Remove the specified charset.
[in] | charset | The charset to remove. |