HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
Public Types | Public Member Functions
hi::v1::char_converter< From, To > Struct Template Reference

#include <hikogui/char_maps/char_converter.hpp>

Public Types

using from_encoder_type = char_map<From>
 
using to_encoder_type = char_map<To>
 
using from_char_type = from_encoder_type::char_type
 
using to_char_type = to_encoder_type::char_type
 
using from_string_type = std::basic_string<from_char_type>
 
using to_string_type = std::basic_string<to_char_type>
 

Public Member Functions

template<typename OutRange , typename InRange >
constexpr OutRange convert (InRange &&src) const noexcept
 Convert text between the given encodings.
 
template<typename OutRange , typename It , typename EndIt >
constexpr OutRange convert (It first, EndIt last) const noexcept
 Convert text between the given encodings.
 
template<typename OutRange = std::basic_string<to_char_type>>
OutRange read (void const *ptr, size_t size, std::endian endian=std::endian::native) noexcept
 Read text from a byte array.
 
template<typename InRange >
constexpr to_string_type operator() (InRange &&src) const noexcept
 Convert text between the given encodings.
 

Detailed Description

template<fixed_string From, fixed_string To>
struct hi::v1::char_converter< From, To >

A converter between character encodings.

Template Parameters
Froma string-tag matching an existing char_map<From>
Toa string-tag matching an existing char_map<To>

Member Function Documentation

◆ convert() [1/2]

template<fixed_string From, fixed_string To>
template<typename OutRange , typename InRange >
constexpr OutRange hi::v1::char_converter< From, To >::convert ( InRange && src) const
inlineconstexprnoexcept

Convert text between the given encodings.

Template Parameters
OutRangeThe output type
Parameters
srcThe text to be converted.
Returns
The converted text.

◆ convert() [2/2]

template<fixed_string From, fixed_string To>
template<typename OutRange , typename It , typename EndIt >
constexpr OutRange hi::v1::char_converter< From, To >::convert ( It first,
EndIt last ) const
inlineconstexprnoexcept

Convert text between the given encodings.

Template Parameters
OutRangeThe output type
Parameters
firstAn iterator pointing to the first character to be converted.
lastAn iterator pointing one beyond the last character to be converted, or a sentinel.
Returns
The converted text.

◆ operator()()

template<fixed_string From, fixed_string To>
template<typename InRange >
constexpr to_string_type hi::v1::char_converter< From, To >::operator() ( InRange && src) const
inlineconstexprnoexcept

Convert text between the given encodings.

Parameters
srcThe text to be converted.
Returns
The converted text as a std::basic_string<to_char_type>.

◆ read()

template<fixed_string From, fixed_string To>
template<typename OutRange = std::basic_string<to_char_type>>
OutRange hi::v1::char_converter< From, To >::read ( void const * ptr,
size_t size,
std::endian endian = std::endian::native )
inlinenoexcept

Read text from a byte array.

Template Parameters
OutRangeThe output type
Parameters
ptrA pointer to a byte array containing the text in the From encoding.
sizeThe number of bytes in the array.
endianThe endianness of characters in the array, used as a hint.
Returns
The converted text.

The documentation for this struct was generated from the following file: