4 #ifndef UNIVALUE_UTFFILTER_H 5 #define UNIVALUE_UTFFILTER_H 31 }
else if (ch < 0xf0) {
34 }
else if (ch < 0xf8) {
40 if ((ch & 0xc0) != 0x80)
53 if (codepoint_ >= 0xD800 && codepoint_ < 0xDC00) {
58 }
else if (codepoint_ >= 0xDC00 && codepoint_ < 0xE000) {
101 if (codepoint_ <= 0x7f)
102 str.push_back((
char)codepoint_);
103 else if (codepoint_ <= 0x7FF) {
104 str.push_back((
char)(0xC0 | (codepoint_ >> 6)));
105 str.push_back((
char)(0x80 | (codepoint_ & 0x3F)));
106 }
else if (codepoint_ <= 0xFFFF) {
107 str.push_back((
char)(0xE0 | (codepoint_ >> 12)));
108 str.push_back((
char)(0x80 | ((codepoint_ >> 6) & 0x3F)));
109 str.push_back((
char)(0x80 | (codepoint_ & 0x3F)));
110 }
else if (codepoint_ <= 0x1FFFFF) {
111 str.push_back((
char)(0xF0 | (codepoint_ >> 18)));
112 str.push_back((
char)(0x80 | ((codepoint_ >> 12) & 0x3F)));
113 str.push_back((
char)(0x80 | ((codepoint_ >> 6) & 0x3F)));
114 str.push_back((
char)(0x80 | (codepoint_ & 0x3F)));
void append_codepoint(unsigned int codepoint_)
void push_back(unsigned char ch)
Filter that generates and validates UTF-8, as well as collates UTF-16 surrogate pairs as specified in...
uint32_t ch(uint32_t x, uint32_t y, uint32_t z)
void push_back_u(unsigned int codepoint_)
JSONUTF8StringFilter(std::string &s)