HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
Files | Data Structures | Functions
Character Maps

Files

file  ascii.hpp
 Definition of the ASCII character map.
 
file  char_converter.hpp
 Definition of the char_converter<From,To> functor.
 
file  cp_1252.hpp
 Definition of the CP-1252 / Windows-1252 character map.
 
file  iso_8859_1.hpp
 Definition of the ISO-8859-1 / Latin-1 character map.
 
file  to_string.hpp
 String conversion functions.
 
file  utf_32.hpp
 Definition of the Unicode UTF-32 encoding.
 
file  utf_8.hpp
 Definition of the Unicode UTF-8 encoding.
 

Data Structures

struct  hi::v1::char_map<"ascii">
 ASCII (7-bit) character map. More...
 
struct  hi::v1::char_map< Encoding >
 Character encoder/decoder template. More...
 
struct  hi::v1::char_converter< From, To >
 A converter between character encodings. More...
 
struct  hi::v1::char_map<"cp-1252">
 CP-1252 / Windows-1252 character map. More...
 
struct  hi::v1::char_map<"iso-8859-1">
 ISO-8859-1 / Latin-1 character map. More...
 
struct  hi::v1::char_map<"utf-16">
 Unicode UTF-16 encoding. More...
 
struct  hi::v1::char_map<"utf-32">
 Unicode UTF-32 encoding. More...
 
struct  hi::v1::char_map<"utf-8">
 Unicode UTF-8 encoding. More...
 

Functions

constexpr std::u32string hi::v1::to_u32string (std::u32string_view rhs) noexcept
 Identity conversion from UTF-32 to UTF-32.
 
constexpr std::u32string hi::v1::to_u32string (std::u16string_view rhs) noexcept
 Conversion from UTF-16 to UTF-32.
 
constexpr std::u32string hi::v1::to_u32string (std::u8string_view rhs) noexcept
 Conversion from UTF-8 to UTF-32.
 
constexpr std::u32string hi::v1::to_u32string (std::wstring_view rhs) noexcept
 Conversion from wide-string (UTF-16/32) to UTF-32.
 
constexpr std::u32string hi::v1::to_u32string (std::string_view rhs) noexcept
 Conversion from UTF-8 to UTF-32.
 
constexpr std::u16string hi::v1::to_u16string (std::u32string_view rhs) noexcept
 Conversion from UTF-32 to UTF-16.
 
constexpr std::u16string hi::v1::to_u16string (std::u16string_view rhs) noexcept
 Identity conversion from UTF-16 to UTF-16.
 
constexpr std::u16string hi::v1::to_u16string (std::u8string_view rhs) noexcept
 Conversion from UTF-8 to UTF-16.
 
constexpr std::u16string hi::v1::to_u16string (std::wstring_view rhs) noexcept
 Conversion from wide-string (UTF-16/32) to UTF-16.
 
constexpr std::u16string hi::v1::to_u16string (std::string_view rhs) noexcept
 Conversion from UTF-8 to UTF-16.
 
constexpr std::u8string hi::v1::to_u8string (std::u32string_view rhs) noexcept
 Conversion from UTF-32 to UTF-8.
 
constexpr std::u8string hi::v1::to_u8string (std::u16string_view rhs) noexcept
 Conversion from UTF-16 to UTF-8.
 
constexpr std::u8string hi::v1::to_u8string (std::u8string_view rhs) noexcept
 Identity conversion from UTF-8 to UTF-8.
 
constexpr std::u8string hi::v1::to_u8string (std::wstring_view rhs) noexcept
 Conversion from wide-string (UTF-16/32) to UTF-8.
 
constexpr std::u8string hi::v1::to_u8string (std::string_view rhs) noexcept
 Conversion from UTF-8 to UTF-8.
 
constexpr std::wstring hi::v1::to_wstring (std::u32string_view rhs) noexcept
 Conversion from UTF-32 to wide-string (UTF-16/32).
 
constexpr std::wstring hi::v1::to_wstring (std::u16string_view rhs) noexcept
 Conversion from UTF-16 to wide-string (UTF-16/32).
 
constexpr std::wstring hi::v1::to_wstring (std::u8string_view rhs) noexcept
 Conversion from UTF-8 to wide-string (UTF-16/32).
 
constexpr std::wstring hi::v1::to_wstring (std::wstring_view rhs) noexcept
 Identity conversion from wide-string (UTF-16/32) to wide-string (UTF-16/32).
 
constexpr std::wstring hi::v1::to_wstring (std::string_view rhs) noexcept
 Conversion from UTF-8 to wide-string (UTF-16/32).
 
constexpr std::string hi::v1::to_string (std::u32string_view rhs) noexcept
 Conversion from UTF-32 to UTF-8.
 
constexpr std::string hi::v1::to_string (std::u16string_view rhs) noexcept
 Conversion from UTF-16 to UTF-8.
 
constexpr std::string hi::v1::to_string (std::u8string_view rhs) noexcept
 Identity conversion from UTF-8 to UTF-8.
 
constexpr std::string hi::v1::to_string (std::wstring_view rhs) noexcept
 Conversion from wide-string (UTF-16/32) to UTF-8.
 
constexpr std::string hi::v1::to_string (std::string_view rhs) noexcept
 Conversion from UTF-8 to UTF-8.
 

Detailed Description

These templates are uses to convert between different character encodings.

