# sf::Unicode Class Reference

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

`#include <Unicode.hpp>`

List of all members.

## 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

## Public Member Functions

template<typename In , typename Out >
Out | UTF32ToANSI (In Begin, In End, Out Output, char Replacement, const std::locale &Locale)
| Generic function to convert an UTF-32 characters range to an ANSI characters range, using the given locale.
template<typename In , typename Out >
Out | ANSIToUTF32 (In Begin, In End, Out Output, const std::locale &Locale)
| Generic function to convert an ANSI characters range to an UTF-32 characters range, using the given locale.
template<typename In , typename Out >
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 >
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 >
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 >
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 >
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 >
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 >
std::size_t | GetUTF8Length (In Begin, In End)
| Get the number of characters composing an UTF-8 string.
template<typename In >
std::size_t | GetUTF16Length (In Begin, In End)
| Get the number of characters composing an UTF-16 string.
template<typename In >
std::size_t | GetUTF32Length (In Begin, In End)
| Get the number of characters composing an UTF-32 string.

## 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

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

template<typename In , typename Out >

Out sf::Unicode::ANSIToUTF32 | ( | In | Begin,
|  | In | End,
|  | Out | Output,
|  | const std::locale & | Locale |
| ) |  |  | `[inline]`

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

Definition at line 67 of file Unicode.inl.

template<typename In , typename Out >

static Out sf::Unicode::ANSIToUTF32 | ( | In | Begin,
|  | In | End,
|  | Out | Output,
|  | const std::locale & | Locale = `GetDefaultLocale()` |
| ) |  |  | `[inline, 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

template<typename In >

std::size_t sf::Unicode::GetUTF16Length | ( | In | Begin,
|  | In | End |
| ) |  |  | `[inline]`

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

Definition at line 442 of file Unicode.inl.

template<typename In >

static std::size_t sf::Unicode::GetUTF16Length | ( | In | Begin,
|  | In | End |
| ) |  |  | `[inline, 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

template<typename In >

std::size_t sf::Unicode::GetUTF32Length | ( | In | Begin,
|  | In | End |
| ) |  |  | `[inline]`

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

Definition at line 471 of file Unicode.inl.

template<typename In >

static std::size_t sf::Unicode::GetUTF32Length | ( | In | Begin,
|  | In | End |
| ) |  |  | `[inline, 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

template<typename In >

std::size_t sf::Unicode::GetUTF8Length | ( | In | Begin,
|  | In | End |
| ) |  |  | `[inline]`

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

Definition at line 422 of file Unicode.inl.

template<typename In >

static std::size_t sf::Unicode::GetUTF8Length | ( | In | Begin,
|  | In | End |
| ) |  |  | `[inline, 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

template<typename In , typename Out >

Out sf::Unicode::UTF16ToUTF32 | ( | In | Begin,
|  | In | End,
|  | Out | Output,
|  | Uint32 | Replacement |
| ) |  |  | `[inline]`

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

Definition at line 280 of file Unicode.inl.

template<typename In , typename Out >

static Out sf::Unicode::UTF16ToUTF32 | ( | In | Begin,
|  | In | End,
|  | Out | Output,
|  | Uint32 | Replacement = `'?'` |
| ) |  |  | `[inline, 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

template<typename In , typename Out >

Out sf::Unicode::UTF16ToUTF8 | ( | In | Begin,
|  | In | End,
|  | Out | Output,
|  | Uint8 | Replacement |
| ) |  |  | `[inline]`

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

Definition at line 207 of file Unicode.inl.

template<typename In , typename Out >

static Out sf::Unicode::UTF16ToUTF8 | ( | In | Begin,
|  | In | End,
|  | Out | Output,
|  | Uint8 | Replacement = `'?'` |
| ) |  |  | `[inline, 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

template<typename In , typename Out >

Out sf::Unicode::UTF32ToANSI | ( | In | Begin,
|  | In | End,
|  | Out | Output,
|  | char | Replacement,
|  | const std::locale & | Locale |
| ) |  |  | `[inline]`

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

Definition at line 31 of file Unicode.inl.

template<typename In , typename Out >

static Out sf::Unicode::UTF32ToANSI | ( | In | Begin,
|  | In | End,
|  | Out | Output,
|  | char | Replacement = `'?'`,
|  | const std::locale & | Locale = `GetDefaultLocale()` |
| ) |  |  | `[inline, 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

template<typename In , typename Out >

Out sf::Unicode::UTF32ToUTF16 | ( | In | Begin,
|  | In | End,
|  | Out | Output,
|  | Uint16 | Replacement |
| ) |  |  | `[inline]`

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

Definition at line 379 of file Unicode.inl.

template<typename In , typename Out >

static Out sf::Unicode::UTF32ToUTF16 | ( | In | Begin,
|  | In | End,
|  | Out | Output,
|  | Uint16 | Replacement = `'?'` |
| ) |  |  | `[inline, 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

template<typename In , typename Out >

Out sf::Unicode::UTF32ToUTF8 | ( | In | Begin,
|  | In | End,
|  | Out | Output,
|  | Uint8 | Replacement |
| ) |  |  | `[inline]`

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

Definition at line 326 of file Unicode.inl.

template<typename In , typename Out >

static Out sf::Unicode::UTF32ToUTF8 | ( | In | Begin,
|  | In | End,
|  | Out | Output,
|  | Uint8 | Replacement = `'?'` |
| ) |  |  | `[inline, 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

template<typename In , typename Out >

Out sf::Unicode::UTF8ToUTF16 | ( | In | Begin,
|  | In | End,
|  | Out | Output,
|  | Uint16 | Replacement |
| ) |  |  | `[inline]`

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

Definition at line 102 of file Unicode.inl.

template<typename In , typename Out >

static Out sf::Unicode::UTF8ToUTF16 | ( | In | Begin,
|  | In | End,
|  | Out | Output,
|  | Uint16 | Replacement = `'?'` |
| ) |  |  | `[inline, 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

template<typename In , typename Out >

Out sf::Unicode::UTF8ToUTF32 | ( | In | Begin,
|  | In | End,
|  | Out | Output,
|  | Uint32 | Replacement |
| ) |  |  | `[inline]`

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

Definition at line 163 of file Unicode.inl.

template<typename In , typename Out >

static Out sf::Unicode::UTF8ToUTF32 | ( | In | Begin,
|  | In | End,
|  | Out | Output,
|  | Uint32 | Replacement = `'?'` |
| ) |  |  | `[inline, 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 files:

- Unicode.hpp
- Unicode.inl
- Unicode.cpp