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

Method Read

src/core/string_consumer.hpp:530–538  ·  view source on GitHub ↗

* Read the next 'len' bytes, and advance reader. * @param len Bytes to read, 'npos' to read all. * @return Up to 'len' bytes. */

Source from the content-addressed store, hash-verified

528 * @return Up to 'len' bytes.
529 */
530 [[nodiscard]] std::string_view Read(size_type len)
531 {
532 auto result = this->Peek(len);
533 if (len != npos && len != result.size()) {
534 LogError(fmt::format("Source buffer too short: {} > {}", len, result.size()));
535 }
536 this->Skip(result.size());
537 return result;
538 }
539 /**
540 * Discard some bytes.
541 * @param len Number of bytes to skip, 'npos' to skip all.

Callers 2

ReadUntilCharInMethod · 0.95
ReadUntilCharNotInMethod · 0.95

Calls 4

PeekMethod · 0.95
SkipMethod · 0.95
formatFunction · 0.50
sizeMethod · 0.45

Tested by

no test coverage detected