idatastream.h

Go to the documentation of this file.
00001 /*
00002 Copyright (C) 2001-2006, William Joseph.
00003 All Rights Reserved.
00004 
00005 This file is part of GtkRadiant.
00006 
00007 GtkRadiant is free software; you can redistribute it and/or modify
00008 it under the terms of the GNU General Public License as published by
00009 the Free Software Foundation; either version 2 of the License, or
00010 (at your option) any later version.
00011 
00012 GtkRadiant is distributed in the hope that it will be useful,
00013 but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015 GNU General Public License for more details.
00016 
00017 You should have received a copy of the GNU General Public License
00018 along with GtkRadiant; if not, write to the Free Software
00019 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
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

Generated by  doxygen 1.6.2