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

Method TryReadChar

src/core/string_consumer.hpp:383–388  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

381 * Try to read a 8-bit character, and then advance reader.
382 */
383 [[nodiscard]] std::optional<char> TryReadChar()
384 {
385 auto value = this->PeekChar();
386 if (value.has_value()) this->SkipChar();
387 return value;
388 }
389 /**
390 * Read 8-bit character, and advance reader.
391 * @param def Default value to return, if not enough data.

Callers

nothing calls this directly

Calls 2

PeekCharMethod · 0.95
SkipCharMethod · 0.95

Tested by

no test coverage detected