Geant4 11.4.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
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 1486 of file pugixml.cc.

Member Typedef Documentation

◆ value_type

typedef uint8_t* utf8_writer::value_type

Definition at line 1488 of file pugixml.cc.

Member Function Documentation

◆ any()

value_type utf8_writer::any ( value_type result,
uint32_t ch )
inlinestatic

Definition at line 1525 of file pugixml.cc.

1526 {
1527 return (ch < 0x10000) ? low(result, ch) : high(result, ch);
1528 }
static value_type high(value_type result, uint32_t ch)
Definition pugixml.cc:1515
static value_type low(value_type result, uint32_t ch)
Definition pugixml.cc:1490

Referenced by strconv_escape().

◆ high()

value_type utf8_writer::high ( value_type result,
uint32_t ch )
inlinestatic

Definition at line 1515 of file pugixml.cc.

1516 {
1517 // U+10000..U+10FFFF
1518 result[0] = static_cast<uint8_t>(0xF0 | (ch >> 18));
1519 result[1] = static_cast<uint8_t>(0x80 | ((ch >> 12) & 0x3F));
1520 result[2] = static_cast<uint8_t>(0x80 | ((ch >> 6) & 0x3F));
1521 result[3] = static_cast<uint8_t>(0x80 | (ch & 0x3F));
1522 return result + 4;
1523 }

Referenced by any().

◆ low()

value_type utf8_writer::low ( value_type result,
uint32_t ch )
inlinestatic

Definition at line 1490 of file pugixml.cc.

1491 {
1492 // U+0000..U+007F
1493 if (ch < 0x80)
1494 {
1495 *result = static_cast<uint8_t>(ch);
1496 return result + 1;
1497 }
1498 // U+0080..U+07FF
1499 else if (ch < 0x800)
1500 {
1501 result[0] = static_cast<uint8_t>(0xC0 | (ch >> 6));
1502 result[1] = static_cast<uint8_t>(0x80 | (ch & 0x3F));
1503 return result + 2;
1504 }
1505 // U+0800..U+FFFF
1506 else
1507 {
1508 result[0] = static_cast<uint8_t>(0xE0 | (ch >> 12));
1509 result[1] = static_cast<uint8_t>(0x80 | ((ch >> 6) & 0x3F));
1510 result[2] = static_cast<uint8_t>(0x80 | (ch & 0x3F));
1511 return result + 3;
1512 }
1513 }

Referenced by any().


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