Deskflow 1.22.0.197
Keyboard and mouse sharing utility
Loading...
Searching...
No Matches
Unicode Class Reference

Unicode utility functions. More...

#include <Unicode.h>

accessors

static bool isUTF8 (const std::string &)
 Test UTF-8 string for validity.
static std::string UTF8ToUCS2 (const std::string &, bool *errors=nullptr)
 Convert from UTF-8 to UCS-2 encoding.
static std::string UTF8ToUCS4 (const std::string &, bool *errors=nullptr)
 Convert from UTF-8 to UCS-4 encoding.
static std::string UTF8ToUTF16 (const std::string &, bool *errors=nullptr)
 Convert from UTF-8 to UTF-16 encoding.
static std::string UTF8ToUTF32 (const std::string &, bool *errors=nullptr)
 Convert from UTF-8 to UTF-32 encoding.
static std::string UTF8ToText (const std::string &, bool *errors=nullptr)
 Convert from UTF-8 to the current locale encoding.
static std::string UCS2ToUTF8 (const std::string_view &, bool *errors=nullptr)
 Convert from UCS-2 to UTF-8.
static std::string UCS4ToUTF8 (const std::string_view &, bool *errors=nullptr)
 Convert from UCS-4 to UTF-8.
static std::string UTF16ToUTF8 (const std::string_view &, bool *errors=nullptr)
 Convert from UTF-16 to UTF-8.
static std::string UTF32ToUTF8 (const std::string_view &, bool *errors=nullptr)
 Convert from UTF-32 to UTF-8.
static std::string textToUTF8 (const std::string &, bool *errors=nullptr, ArchString::EWideCharEncoding encoding=ArchString::EWideCharEncoding::kPlatformDetermined)
 Convert from the current locale encoding to UTF-8.

Detailed Description

Unicode utility functions.

This class provides functions for converting between various Unicode encodings and the current locale encoding.

Member Function Documentation

◆ isUTF8()

bool Unicode::isUTF8 ( const std::string & src)
static

Test UTF-8 string for validity.

Returns true iff the string contains a valid sequence of UTF-8 encoded characters.

◆ textToUTF8()

std::string Unicode::textToUTF8 ( const std::string & src,
bool * errors = nullptr,
ArchString::EWideCharEncoding encoding = ArchString::EWideCharEncoding::kPlatformDetermined )
static

Convert from the current locale encoding to UTF-8.

Convert from the current locale encoding to UTF-8. If errors is not nullptr then *errors is set to true iff any character could not be decoded.

◆ UCS2ToUTF8()

std::string Unicode::UCS2ToUTF8 ( const std::string_view & src,
bool * errors = nullptr )
static

Convert from UCS-2 to UTF-8.

Convert from UCS-2 to UTF-8. If errors is not nullptr then *errors is set to true iff any character could not be decoded.

◆ UCS4ToUTF8()

std::string Unicode::UCS4ToUTF8 ( const std::string_view & src,
bool * errors = nullptr )
static

Convert from UCS-4 to UTF-8.

Convert from UCS-4 to UTF-8. If errors is not nullptr then *errors is set to true iff any character could not be decoded.

◆ UTF16ToUTF8()

std::string Unicode::UTF16ToUTF8 ( const std::string_view & src,
bool * errors = nullptr )
static

Convert from UTF-16 to UTF-8.

Convert from UTF-16 to UTF-8. If errors is not nullptr then *errors is set to true iff any character could not be decoded.

◆ UTF32ToUTF8()

std::string Unicode::UTF32ToUTF8 ( const std::string_view & src,
bool * errors = nullptr )
static

Convert from UTF-32 to UTF-8.

Convert from UTF-32 to UTF-8. If errors is not nullptr then *errors is set to true iff any character could not be decoded.

◆ UTF8ToText()

std::string Unicode::UTF8ToText ( const std::string & src,
bool * errors = nullptr )
static

Convert from UTF-8 to the current locale encoding.

Convert from UTF-8 to the current locale encoding. If errors is not nullptr then *errors is set to true iff any character could not be encoded. Decoding errors do not set *errors.

◆ UTF8ToUCS2()

std::string Unicode::UTF8ToUCS2 ( const std::string & src,
bool * errors = nullptr )
static

Convert from UTF-8 to UCS-2 encoding.

Convert from UTF-8 to UCS-2. If errors is not nullptr then *errors is set to true iff any character could not be encoded in UCS-2. Decoding errors do not set *errors.

◆ UTF8ToUCS4()

std::string Unicode::UTF8ToUCS4 ( const std::string & src,
bool * errors = nullptr )
static

Convert from UTF-8 to UCS-4 encoding.

Convert from UTF-8 to UCS-4. If errors is not nullptr then *errors is set to true iff any character could not be encoded in UCS-4. Decoding errors do not set *errors.

◆ UTF8ToUTF16()

std::string Unicode::UTF8ToUTF16 ( const std::string & src,
bool * errors = nullptr )
static

Convert from UTF-8 to UTF-16 encoding.

Convert from UTF-8 to UTF-16. If errors is not nullptr then *errors is set to true iff any character could not be encoded in UTF-16. Decoding errors do not set *errors.

◆ UTF8ToUTF32()

std::string Unicode::UTF8ToUTF32 ( const std::string & src,
bool * errors = nullptr )
static

Convert from UTF-8 to UTF-32 encoding.

Convert from UTF-8 to UTF-32. If errors is not nullptr then *errors is set to true iff any character could not be encoded in UTF-32. Decoding errors do not set *errors.


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