idatastream.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #if !defined(INCLUDED_IDATASTREAM_H)
00023 #define INCLUDED_IDATASTREAM_H
00024
00025 #include <cstddef>
00026
00027 class StreamBase {
00028 public:
00029 typedef std::size_t size_type;
00030 typedef unsigned char byte_type;
00031 };
00032
00034 class InputStream : public StreamBase {
00035 public:
00036 virtual ~InputStream(){}
00039 virtual size_type read(byte_type* buffer, size_type length) = 0;
00040 };
00041
00043 class OutputStream : public StreamBase {
00044 public:
00045 virtual ~OutputStream(){}
00048 virtual size_type write(const byte_type* buffer, size_type length) = 0;
00049 };
00050
00051 class SeekableStream {
00052 public:
00053 typedef int offset_type;
00054 typedef std::size_t position_type;
00055
00056 enum seekdir {
00057 beg,
00058 cur,
00059 end,
00060 };
00061
00062 virtual ~SeekableStream(){}
00064 virtual position_type seek(position_type position) = 0;
00066 virtual position_type seek(offset_type offset, seekdir direction) = 0;
00068 virtual position_type tell() const = 0;
00069 };
00070
00072 class SeekableInputStream : public InputStream, public SeekableStream {
00073 };
00074
00076 class SeekableOutputStream : public OutputStream, public SeekableStream {
00077 };
00078
00079 #endif