utf8ToUtf16 overloads

Synopses

Declared in <bdlde_charconvertutf16.h>

Load into the destination the UTF‐16 conversion of the UTF‐8 source.

static
int
utf8ToUtf16(
    bsl::u16string* dstString,
    std::string_view const& srcString,
    std::size_t* numCodePointsWritten = 0,
    char16_t errorChar = '?',
    ByteOrder::Enum byteOrder = ByteOrder::e_HOST);

Load into the destination the UTF‐16 conversion of the UTF‐8 source.

static
int
utf8ToUtf16(
    bsl::u16string* dstString,
    char const* srcString,
    std::size_t* numCodePointsWritten = 0,
    char16_t errorChar = '?',
    ByteOrder::Enum byteOrder = ByteOrder::e_HOST);

Load into the destination the UTF‐16 conversion of the UTF‐8 source.

static
int
utf8ToUtf16(
    std::pmr::u16string* dstString,
    std::string_view const& srcString,
    std::size_t* numCodePointsWritten = 0,
    char16_t errorChar = '?',
    ByteOrder::Enum byteOrder = ByteOrder::e_HOST);

Load into the destination the UTF‐16 conversion of the UTF‐8 source.

static
int
utf8ToUtf16(
    std::pmr::u16string* dstString,
    char const* srcString,
    std::size_t* numCodePointsWritten = 0,
    char16_t errorChar = '?',
    ByteOrder::Enum byteOrder = ByteOrder::e_HOST);

Load into the destination the UTF‐16 conversion of the UTF‐8 source.

static
int
utf8ToUtf16(
    std::u16string* dstString,
    std::string_view const& srcString,
    std::size_t* numCodePointsWritten = 0,
    char16_t errorChar = '?',
    ByteOrder::Enum byteOrder = ByteOrder::e_HOST);

Load into the destination the UTF‐16 conversion of the UTF‐8 source.

static
int
utf8ToUtf16(
    std::u16string* dstString,
    char const* srcString,
    std::size_t* numCodePointsWritten = 0,
    char16_t errorChar = '?',
    ByteOrder::Enum byteOrder = ByteOrder::e_HOST);

Convert the UTF‐8 source to UTF‐16 in the destination.

static
int
utf8ToUtf16(
    bsl::wstring* dstString,
    std::string_view const& srcString,
    std::size_t* numCodePointsWritten = 0,
    wchar_t errorWord = '?',
    ByteOrder::Enum byteOrder = ByteOrder::e_HOST);

Load into the destination the UTF‐16 conversion of the UTF‐8 source.

static
int
utf8ToUtf16(
    bsl::wstring* dstString,
    char const* srcString,
    std::size_t* numCodePointsWritten = 0,
    wchar_t errorWord = '?',
    ByteOrder::Enum byteOrder = ByteOrder::e_HOST);

Load into the destination the UTF‐16 conversion of the UTF‐8 source.

static
int
utf8ToUtf16(
    std::pmr::wstring* dstString,
    std::string_view const& srcString,
    std::size_t* numCodePointsWritten = 0,
    wchar_t errorWord = '?',
    ByteOrder::Enum byteOrder = ByteOrder::e_HOST);

Load into the destination the UTF‐16 conversion of the UTF‐8 source.

static
int
utf8ToUtf16(
    std::pmr::wstring* dstString,
    char const* srcString,
    std::size_t* numCodePointsWritten = 0,
    wchar_t errorWord = '?',
    ByteOrder::Enum byteOrder = ByteOrder::e_HOST);

Load into the destination the UTF‐16 conversion of the UTF‐8 source.

static
int
utf8ToUtf16(
    std::wstring* dstString,
    std::string_view const& srcString,
    std::size_t* numCodePointsWritten = 0,
    wchar_t errorWord = '?',
    ByteOrder::Enum byteOrder = ByteOrder::e_HOST);

Load into the destination the UTF‐16 conversion of the UTF‐8 source.

static
int
utf8ToUtf16(
    std::wstring* dstString,
    char const* srcString,
    std::size_t* numCodePointsWritten = 0,
    wchar_t errorWord = '?',
    ByteOrder::Enum byteOrder = ByteOrder::e_HOST);

Convert the UTF‐8 source to UTF‐16 in the destination.

static
int
utf8ToUtf16(
    bsl::vector<unsigned short>* dstVector,
    std::string_view const& srcString,
    std::size_t* numCodePointsWritten = 0,
    unsigned short errorWord = '?',
    ByteOrder::Enum byteOrder = ByteOrder::e_HOST);

Load into the destination the UTF‐16 conversion of the UTF‐8 source.

static
int
utf8ToUtf16(
    bsl::vector<unsigned short>* dstVector,
    char const* srcString,
    std::size_t* numCodePointsWritten = 0,
    unsigned short errorWord = '?',
    ByteOrder::Enum byteOrder = ByteOrder::e_HOST);

