summaryrefslogtreecommitdiff
path: root/plugins/adplug/libbinio/binwrap.h
blob: 74b009f693fd4b88d27b1a60e42155c5745c8156 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
/*
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 * 
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 * binwrap.h - Binary I/O wrapper, using standard iostreams library
 * Copyright (C) 2002, 2003 Simon Peter <dn.tlp@gmx.net>
 */

#ifndef H_BINIO_BINWRAP
#define H_BINIO_BINWRAP

#include "binio.h"

#if BINIO_ENABLE_IOSTREAM

#if BINIO_ISO_STDLIB
#include <iostream>

using std::iostream;
using std::ostream;
using std::istream;
using std::ios;
using std::streambuf;
#else

#include <iostream.h>

#endif

class biniwstream: public binistream
{
public:
  biniwstream(istream *istr);
  virtual ~biniwstream();

  virtual void seek(long pos, Offset offs = Set);
  virtual long pos();

protected:
  virtual Byte getByte();

private:
  istream *in;
};

class binowstream: public binostream
{
public:
  binowstream(ostream *ostr);
  virtual ~binowstream();

  virtual void seek(long pos, Offset offs = Set);
  virtual long pos();

protected:
  virtual void putByte(Byte b);

private:
  ostream *out;
};

class binwstream: public biniwstream, public binowstream
{
public:
  binwstream(iostream *str);
  virtual ~binwstream();

  virtual void seek(long pos, Offset offs = Set);
  virtual long pos();

protected:
  virtual Byte getByte();
  virtual void putByte(Byte b);

private:
  iostream *io;
};

#endif

#endif