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