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

Method TryReadUtf8

src/core/string_consumer.hpp:412–418  ·  view source on GitHub ↗

* Try to read a UTF-8 character, and then advance reader. */

Source from the content-addressed store, hash-verified

410 * Try to read a UTF-8 character, and then advance reader.
411 */
412 [[nodiscard]] std::optional<char32_t> TryReadUtf8()
413 {
414 auto [len, value] = this->PeekUtf8();
415 if (len == 0) return std::nullopt;
416 this->Skip(len);
417 return value;
418 }
419 /**
420 * Read UTF-8 character, and advance reader.
421 * @param def Default value to return, if no valid data.

Callers 7

TranslateTTDPatchCodesFunction · 0.80
StrMakeValidFunction · 0.80
StrValidFunction · 0.80
IConsoleAliasExecFunction · 0.80
IConsoleCmdExecFunction · 0.80
HandleStringMethod · 0.80
FixSCCEncodedFunction · 0.80

Calls 2

PeekUtf8Method · 0.95
SkipMethod · 0.95

Tested by

no test coverage detected