2 Copyright (C) 2001-2006, William Joseph.
5 This file is part of GtkRadiant.
7 GtkRadiant is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 GtkRadiant is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GtkRadiant; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 #if !defined( INCLUDED_IDATASTREAM_H )
23 #define INCLUDED_IDATASTREAM_H
30 typedef std::size_t size_type;
31 typedef unsigned char byte_type;
34 /// \brief A read-only byte-stream.
35 class InputStream : public StreamBase
38 /// \brief Attempts to read the next \p length bytes from the stream to \p buffer.
39 /// Returns the number of bytes actually stored in \p buffer.
40 virtual size_type read( byte_type* buffer, size_type length ) = 0;
43 /// \brief A write-only byte-stream.
44 class OutputStream : public StreamBase
47 /// \brief Attempts to write \p length bytes to the stream from \p buffer.
48 /// Returns the number of bytes actually read from \p buffer.
49 virtual size_type write( const byte_type* buffer, size_type length ) = 0;
55 typedef int offset_type;
56 typedef std::size_t position_type;
65 /// \brief Sets the current \p position of the stream relative to the start.
66 virtual position_type seek( position_type position ) = 0;
67 /// \brief Sets the current \p position of the stream relative to either the start, end or current position.
68 virtual position_type seek( offset_type offset, seekdir direction ) = 0;
69 /// \brief Returns the current position of the stream.
70 virtual position_type tell() const = 0;
73 /// \brief A seekable read-only byte-stream.
74 class SeekableInputStream : public InputStream, public SeekableStream
78 /// \brief A seekable write-only byte-stream.
79 class SeekableOutputStream : public OutputStream, public SeekableStream