utf8_writer Struct Reference

## Public Types

typedef uint8_t * | value_type

## Static Public Member Functions

static value_type | low (value_type result, uint32_t ch)
static value_type | high (value_type result, uint32_t ch)
static value_type | any (value_type result, uint32_t ch)

## Detailed Description

Definition at line 783 of file pugixml.cpp.

## Member Typedef Documentation

## value_type

typedef uint8_t* utf8_writer::value_type

Definition at line 785 of file pugixml.cpp.

## Member Function Documentation

## any()

static value_type utf8_writer::any | ( | value_type | result,
|  | uint32_t | ch
| ) |  |

inline static

Definition at line 822 of file pugixml.cpp.

{
return (ch < 0x10000) ? low(result, ch) : high(result, ch);
}
utf8_writer::high
static value_type high(value_type result, uint32_t ch)
Definition pugixml.cpp:812
utf8_writer::low
static value_type low(value_type result, uint32_t ch)
Definition pugixml.cpp:787

References high(), and low().

Referenced by strconv_escape().

## high()

static value_type utf8_writer::high | ( | value_type | result,
|  | uint32_t | ch
| ) |  |

inline static

Definition at line 812 of file pugixml.cpp.

{
// U+10000..U+10FFFF
result[0] = static_cast<uint8_t>(0xF0 | (ch >> 18));
result[1] = static_cast<uint8_t>(0x80 | ((ch >> 12) & 0x3F));
result[2] = static_cast<uint8_t>(0x80 | ((ch >> 6) & 0x3F));
result[3] = static_cast<uint8_t>(0x80 | (ch & 0x3F));
return result + 4;
}
uint8_t
unsigned char uint8_t
Definition stdint_msvc.h:79

Referenced by any().

## low()

static value_type utf8_writer::low | ( | value_type | result,
|  | uint32_t | ch
| ) |  |

inline static

Definition at line 787 of file pugixml.cpp.

{
// U+0000..U+007F
if (ch < 0x80)
{
*result = static_cast<uint8_t>(ch);
return result + 1;
}
// U+0080..U+07FF
else if (ch < 0x800)
{
result[0] = static_cast<uint8_t>(0xC0 | (ch >> 6));
result[1] = static_cast<uint8_t>(0x80 | (ch & 0x3F));
return result + 2;
}
// U+0800..U+FFFF
else
{
result[0] = static_cast<uint8_t>(0xE0 | (ch >> 12));
result[1] = static_cast<uint8_t>(0x80 | ((ch >> 6) & 0x3F));
result[2] = static_cast<uint8_t>(0x80 | (ch & 0x3F));
return result + 3;
}
}

Referenced by any().

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

- pugixml.cpp