winapi_utf8
Functions
utf8.hpp File Reference

UTF-8 <-> UTF-16 conversion functions. More...

Go to the source code of this file.

Functions

std::wstring winapi::widen (const std::string &)
 
std::wstring winapi::widen (const void *src, std::size_t nb)
 
template<typename T , typename Alloc = std::allocator<T>>
std::wstring winapi::widen (const std::vector< T, Alloc > &src)
 
std::string winapi::narrow (const std::wstring &)
 
std::string winapi::narrow (const std::u16string &)
 
std::string winapi::narrow (const void *src, std::size_t nb)
 
template<typename T , typename Alloc = std::allocator<T>>
std::string winapi::narrow (const std::vector< T, Alloc > &src)
 

Detailed Description

UTF-8 <-> UTF-16 conversion functions.

Definition in file utf8.hpp.

Function Documentation

◆ widen() [1/3]

std::wstring winapi::widen ( const std::string &  src)

Convert UTF-8 string to UTF-16.

Definition at line 99 of file convert.cpp.

◆ widen() [2/3]

std::wstring winapi::widen ( const void *  src,
std::size_t  nb 
)

Convert UTF-8 string to UTF-16.

Parameters
srcMemory address of a UTF-8 string.
nbString size (in bytes).

Definition at line 103 of file convert.cpp.

◆ widen() [3/3]

template<typename T , typename Alloc = std::allocator<T>>
std::wstring winapi::widen ( const std::vector< T, Alloc > &  src)

Convert UTF-8 string to UTF-16.

Parameters
srcBuffer holding a UTF-8 string.

Definition at line 38 of file utf8.hpp.

◆ narrow() [1/4]

std::string winapi::narrow ( const std::wstring &  src)

Convert UTF-16 string to UTF-8.

Definition at line 128 of file convert.cpp.

◆ narrow() [2/4]

std::string winapi::narrow ( const std::u16string &  src)

Convert UTF-16 string to UTF-8.

Definition at line 133 of file convert.cpp.

◆ narrow() [3/4]

std::string winapi::narrow ( const void *  src,
std::size_t  nb 
)

Convert UTF-16 string to UTF-8.

Parameters
srcMemory address of a UTF-16 string.
nbString size (in bytes).

Definition at line 137 of file convert.cpp.

◆ narrow() [4/4]

template<typename T , typename Alloc = std::allocator<T>>
std::string winapi::narrow ( const std::vector< T, Alloc > &  src)

Convert UTF-16 string to UTF-8.

Parameters
srcBuffer holding a UTF-16 string.

Definition at line 60 of file utf8.hpp.