Public Types | Static Public Member Functions | List of all members
utf8_writer Struct Reference

Public Types

typedef uint8_tvalue_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

Definition at line 785 of file pugixml.cpp.

Member Function Documentation

◆ any()

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

Definition at line 822 of file pugixml.cpp.

823 {
824 return (ch < 0x10000) ? low(result, ch) : high(result, ch);
825 }
static value_type high(value_type result, uint32_t ch)
Definition pugixml.cpp:812
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 
)
inlinestatic

Definition at line 812 of file pugixml.cpp.

813 {
814 // U+10000..U+10FFFF
815 result[0] = static_cast<uint8_t>(0xF0 | (ch >> 18));
816 result[1] = static_cast<uint8_t>(0x80 | ((ch >> 12) & 0x3F));
817 result[2] = static_cast<uint8_t>(0x80 | ((ch >> 6) & 0x3F));
818 result[3] = static_cast<uint8_t>(0x80 | (ch & 0x3F));
819 return result + 4;
820 }
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 
)
inlinestatic

Definition at line 787 of file pugixml.cpp.

788 {
789 // U+0000..U+007F
790 if (ch < 0x80)
791 {
792 *result = static_cast<uint8_t>(ch);
793 return result + 1;
794 }
795 // U+0080..U+07FF
796 else if (ch < 0x800)
797 {
798 result[0] = static_cast<uint8_t>(0xC0 | (ch >> 6));
799 result[1] = static_cast<uint8_t>(0x80 | (ch & 0x3F));
800 return result + 2;
801 }
802 // U+0800..U+FFFF
803 else
804 {
805 result[0] = static_cast<uint8_t>(0xE0 | (ch >> 12));
806 result[1] = static_cast<uint8_t>(0x80 | ((ch >> 6) & 0x3F));
807 result[2] = static_cast<uint8_t>(0x80 | (ch & 0x3F));
808 return result + 3;
809 }
810 }

Referenced by any().


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

Generated on Sat Feb 3 2024 04:23:15 for QuickFIX by doxygen 1.9.8 written by Dimitri van Heesch, © 1997-2001