26 bool eof()
const {
return (_state & eofbit) != 0; }
38 virtual long size() = 0;
46 virtual size_t read(
void* buffer,
size_t size) = 0;
51 static_assert(std::is_trivially_copyable<T>::value,
52 "The type must be trivially copyable to access it as byte storage");
53 return sizeof(out) ==
read(&out,
sizeof(out));
65 virtual long tell() = 0;
73 virtual bool seek(
long offset, seekdir origin) = 0;
78 using StreamPtr = std::unique_ptr<IStream>;
This class reuses the parts of std::ios API but doesn't provide heavy stream functionnality (ie...
An interface for a stream of data.
virtual long size()=0
Compute the size of the file.
bool eof() const
True if the end of the stream was reached during the last read operation.
virtual long tell()=0
Return the current position of the stream pointer.
virtual bool seek(long offset, seekdir origin)=0
Change the pointer of the stream to a given position.
virtual size_t read(void *buffer, size_t size)=0
Read data from the stream.
virtual int getc()
Read one byte from the stream.