mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-15 17:49:55 +00:00
69e8f9c9db
- renamed imp_client/ to clients/ and ditto for servers/ - renamed imp/ to servers/ - renamed stream/input.h to stream/stream.h - renamed Stream::InputStream to Stream::Stream - updated various tests and makefiles - NOT TESTED YET
50 lines
1.2 KiB
C++
50 lines
1.2 KiB
C++
#ifndef MANGLE_STREAM_INPUT_H
|
|
#define MANGLE_STREAM_INPUT_H
|
|
|
|
#include <stdlib.h>
|
|
|
|
namespace Mangle {
|
|
namespace Stream {
|
|
|
|
/// An abstract interface for a stream data.
|
|
class Stream
|
|
{
|
|
public:
|
|
// Feature options. These should be set in the constructor.
|
|
|
|
/// If true, seek() works
|
|
bool isSeekable;
|
|
|
|
/// If true, tell() works
|
|
bool hasPosition;
|
|
|
|
/// If true, size() works
|
|
bool hasSize;
|
|
|
|
/// Virtual destructor
|
|
virtual ~Stream() {}
|
|
|
|
/** Read a given number of bytes from the stream. Returns the actual
|
|
number read. If the return value is less than count, then the
|
|
stream is empty or an error occured.
|
|
*/
|
|
virtual size_t read(void* buf, size_t count) = 0;
|
|
|
|
/// Seek to an absolute position in this stream. Not all streams are
|
|
/// seekable.
|
|
virtual void seek(size_t pos) = 0;
|
|
|
|
/// Get the current position in the stream. Non-seekable streams are
|
|
/// not required to keep track of this.
|
|
virtual size_t tell() const = 0;
|
|
|
|
/// Return the total size of the stream. For streams where this is
|
|
/// not applicable, size() should return zero.
|
|
virtual size_t size() const = 0;
|
|
|
|
/// Returns true if the stream is empty
|
|
virtual bool eof() const = 0;
|
|
};
|
|
|
|
}} // namespaces
|
|
#endif
|