AJA NTV2 SDK  17.0.1.1246
NTV2 SDK 17.0.1.1246
CUtf8Helpers Class Reference

A small collection of UTF-8 utility functions. More...

#include <ntv2captionencoder608.h>

Static Public Member Functions

static std::string Utf8ToCEA608String (const std::string &inUtf8Str, const NTV2Line21Channel inChannel=NTV2_CC608_CC1)
 Converts the given UTF8-encoded string into a string that can be used in the CNTV2CaptionEncoder608's Enqueue____Message calls. "Special" characters that are supported in the CEA-608 extended character sets will be replaced with a three-byte sequence – the first byte being the ASCII equivalent (for compatibility with decoders that don't handle the extended character sets), and the subsequent two-byte CEA-608 byte sequence that's appropriate for the given caption channel. More...
 
static std::string UnicodeCodePointToCEA608Sequence (const ULWord inUnicodeCodePoint, const NTV2Line21Channel inChannel=NTV2_CC608_CC1)
 Converts the given Unicode codepoint into a string containing its equivalent CEA-608 three-byte sequence, suitable for use in the CNTV2CaptionEncoder608's Enqueue____Message calls. "Special" characters that are supported in the CEA-608 extended character sets are converted into a three-byte sequence – the first byte being the ASCII equivalent (for compatibility with decoders that don't handle the extended character sets), and the subsequent two-byte CEA-608 byte sequence that's appropriate for the given caption channel. More...
 
static size_t Utf8LengthInChars (const std::string &inUtf8Str)
 Returns the length of the given UTF8-encoded string, in characters. More...
 
static std::string Utf8GetCharacter (const std::string &inUtf8Str, const size_t inCharOffset)
 Returns the character at the given character offset in the given UTF8-encoded string. More...
 

Detailed Description

A small collection of UTF-8 utility functions.

Definition at line 431 of file ntv2captionencoder608.h.

Member Function Documentation

◆ UnicodeCodePointToCEA608Sequence()

static std::string CUtf8Helpers::UnicodeCodePointToCEA608Sequence ( const ULWord  inUnicodeCodePoint,
const NTV2Line21Channel  inChannel = NTV2_CC608_CC1 
)
static

Converts the given Unicode codepoint into a string containing its equivalent CEA-608 three-byte sequence, suitable for use in the CNTV2CaptionEncoder608's Enqueue____Message calls. "Special" characters that are supported in the CEA-608 extended character sets are converted into a three-byte sequence – the first byte being the ASCII equivalent (for compatibility with decoders that don't handle the extended character sets), and the subsequent two-byte CEA-608 byte sequence that's appropriate for the given caption channel.

Parameters
[in]inUnicodeCodePointThe unicode codepoint to be converted.
[in]inChannelThe caption channel to be used. Defaults to NTV2_CC608_CC1.
Returns
The CEA-608 equivalent string that can be passed into any of the Enqueue____Message functions.

◆ Utf8GetCharacter()

static std::string CUtf8Helpers::Utf8GetCharacter ( const std::string &  inUtf8Str,
const size_t  inCharOffset 
)
static

Returns the character at the given character offset in the given UTF8-encoded string.

Parameters
[in]inUtf8StrThe string containing the UTF8-encoded character sequence.
[in]inCharOffsetThe character offset. Note that this is not a byte offset. Must be less than the number of characters in the string.
Returns
A string containing the UTF-8 character at the given character position. This will be empty if the offset is out of bounds or another error occurs.

◆ Utf8LengthInChars()

static size_t CUtf8Helpers::Utf8LengthInChars ( const std::string &  inUtf8Str)
static

Returns the length of the given UTF8-encoded string, in characters.

Parameters
[in]inUtf8StrThe string containing UTF8-encoded characters to be measured.
Returns
The length of the string, in characters.
Note
The returned length may not match the number of bytes contained in the string.

◆ Utf8ToCEA608String()

static std::string CUtf8Helpers::Utf8ToCEA608String ( const std::string &  inUtf8Str,
const NTV2Line21Channel  inChannel = NTV2_CC608_CC1 
)
static

Converts the given UTF8-encoded string into a string that can be used in the CNTV2CaptionEncoder608's Enqueue____Message calls. "Special" characters that are supported in the CEA-608 extended character sets will be replaced with a three-byte sequence – the first byte being the ASCII equivalent (for compatibility with decoders that don't handle the extended character sets), and the subsequent two-byte CEA-608 byte sequence that's appropriate for the given caption channel.

Parameters
[in]inUtf8StrThe string containing UTF8-encoded characters to be converted.
[in]inChannelThe caption channel to be used. Defaults to NTV2_CC608_CC1.
Returns
The CEA-608 equivalent string that can be passed into any of the Enqueue____Message functions.

The documentation for this class was generated from the following file: