Panda3D
 All Classes Functions Variables Enumerations
subStreamBuf.h
1 // Filename: subStreamBuf.h
2 // Created by: drose (02Aug02)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #ifndef SUBSTREAMBUF_H
16 #define SUBSTREAMBUF_H
17 
18 #include "pandabase.h"
19 #include "streamWrapper.h"
20 
21 ////////////////////////////////////////////////////////////////////
22 // Class : SubStreamBuf
23 // Description : The streambuf object that implements ISubStream.
24 ////////////////////////////////////////////////////////////////////
25 class EXPCL_PANDAEXPRESS SubStreamBuf : public streambuf {
26 public:
27  SubStreamBuf();
28  virtual ~SubStreamBuf();
29 
30  void open(IStreamWrapper *source, OStreamWrapper *dest, streampos start, streampos end, bool append);
31  void close();
32 
33  virtual streampos seekoff(streamoff off, ios_seekdir dir, ios_openmode which);
34  virtual streampos seekpos(streampos pos, ios_openmode which);
35 
36 protected:
37  virtual int overflow(int c);
38  virtual int sync();
39  virtual int underflow();
40 
41 private:
42  IStreamWrapper *_source;
43  OStreamWrapper *_dest;
44  streampos _start;
45  streampos _end;
46  bool _append;
47  streampos _gpos;
48  streampos _ppos;
49  char *_buffer;
50 };
51 
52 #endif
This class provides a locking wrapper around an arbitrary istream pointer.
Definition: streamWrapper.h:53
The streambuf object that implements ISubStream.
Definition: subStreamBuf.h:25
This class provides a locking wrapper around an arbitrary ostream pointer.
Definition: streamWrapper.h:81