MCPcopy Create free account
hub / github.com/bytedance/bolt / decodeCurrentCodePoint

Method decodeCurrentCodePoint

bolt/type/Tokenizer.cpp:241–260  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

239}
240
241DefaultTokenizer::CodePointInfo DefaultTokenizer::decodeCurrentCodePoint() {
242 if (index_ >= path_.size()) {
243 return {0, 0};
244 }
245
246 const unsigned char* p =
247 reinterpret_cast<const unsigned char*>(path_.data() + index_);
248 const unsigned char* e =
249 reinterpret_cast<const unsigned char*>(path_.data() + path_.size());
250 const unsigned char* start = p;
251
252 bool skipOnError = false;
253 try {
254 char32_t cp = folly::utf8ToCodePoint(p, e, skipOnError);
255 return {cp, static_cast<size_t>(p - start)};
256 } catch (const std::exception&) {
257 invalidSubfieldPath(); // Throws BoltRuntimeError
258 return {0, 0}; // Unreachable
259 }
260}
261
262char32_t DefaultTokenizer::peekCodePoint() {
263 if (index_ >= path_.size()) {

Callers

nothing calls this directly

Calls 2

sizeMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected