Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of Boost. Click here to view this page for the latest version.
Boost.Nowide
Public Types | Static Public Member Functions | Static Public Attributes | List of all members
boost::nowide::utf::utf_traits< CharType, size > Struct Template Reference

UTF Traits class - functions to convert UTF sequences to and from Unicode code points. More...

#include <boost/nowide/utf/utf.hpp>

Public Types

using char_type = CharType
 

Static Public Member Functions

template<typename Iterator >
static code_point decode (Iterator &p, Iterator e)
 
static int width (code_point value)
 
static int trail_length (char_type c)
 
static bool is_trail (char_type c)
 
static bool is_lead (char_type c)
 
template<typename Iterator >
static Iterator encode (code_point value, Iterator out)
 
template<typename Iterator >
static code_point decode_valid (Iterator &p)
 

Static Public Attributes

static const int max_width
 

Detailed Description

template<typename CharType, int size = sizeof(CharType)>
struct boost::nowide::utf::utf_traits< CharType, size >

UTF Traits class - functions to convert UTF sequences to and from Unicode code points.

Member Typedef Documentation

◆ char_type

template<typename CharType , int size = sizeof(CharType)>
using boost::nowide::utf::utf_traits< CharType, size >::char_type = CharType

The type of the character

Member Function Documentation

◆ decode()

template<typename CharType , int size = sizeof(CharType)>
template<typename Iterator >
static code_point boost::nowide::utf::utf_traits< CharType, size >::decode ( Iterator &  p,
Iterator  e 
)
static

Read one code point from the range [p,e) and return it.

  • If the sequence that was read is incomplete sequence returns incomplete,
  • If illegal sequence detected returns illegal

Requirements

  • Iterator is valid input iterator

Postconditions

  • p points to the last consumed character

◆ decode_valid()

template<typename CharType , int size = sizeof(CharType)>
template<typename Iterator >
static code_point boost::nowide::utf::utf_traits< CharType, size >::decode_valid ( Iterator &  p)
static

Decodes valid UTF sequence that is pointed by p into code point.

If the sequence is invalid or points to end the behavior is undefined

◆ encode()

template<typename CharType , int size = sizeof(CharType)>
template<typename Iterator >
static Iterator boost::nowide::utf::utf_traits< CharType, size >::encode ( code_point  value,
Iterator  out 
)
static

Convert valid Unicode code point value to the UTF sequence.

Requirements:

  • value is valid code point
  • out is an output iterator should be able to accept at least width(value) units

Returns the iterator past the last written code unit.

◆ is_lead()

template<typename CharType , int size = sizeof(CharType)>
static bool boost::nowide::utf::utf_traits< CharType, size >::is_lead ( char_type  c)
static

Returns true if c is lead code unit, always true of UTF-32

◆ is_trail()

template<typename CharType , int size = sizeof(CharType)>
static bool boost::nowide::utf::utf_traits< CharType, size >::is_trail ( char_type  c)
static

Returns true if c is trail code unit, always false for UTF-32

◆ trail_length()

template<typename CharType , int size = sizeof(CharType)>
static int boost::nowide::utf::utf_traits< CharType, size >::trail_length ( char_type  c)
static

Get the size of the trail part of variable length encoded sequence.

Returns -1 if C is not valid lead character

◆ width()

template<typename CharType , int size = sizeof(CharType)>
static int boost::nowide::utf::utf_traits< CharType, size >::width ( code_point  value)
static

The width of specific code point in the code units.

Requirement: value is a valid Unicode code point Returns value in range [1..max_width]

Member Data Documentation

◆ max_width

template<typename CharType , int size = sizeof(CharType)>
const int boost::nowide::utf::utf_traits< CharType, size >::max_width
static

Maximal width of valid sequence in the code units:

  • UTF-8 - 4
  • UTF-16 - 2
  • UTF-32 - 1

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