diff options
author | Paul Gilbert | 2019-05-04 15:17:40 +1000 |
---|---|---|
committer | Filippos Karapetis | 2019-05-12 11:44:15 +0300 |
commit | f4dacdf34dbbed1869da26ed970bc2f5cf97685e (patch) | |
tree | bb132ad131947a9aa4f99dc9f7fa73d3c32f3860 /common/stream.h | |
parent | f4d836b8e92655ae00f9b605d2c013887607bda2 (diff) | |
download | scummvm-rg350-f4dacdf34dbbed1869da26ed970bc2f5cf97685e.tar.gz scummvm-rg350-f4dacdf34dbbed1869da26ed970bc2f5cf97685e.tar.bz2 scummvm-rg350-f4dacdf34dbbed1869da26ed970bc2f5cf97685e.zip |
COMMON: Created SeekableWriteStream class
Diffstat (limited to 'common/stream.h')
-rw-r--r-- | common/stream.h | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/common/stream.h b/common/stream.h index fed81c9192..dfb7d6c9b2 100644 --- a/common/stream.h +++ b/common/stream.h @@ -211,6 +211,37 @@ public: }; /** + * Derived abstract base class for write streams streams that are seekable + */ +class SeekableWriteStream : public WriteStream { +public: + /** + * Sets the stream position indicator for the stream. The new position, + * measured in bytes, is obtained by adding offset bytes to the position + * specified by whence. If whence is set to SEEK_SET, SEEK_CUR, or + * SEEK_END, the offset is relative to the start of the file, the current + * position indicator, or end-of-file, respectively. A successful call + * to the seek() method clears the end-of-file indicator for the stream. + * + * @note The semantics of any implementation of this method are + * supposed to match those of ISO C fseek(). + * + * @param offset the relative offset in bytes + * @param whence the seek reference: SEEK_SET, SEEK_CUR, or SEEK_END + * @return true on success, false in case of a failure + */ + virtual bool seek(int32 offset, int whence = SEEK_SET) = 0; + + /** + * Obtains the current size of the stream, measured in bytes. + * If this value is unknown or can not be computed, -1 is returned. + * + * @return the size of the stream, or -1 if an error occurred + */ + virtual int32 size() const = 0; +}; + +/** * Generic interface for a readable data stream. */ class ReadStream : virtual public Stream { |