Geant4 11.4.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
utf16_decoder< opt_swap > Struct Template Reference

Public Types

typedef uint16_t type

Static Public Member Functions

template<typename Traits>
static Traits::value_type process (const uint16_t *data, size_t size, typename Traits::value_type result, Traits)

Detailed Description

template<typename opt_swap>
struct utf16_decoder< opt_swap >

Definition at line 1703 of file pugixml.cc.

Member Typedef Documentation

◆ type

template<typename opt_swap>
typedef uint16_t utf16_decoder< opt_swap >::type

Definition at line 1705 of file pugixml.cc.

Member Function Documentation

◆ process()

template<typename opt_swap>
template<typename Traits>
Traits::value_type utf16_decoder< opt_swap >::process ( const uint16_t * data,
size_t size,
typename Traits::value_type result,
Traits  )
inlinestatic

Definition at line 1707 of file pugixml.cc.

1708 {
1709 while (size)
1710 {
1712
1713 // U+0000..U+D7FF
1714 if (lead < 0xD800)
1715 {
1717 data += 1;
1718 size -= 1;
1719 }
1720 // U+E000..U+FFFF
1721 else if (static_cast<unsigned int>(lead - 0xE000) < 0x2000)
1722 {
1724 data += 1;
1725 size -= 1;
1726 }
1727 // surrogate pair lead
1728 else if (static_cast<unsigned int>(lead - 0xD800) < 0x400 && size >= 2)
1729 {
1731
1732 if (static_cast<unsigned int>(next - 0xDC00) < 0x400)
1733 {
1734 result = Traits::high(result, 0x10000 + ((lead & 0x3ff) << 10) + (next & 0x3ff));
1735 data += 2;
1736 size -= 2;
1737 }
1738 else
1739 {
1740 data += 1;
1741 size -= 1;
1742 }
1743 }
1744 else
1745 {
1746 data += 1;
1747 size -= 1;
1748 }
1749 }
1750
1751 return result;
1752 }
PUGI__NS_END PUGI__NS_BEGIN uint16_t endian_swap(uint16_t value)
Definition pugixml.cc:1455

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