4#ifndef BITCOIN_UNIVALUE_INCLUDE_UNIVALUE_UTFFILTER_H
5#define BITCOIN_UNIVALUE_INCLUDE_UNIVALUE_UTFFILTER_H
27 }
else if (ch < 0xf0) {
30 }
else if (ch < 0xf8) {
36 if ((ch & 0xc0) != 0x80)
47 if (codepoint_ >= 0xD800 &&
48 codepoint_ < 0xDC00) {
53 }
else if (codepoint_ >= 0xDC00 &&
54 codepoint_ < 0xE000) {
58 (codepoint_ - 0xDC00));
97 if (codepoint_ <= 0x7f)
98 str.push_back((
char)codepoint_);
99 else if (codepoint_ <= 0x7FF) {
100 str.push_back((
char)(0xC0 | (codepoint_ >> 6)));
101 str.push_back((
char)(0x80 | (codepoint_ & 0x3F)));
102 }
else if (codepoint_ <= 0xFFFF) {
103 str.push_back((
char)(0xE0 | (codepoint_ >> 12)));
104 str.push_back((
char)(0x80 | ((codepoint_ >> 6) & 0x3F)));
105 str.push_back((
char)(0x80 | (codepoint_ & 0x3F)));
106 }
else if (codepoint_ <= 0x1FFFFF) {
107 str.push_back((
char)(0xF0 | (codepoint_ >> 18)));
108 str.push_back((
char)(0x80 | ((codepoint_ >> 12) & 0x3F)));
109 str.push_back((
char)(0x80 | ((codepoint_ >> 6) & 0x3F)));
110 str.push_back((
char)(0x80 | (codepoint_ & 0x3F)));
Filter that generates and validates UTF-8, as well as collates UTF-16 surrogate pairs as specified in...
void push_back_u(unsigned int codepoint_)
void append_codepoint(unsigned int codepoint_)
void push_back(uint8_t ch)
JSONUTF8StringFilter(std::string &s)