MCPcopy Create free account
hub / github.com/cinder/Cinder / replace_invalid

Function replace_invalid

include/utf8cpp/checked.h:99–127  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

97
98 template <typename octet_iterator, typename output_iterator>
99 output_iterator replace_invalid(octet_iterator start, octet_iterator end, output_iterator out, uint32_t replacement)
100 {
101 while (start != end) {
102 octet_iterator sequence_start = start;
103 internal::utf_error err_code = utf8::internal::validate_next(start, end);
104 switch (err_code) {
105 case internal::UTF8_OK :
106 for (octet_iterator it = sequence_start; it != start; ++it)
107 *out++ = *it;
108 break;
109 case internal::NOT_ENOUGH_ROOM:
110 throw not_enough_room();
111 case internal::INVALID_LEAD:
112 out = utf8::append (replacement, out);
113 ++start;
114 break;
115 case internal::INCOMPLETE_SEQUENCE:
116 case internal::OVERLONG_SEQUENCE:
117 case internal::INVALID_CODE_POINT:
118 out = utf8::append (replacement, out);
119 ++start;
120 // just one replacement mark for the sequence
121 while (start != end && utf8::internal::is_trail(*start))
122 ++start;
123 break;
124 }
125 }
126 return out;
127 }
128
129 template <typename octet_iterator, typename output_iterator>
130 inline output_iterator replace_invalid(octet_iterator start, octet_iterator end, output_iterator out)

Callers

nothing calls this directly

Calls 5

validate_nextFunction · 0.85
not_enough_roomClass · 0.85
is_trailFunction · 0.85
mask16Function · 0.85
appendFunction · 0.70

Tested by

no test coverage detected