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

Method TryReadIntegerBase

src/core/string_consumer.hpp:874–880  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

872 */
873 template <class T>
874 [[nodiscard]] std::optional<T> TryReadIntegerBase(int base, bool clamp = false)
875 {
876 auto [len, value] = this->PeekIntegerBase<T>(base, clamp);
877 if (len == 0) return std::nullopt;
878 this->SkipIntegerBase(base);
879 return value;
880 }
881 /**
882 * Read and parse an integer in number 'base', and advance the reader.
883 * If 'base == 0', then a prefix '0x' decides between base 16 or base 10.

Callers

nothing calls this directly

Calls 1

SkipIntegerBaseMethod · 0.95

Tested by

no test coverage detected