diff options
author | Chris Wilson <chris+github@qwirx.com> | 2007-04-28 17:11:36 +0000 |
---|---|---|
committer | Chris Wilson <chris+github@qwirx.com> | 2007-04-28 17:11:36 +0000 |
commit | 278b937f6dffbc6b0e5a4a53e0310358acdf1dd5 (patch) | |
tree | 7c51275536d799a541f05d23f72d2c4e149e97be /lib/common/ZeroStream.h | |
parent | 0d5731d7d5848016f51c283fbf87eb2b063df612 (diff) |
Add a stream which provides a source of zero bytes of arbitrary size,
useful for testing support for files over 2GB. (refs #3)
Diffstat (limited to 'lib/common/ZeroStream.h')
-rw-r--r-- | lib/common/ZeroStream.h | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/lib/common/ZeroStream.h b/lib/common/ZeroStream.h new file mode 100644 index 00000000..0119045b --- /dev/null +++ b/lib/common/ZeroStream.h @@ -0,0 +1,39 @@ +// -------------------------------------------------------------------------- +// +// File +// Name: ZeroStream.h +// Purpose: An IOStream which returns all zeroes up to a certain size +// Created: 2007/04/28 +// +// -------------------------------------------------------------------------- + +#ifndef ZEROSTREAM__H +#define ZEROSTREAM__H + +#include "IOStream.h" + +class ZeroStream : public IOStream +{ +private: + IOStream::pos_type mSize, mPosition; + +public: + ZeroStream(IOStream::pos_type mSize); + + virtual int Read(void *pBuffer, int NBytes, int Timeout = IOStream::TimeOutInfinite); + virtual pos_type BytesLeftToRead(); + virtual void Write(const void *pBuffer, int NBytes); + virtual pos_type GetPosition() const; + virtual void Seek(IOStream::pos_type Offset, int SeekType); + virtual void Close(); + + virtual bool StreamDataLeft(); + virtual bool StreamClosed(); + +private: + ZeroStream(const ZeroStream &rToCopy); +}; + +#endif // ZEROSTREAM__H + + |