Loading...
Searching...
No Matches

Provides utility functions to convert from and to any unicode and ASCII encoding. More...

#include <SFML/System/Unicode.hpp>

Classes

class  Text
 This class is an abstract definition of a unicode text, it can be converted from and to any kind of string and encoding. More...

Public Types

typedef std::basic_string< Uint8 > UTF8String
 Define a string type for each encoding Warning : in UTF8 and UTF16 strings, one element doesn't necessarily maps to one character ; only an UTF32 element is wide enough to hold all possible unicode values.
typedef std::basic_string< Uint16 > UTF16String
typedef std::basic_string< Uint32 > UTF32String

Static Public Member Functions

template<typename In, typename Out>
static Out UTF32ToANSI (In Begin, In End, Out Output, char Replacement='?', const std::locale &Locale=GetDefaultLocale())
 Generic function to convert an UTF-32 characters range to an ANSI characters range, using the given locale.
template<typename In, typename Out>
static Out ANSIToUTF32 (In Begin, In End, Out Output, const std::locale &Locale=GetDefaultLocale())
 Generic function to convert an ANSI characters range to an UTF-32 characters range, using the given locale.
template<typename In, typename Out>
static Out UTF8ToUTF16 (In Begin, In End, Out Output, Uint16 Replacement='?')
 Generic function to convert an UTF-8 characters range to an UTF-16 characters range, using the given locale.
template<typename In, typename Out>
static Out UTF8ToUTF32 (In Begin, In End, Out Output, Uint32 Replacement='?')
 Generic function to convert an UTF-8 characters range to an UTF-32 characters range, using the given locale.
template<typename In, typename Out>
static Out UTF16ToUTF8 (In Begin, In End, Out Output, Uint8 Replacement='?')
 Generic function to convert an UTF-16 characters range to an UTF-8 characters range, using the given locale.
template<typename In, typename Out>
static Out UTF16ToUTF32 (In Begin, In End, Out Output, Uint32 Replacement='?')
 Generic function to convert an UTF-16 characters range to an UTF-32 characters range, using the given locale.
template<typename In, typename Out>
static Out UTF32ToUTF8 (In Begin, In End, Out Output, Uint8 Replacement='?')
 Generic function to convert an UTF-32 characters range to an UTF-8 characters range, using the given locale.
template<typename In, typename Out>
static Out UTF32ToUTF16 (In Begin, In End, Out Output, Uint16 Replacement='?')
 Generic function to convert an UTF-32 characters range to an UTF-16 characters range, using the given locale.
template<typename In>
static std::size_t GetUTF8Length (In Begin, In End)
 Get the number of characters composing an UTF-8 string.
template<typename In>
static std::size_t GetUTF16Length (In Begin, In End)
 Get the number of characters composing an UTF-16 string.
template<typename In>
static std::size_t GetUTF32Length (In Begin, In End)
 Get the number of characters composing an UTF-32 string.

Detailed Description

Provides utility functions to convert from and to any unicode and ASCII encoding.

Definition at line 44 of file Unicode.hpp.

Member Typedef Documentation

◆ UTF16String

typedef std::basic_string<Uint16> sf::Unicode::UTF16String

Definition at line 55 of file Unicode.hpp.

◆ UTF32String

typedef std::basic_string<Uint32> sf::Unicode::UTF32String

Definition at line 56 of file Unicode.hpp.

◆ UTF8String

typedef std::basic_string<Uint8> sf::Unicode::UTF8String

Define a string type for each encoding Warning : in UTF8 and UTF16 strings, one element doesn't necessarily maps to one character ; only an UTF32 element is wide enough to hold all possible unicode values.

Definition at line 54 of file Unicode.hpp.

Member Function Documentation

◆ ANSIToUTF32()

template<typename In, typename Out>
Out sf::Unicode::ANSIToUTF32 ( In Begin,
In End,
Out Output,
const std::locale & Locale = GetDefaultLocale() )
static

Generic function to convert an ANSI characters range to an UTF-32 characters range, using the given locale.

Parameters
Begin: Iterator pointing to the beginning of the input sequence
End: Iterator pointing to the end of the input sequence
Output: Iterator pointing to the beginning of the output sequence
Locale: Locale to use for conversion (uses the current one by default)
Returns
Iterator to the end of the output sequence which has been written

◆ GetUTF16Length()

template<typename In>
std::size_t sf::Unicode::GetUTF16Length ( In Begin,
In End )
static

Get the number of characters composing an UTF-16 string.

Parameters
Begin: Iterator pointing to the beginning of the input sequence
End: Iterator pointing to the end of the input sequence
Returns
Count of the characters in the string

◆ GetUTF32Length()

template<typename In>
std::size_t sf::Unicode::GetUTF32Length ( In Begin,
In End )
static

Get the number of characters composing an UTF-32 string.

Parameters
Begin: Iterator pointing to the beginning of the input sequence
End: Iterator pointing to the end of the input sequence
Returns
Count of the characters in the string

