MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / ReadUtf8

Method ReadUtf8

src/core/string_consumer.hpp:425–430  ·  view source on GitHub ↗

* Read UTF-8 character, and advance reader. * @param def Default value to return, if no valid data. * @return Read char, 'def' if no valid data. * @note The reader is advanced, even if no valid data was present. */

Source from the content-addressed store, hash-verified

423 * @note The reader is advanced, even if no valid data was present.
424 */
425 [[nodiscard]] char32_t ReadUtf8(char32_t def = '?')
426 {
427 auto [len, value] = this->PeekUtf8();
428 this->Skip(len > 0 ? len : 1); // advance at least one byte
429 return len > 0 ? value : def;
430 }
431 /**
432 * Skip UTF-8 character, and advance reader.
433 * @note The reader is advanced, even if no valid data was present.

Callers 11

GetKeyboardLayoutFunction · 0.80
ReplaceParamMethod · 0.80
DecodeEncodedStringFunction · 0.80
FormatStringFunction · 0.80
IConsoleAliasExecFunction · 0.80
buf_lexfeedFunction · 0.80
_io_file_lexfeed_UTF8Function · 0.80

Calls 2

PeekUtf8Method · 0.95
SkipMethod · 0.95

Tested by

no test coverage detected