]> 4ch.mooo.com Git - 16.git/blob - 16/adplug/libbinio-1.4/src/binwrap.h
Please enter the commit message for your changes. Lines starting
[16.git] / 16 / adplug / libbinio-1.4 / src / binwrap.h
1 /*
2  * This library is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU Lesser General Public
4  * License as published by the Free Software Foundation; either
5  * version 2.1 of the License, or (at your option) any later version.
6  * 
7  * This library is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
10  * Lesser General Public License for more details.
11  * 
12  * You should have received a copy of the GNU Lesser General Public
13  * License along with this library; if not, write to the Free Software
14  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
15  *
16  * binwrap.h - Binary I/O wrapper, using standard iostreams library
17  * Copyright (C) 2002, 2003 Simon Peter <dn.tlp@gmx.net>
18  */
19
20 #ifndef H_BINIO_BINWRAP
21 #define H_BINIO_BINWRAP
22
23 #include "binio.h"
24
25 #if BINIO_ENABLE_IOSTREAM
26
27 #if BINIO_ISO_STDLIB
28 #include <iostream>
29
30 using std::iostream;
31 using std::ostream;
32 using std::istream;
33 using std::ios;
34 using std::streambuf;
35 #else
36
37 #include <iostream.h>
38
39 #endif
40
41 class biniwstream: public binistream
42 {
43 public:
44   biniwstream(istream *istr);
45   virtual ~biniwstream();
46
47   virtual void seek(long pos, Offset offs = Set);
48   virtual long pos();
49
50 protected:
51   virtual Byte getByte();
52
53 private:
54   istream *in;
55 };
56
57 class binowstream: public binostream
58 {
59 public:
60   binowstream(ostream *ostr);
61   virtual ~binowstream();
62
63   virtual void seek(long pos, Offset offs = Set);
64   virtual long pos();
65
66 protected:
67   virtual void putByte(Byte b);
68
69 private:
70   ostream *out;
71 };
72
73 class binwstream: public biniwstream, public binowstream
74 {
75 public:
76   binwstream(iostream *str);
77   virtual ~binwstream();
78
79   virtual void seek(long pos, Offset offs = Set);
80   virtual long pos();
81
82 protected:
83   virtual Byte getByte();
84   virtual void putByte(Byte b);
85
86 private:
87   iostream *io;
88 };
89
90 #endif
91
92 #endif