Panda3D
bioStreamBuf.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 bioStreamBuf.h
10  * @author drose
11  * @date 2002-09-25
12  */
13 
14 #ifndef BIOSTREAMBUF_H
15 #define BIOSTREAMBUF_H
16 
17 #include "pandabase.h"
18 
19 // This module is not compiled if OpenSSL is not available.
20 #ifdef HAVE_OPENSSL
21 
22 #include "bioPtr.h"
23 #include "pointerTo.h"
24 
25 /**
26  * The streambuf object that implements IBioStream.
27  */
28 class EXPCL_PANDA_DOWNLOADER BioStreamBuf : public std::streambuf {
29 public:
30  BioStreamBuf();
31  virtual ~BioStreamBuf();
32 
33  void open(BioPtr *source);
34  void close();
35 
36 protected:
37  virtual int overflow(int c);
38  virtual int sync();
39  virtual int underflow();
40 
41 private:
42  size_t write_chars(const char *start, size_t length);
43 
44  PT(BioPtr) _source;
45  bool _read_open;
46  bool _write_open;
47  char *_buffer;
48 
49  friend class IBioStream;
50  friend class OBioStream;
51  friend class BioStream;
52 };
53 
54 #endif // HAVE_OPENSSL
55 
56 #endif
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.