You can also convert between the same character encoding, this can be done to 'repair' invalid encodings. For example when converting from ASCII to ASCII any characters in the original string above 127 will be replaced with a question mark '?' after conversion. For UTF-8 to UTF-8 invalid encodings may be interpreted as CP-1252 and correctly converted to the unicode equivalent, or the replacement character U+fffd.

Here is an example to convert a string from ISO-8859-1 to UTF-8:

std::string latin1_to_utf8(std::string_view str)
{
return hi::char_converter<"iso-8859-1", "utf-8">{}(str);
}
A converter between character encodings.
Definition char_converter.hpp:98

Currently supported are:

It is possible to add character encodings by specializing char_map<> in your application.

Function Documentation

◆ to_string() [1/5]

constexpr std::string hi::v1::to_string ( std::string_view rhs)
constexprnoexcept

Conversion from UTF-8 to UTF-8.

◆ to_string() [2/5]

constexpr std::string hi::v1::to_string ( std::u16string_view rhs)
constexprnoexcept

Conversion from UTF-16 to UTF-8.

◆ to_string() [3/5]

constexpr std::string hi::v1::to_string ( std::u32string_view rhs)
constexprnoexcept

Conversion from UTF-32 to UTF-8.

◆ to_string() [4/5]

constexpr std::string hi::v1::to_string ( std::u8string_view rhs)
constexprnoexcept

Identity conversion from UTF-8 to UTF-8.

◆ to_string() [5/5]

constexpr std::string hi::v1::to_string ( std::wstring_view rhs)
constexprnoexcept

Conversion from wide-string (UTF-16/32) to UTF-8.

◆ to_u16string() [1/5]

constexpr std::u16string hi::v1::to_u16string ( std::string_view rhs)
constexprnoexcept

Conversion from UTF-8 to UTF-16.

◆ to_u16string() [2/5]

constexpr std::u16string hi::v1::to_u16string ( std::u16string_view rhs)
constexprnoexcept

Identity conversion from UTF-16 to UTF-16.

◆ to_u16string() [3/5]

constexpr std::u16string hi::v1::to_u16string ( std::u32string_view rhs)
constexprnoexcept

Conversion from UTF-32 to UTF-16.

◆ to_u16string() [4/5]

constexpr std::u16string hi::v1::to_u16string ( std::u8string_view rhs)
constexprnoexcept

Conversion from UTF-8 to UTF-16.

◆ to_u16string() [5/5]

constexpr std::u16string hi::v1::to_u16string ( std::wstring_view rhs)
constexprnoexcept

Conversion from wide-string (UTF-16/32) to UTF-16.

◆ to_u32string() [1/5]

constexpr std::u32string hi::v1::to_u32string ( std::string_view rhs)
constexprnoexcept

Conversion from UTF-8 to UTF-32.

◆ to_u32string() [2/5]

constexpr std::u32string hi::v1::to_u32string ( std::u16string_view rhs)
constexprnoexcept

Conversion from UTF-16 to UTF-32.

◆ to_u32string() [3/5]

constexpr std::u32string hi::v1::to_u32string ( std::u32string_view rhs)
constexprnoexcept

Identity conversion from UTF-32 to UTF-32.

◆ to_u32string() [4/5]

constexpr std::u32string hi::v1::to_u32string ( std::u8string_view rhs)
constexprnoexcept

Conversion from UTF-8 to UTF-32.

◆ to_u32string() [5/5]

constexpr std::u32string hi::v1::to_u32string ( std::wstring_view rhs)
constexprnoexcept

Conversion from wide-string (UTF-16/32) to UTF-32.

◆ to_u8string() [1/5]

constexpr std::u8string hi::v1::to_u8string ( std::string_view rhs)
constexprnoexcept

Conversion from UTF-8 to UTF-8.

◆ to_u8string() [2/5]

constexpr std::u8string hi::v1::to_u8string ( std::u16string_view rhs)
constexprnoexcept

Conversion from UTF-16 to UTF-8.

◆ to_u8string() [3/5]

constexpr std::u8string hi::v1::to_u8string ( std::u32string_view rhs)
constexprnoexcept

Conversion from UTF-32 to UTF-8.

◆ to_u8string() [4/5]

constexpr std::u8string hi::v1::to_u8string ( std::u8string_view rhs)
constexprnoexcept

Identity conversion from UTF-8 to UTF-8.

◆ to_u8string() [5/5]

constexpr std::u8string hi::v1::to_u8string ( std::wstring_view rhs)
constexprnoexcept

Conversion from wide-string (UTF-16/32) to UTF-8.

◆ to_wstring() [1/5]

constexpr std::wstring hi::v1::to_wstring ( std::string_view rhs)
constexprnoexcept

Conversion from UTF-8 to wide-string (UTF-16/32).

◆ to_wstring() [2/5]

constexpr std::wstring hi::v1::to_wstring ( std::u16string_view rhs)
constexprnoexcept

Conversion from UTF-16 to wide-string (UTF-16/32).

◆ to_wstring() [3/5]

constexpr std::wstring hi::v1::to_wstring ( std::u32string_view rhs)
constexprnoexcept

Conversion from UTF-32 to wide-string (UTF-16/32).

◆ to_wstring() [4/5]

constexpr std::wstring hi::v1::to_wstring ( std::u8string_view rhs)
constexprnoexcept

Conversion from UTF-8 to wide-string (UTF-16/32).

◆ to_wstring() [5/5]

constexpr std::wstring hi::v1::to_wstring ( std::wstring_view rhs)
constexprnoexcept

Identity conversion from wide-string (UTF-16/32) to wide-string (UTF-16/32).