utf8ToUcs2 overloads

Synopses

Declared in <bdlde_charconvertucs2.h>

Load into result the UCS‐2 conversion of the null‐terminated UTF‐8 srcString. Return 0 on success and a non‐zero status otherwise.

static
int
utf8ToUcs2(
    bsl::vector<unsigned short>* result,
    char const* srcString,
    unsigned short errorCharacter = '?');

Load into result the UCS‐2 conversion of the null‐terminated UTF‐8 srcString. Return 0 on success and a non‐zero status otherwise.

static
int
utf8ToUcs2(
    std::pmr::vector<unsigned short>* result,
    char const* srcString,
    unsigned short errorCharacter = '?');

Load into result the UCS‐2 conversion of the null‐terminated UTF‐8 srcString. Return 0 on success and a non‐zero status otherwise.

static
int
utf8ToUcs2(
    std::vector<unsigned short>* result,
    char const* srcString,
    unsigned short errorCharacter = '?');

Load, into the specified dstBuffer of the specified dstCapacity, the result of converting the specified null‐terminated UTF‐8 srcString to its UCS‐2 equivalent. Optionally specify numCharsWritten which (if non‐zero) indicates the modifiable integer into which the number of characters written (including the null terminator) is to be loaded. Optionally specify errorCharacter to be substituted for invalid (i.e., not convertible to UCS‐2) input characters. If errorCharacter is 0, invalid input characters are ignored (i.e., produce no corresponding output characters). Return 0 on success and a bitwise‐or of the masks specified by CharConvertStatus::Enum otherwise, with CharConvertStatus::k_INVALID_INPUT_BIT set to indicate that at least one invalid input sequence was encountered, and CharConvertStatus::k_OUT_OF_SPACE_BIT set to indicate that dstCapacity was insufficient to accommodate the output. If dstCapacity was insufficient, the maximal null‐terminated prefix of the properly converted result string is loaded into dstBuffer, and (unless null) *numCharsWritten is set to dstCapacity. The behavior is undefined unless 0 <= dstCapacity, dstBuffer refers to an array of at least dstCapacity elements, and srcString is null‐terminated. Note that if dstCapacity is 0, this function returns exactly 2 and *numCharsWritten (if specified) is loaded with 0 (since there is insufficient space for the null terminator even for an empty input string).

static
int
utf8ToUcs2(
    unsigned short* dstBuffer,
    std::size_t dstCapacity,
    char const* srcString,
    std::size_t* numCharsWritten = 0,
    unsigned short errorCharacter = '?');

Created with MrDocs