spo/simulator_SIC_XE/include/reader.h
2025-11-17 13:07:24 +01:00

21 lines
No EOL
669 B
C++

#ifndef READER_H
#define READER_H
#include <string>
#include <cstdint>
// Abstract Reader class: read bytes/strings from a source (file, string, etc.)
class Reader {
public:
virtual ~Reader() = default;
// return 0..255 on success, -1 on EOF/error
virtual int readByte() = 0;
// read exactly len bytes into buf; return true on success
virtual bool readBytes(uint8_t* buf, size_t len) = 0;
// read up to len bytes into a std::string; may return shorter string on EOF
virtual std::string readString(size_t len) = 0;
// read a line (up to newline), return empty string on EOF
virtual std::string readLine() = 0;
};
#endif // READER_H