Load into the destination the UTF‐16 conversion of the UTF‐8 source.

static
int
utf8ToUtf16(
    std::pmr::vector<unsigned short>* dstVector,
    std::string_view const& srcString,
    std::size_t* numCodePointsWritten = 0,
    unsigned short errorWord = '?',
    ByteOrder::Enum byteOrder = ByteOrder::e_HOST);

Load into the destination the UTF‐16 conversion of the UTF‐8 source.

static
int
utf8ToUtf16(
    std::pmr::vector<unsigned short>* dstVector,
    char const* srcString,
    std::size_t* numCodePointsWritten = 0,
    unsigned short errorWord = '?',
    ByteOrder::Enum byteOrder = ByteOrder::e_HOST);

Load into the destination the UTF‐16 conversion of the UTF‐8 source.

static
int
utf8ToUtf16(
    std::vector<unsigned short>* dstVector,
    std::string_view const& srcString,
    std::size_t* numCodePointsWritten = 0,
    unsigned short errorWord = '?',
    ByteOrder::Enum byteOrder = ByteOrder::e_HOST);

Load into the destination the UTF‐16 conversion of the UTF‐8 source.

static
int
utf8ToUtf16(
    std::vector<unsigned short>* dstVector,
    char const* srcString,
    std::size_t* numCodePointsWritten = 0,
    unsigned short errorWord = '?',
    ByteOrder::Enum byteOrder = ByteOrder::e_HOST);

Convert the UTF‐8 source to UTF‐16 in the destination.

static
int
utf8ToUtf16(
    char16_t* dstBuffer,
    std::size_t dstCapacity,
    std::string_view const& srcString,
    std::size_t* numCodePointsWritten = 0,
    std::size_t* numWordsWritten = 0,
    char16_t errorChar = '?',
    ByteOrder::Enum byteOrder = ByteOrder::e_HOST);

Load into the destination the UTF‐16 conversion of the UTF‐8 source.

static
int
utf8ToUtf16(
    char16_t* dstBuffer,
    std::size_t dstCapacity,
    char const* srcString,
    std::size_t* numCodePointsWritten = 0,
    std::size_t* numWordsWritten = 0,
    char16_t errorChar = '?',
    ByteOrder::Enum byteOrder = ByteOrder::e_HOST);

Convert the UTF‐8 source to UTF‐16 in the destination.

static
int
utf8ToUtf16(
    unsigned short* dstBuffer,
    std::size_t dstCapacity,
    std::string_view const& srcString,
    std::size_t* numCodePointsWritten = 0,
    std::size_t* numWordsWritten = 0,
    unsigned short errorWord = '?',
    ByteOrder::Enum byteOrder = ByteOrder::e_HOST);

Load into the destination the UTF‐16 conversion of the UTF‐8 source.

static
int
utf8ToUtf16(
    unsigned short* dstBuffer,
    std::size_t dstCapacity,
    char const* srcString,
    std::size_t* numCodePointsWritten = 0,
    std::size_t* numWordsWritten = 0,
    unsigned short errorWord = '?',
    ByteOrder::Enum byteOrder = ByteOrder::e_HOST);

Load into the destination the UTF‐16 conversion of the UTF‐8 source.

static
int
utf8ToUtf16(
    wchar_t* dstBuffer,
    std::size_t dstCapacity,
    std::string_view const& srcString,
    std::size_t* numCodePointsWritten = 0,
    std::size_t* numWordsWritten = 0,
    wchar_t errorWord = '?',
    ByteOrder::Enum byteOrder = ByteOrder::e_HOST);

Load into the destination the UTF‐16 conversion of the UTF‐8 source.

static
int
utf8ToUtf16(
    wchar_t* dstBuffer,
    std::size_t dstCapacity,
    char const* srcString,
    std::size_t* numCodePointsWritten = 0,
    std::size_t* numWordsWritten = 0,
    wchar_t errorWord = '?',
    ByteOrder::Enum byteOrder = ByteOrder::e_HOST);

Return Value

  • 0 on success and a non‐zero status otherwise

  • 0 on success and CharConvertStatus::k_INVALID_INPUT_BIT otherwise

  • 0 on success and a bitwise‐or of the bits specified by CharConvertStatus::Enum otherwise

Parameters

Name

Description

dstString

destination for the converted output

srcString

source string to convert

numCodePointsWritten

if non‐null, set to the code‐point count written

errorChar

replacement for invalid input, or 0 to skip

byteOrder

UTF‐16 byte order; host order if unspecified

errorWord

replacement for invalid input, or 0 to skip

dstVector

destination for the converted output

dstBuffer

destination buffer for the converted output

dstCapacity

capacity of dstBuffer in elements

numWordsWritten

if non‐null, set to the word count written

Created with MrDocs