◆ GetUTF8Length()

template<typename In>
std::size_t sf::Unicode::GetUTF8Length ( In Begin,
In End )
static

Get the number of characters composing an UTF-8 string.

Parameters
Begin: Iterator pointing to the beginning of the input sequence
End: Iterator pointing to the end of the input sequence
Returns
Count of the characters in the string

◆ UTF16ToUTF32()

template<typename In, typename Out>
Out sf::Unicode::UTF16ToUTF32 ( In Begin,
In End,
Out Output,
Uint32 Replacement = '?' )
static

Generic function to convert an UTF-16 characters range to an UTF-32 characters range, using the given locale.

Parameters
Begin: Iterator pointing to the beginning of the input sequence
End: Iterator pointing to the end of the input sequence
Output: Iterator pointing to the beginning of the output sequence
Replacement: Replacement character for characters not convertible to output encoding ('?' by default – use 0 to use no replacement character)
Returns
Iterator to the end of the output sequence which has been written

◆ UTF16ToUTF8()

template<typename In, typename Out>
Out sf::Unicode::UTF16ToUTF8 ( In Begin,
In End,
Out Output,
Uint8 Replacement = '?' )
static

Generic function to convert an UTF-16 characters range to an UTF-8 characters range, using the given locale.

Parameters
Begin: Iterator pointing to the beginning of the input sequence
End: Iterator pointing to the end of the input sequence
Output: Iterator pointing to the beginning of the output sequence
Replacement: Replacement character for characters not convertible to output encoding ('?' by default – use 0 to use no replacement character)
Returns
Iterator to the end of the output sequence which has been written

◆ UTF32ToANSI()

template<typename In, typename Out>
Out sf::Unicode::UTF32ToANSI ( In Begin,
In End,
Out Output,
char Replacement = '?',
const std::locale & Locale = GetDefaultLocale() )
static

Generic function to convert an UTF-32 characters range to an ANSI characters range, using the given locale.

Parameters
Begin: Iterator pointing to the beginning of the input sequence
End: Iterator pointing to the end of the input sequence
Output: Iterator pointing to the beginning of the output sequence
Replacement: Replacement character for characters not convertible to output encoding ('?' by default – use 0 to use no replacement character)
Locale: Locale to use for conversion (uses the current one by default)
Returns
Iterator to the end of the output sequence which has been written

◆ UTF32ToUTF16()

template<typename In, typename Out>
Out sf::Unicode::UTF32ToUTF16 ( In Begin,
In End,
Out Output,
Uint16 Replacement = '?' )
static

Generic function to convert an UTF-32 characters range to an UTF-16 characters range, using the given locale.

Parameters
Begin: Iterator pointing to the beginning of the input sequence
End: Iterator pointing to the end of the input sequence
Output: Iterator pointing to the beginning of the output sequence
Replacement: Replacement character for characters not convertible to output encoding ('?' by default – use 0 to use no replacement character)
Returns
Iterator to the end of the output sequence which has been written

◆ UTF32ToUTF8()

template<typename In, typename Out>
Out sf::Unicode::UTF32ToUTF8 ( In Begin,
In End,
Out Output,
Uint8 Replacement = '?' )
static

Generic function to convert an UTF-32 characters range to an UTF-8 characters range, using the given locale.

Parameters
Begin: Iterator pointing to the beginning of the input sequence
End: Iterator pointing to the end of the input sequence
Output: Iterator pointing to the beginning of the output sequence
Replacement: Replacement character for characters not convertible to output encoding ('?' by default – use 0 to use no replacement character)
Returns
Iterator to the end of the output sequence which has been written

◆ UTF8ToUTF16()

template<typename In, typename Out>
Out sf::Unicode::UTF8ToUTF16 ( In Begin,
In End,
Out Output,
Uint16 Replacement = '?' )
static

Generic function to convert an UTF-8 characters range to an UTF-16 characters range, using the given locale.

Parameters
Begin: Iterator pointing to the beginning of the input sequence
End: Iterator pointing to the end of the input sequence
Output: Iterator pointing to the beginning of the output sequence
Replacement: Replacement character for characters not convertible to output encoding ('?' by default – use 0 to use no replacement character)
Returns
Iterator to the end of the output sequence which has been written

◆ UTF8ToUTF32()

template<typename In, typename Out>
Out sf::Unicode::UTF8ToUTF32 ( In Begin,
In End,
Out Output,
Uint32 Replacement = '?' )
static

Generic function to convert an UTF-8 characters range to an UTF-32 characters range, using the given locale.

Parameters
Begin: Iterator pointing to the beginning of the input sequence
End: Iterator pointing to the end of the input sequence
Output: Iterator pointing to the beginning of the output sequence
Replacement: Replacement character for characters not convertible to output encoding ('?' by default – use 0 to use no replacement character)
Returns
Iterator to the end of the output sequence which has been written

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