MCPcopy Create free account
hub / github.com/AbyssEngine/AbyssEngineOld / StreamReader

Class StreamReader

src/Abyss/Streams/StreamReader.h:12–46  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10namespace Abyss::Streams {
11
12class StreamReader {
13 FileSystem::InputStream &_inputStream;
14
15 public:
16 explicit StreamReader(FileSystem::InputStream &inputStream);
17 [[nodiscard]] uint8_t readByte() const;
18 void readBytes(std::span<uint8_t> data) const;
19 void readBytes(std::span<int8_t> data) const;
20 void readBytes(std::span<char> data) const;
21 void readBytes(std::span<std::byte> data) const;
22 [[nodiscard]] uint8_t readUInt8();
23 [[nodiscard]] int8_t readInt8();
24 [[nodiscard]] uint16_t readUInt16();
25 [[nodiscard]] int16_t readInt16();
26 [[nodiscard]] uint32_t readUInt32();
27 [[nodiscard]] int32_t readInt32();
28 [[nodiscard]] uint64_t readUInt64();
29 [[nodiscard]] int64_t readInt64();
30
31 // Reads until 0 byte.
32 [[nodiscard]] std::string readString();
33
34 template <std::unsigned_integral T> T readUnsigned() {
35 T result = 0;
36
37 for (auto i = 0; i < static_cast<int>(sizeof(T)); i++) {
38 result |= static_cast<T>(readByte()) << (8 * i);
39 }
40
41 return result;
42 }
43
44 void skip(int64_t numBytes);
45 void seek(int64_t numBytes);
46};
47
48} // namespace Abyss::Streams

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected