Panda3D

Loading...
Searching...
No Matches
zStream.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 zStream.h
10 * @author drose
11 * @date 2002-08-05
12 */
13
14#ifndef ZSTREAM_H
15#define ZSTREAM_H
16
17#include "pandabase.h"
18
19// This module is not compiled if zlib is not available.
20#ifdef HAVE_ZLIB
21
22#include "zStreamBuf.h"
23
24/**
25 * An input stream object that uses zlib to decompress (inflate) the input
26 * from another source stream on-the-fly.
27 *
28 * Attach an IDecompressStream to an existing istream that provides compressed
29 * data, and read the corresponding uncompressed data from the
30 * IDecompressStream.
31 *
32 * Seeking is not supported.
33 */
34 class EXPCL_PANDA_EXPRESS IDecompressStream : public std::istream {
35PUBLISHED:
36 INLINE IDecompressStream();
37 INLINE explicit IDecompressStream(std::istream *source, bool owns_source);
38
39#if _MSC_VER >= 1800
40 INLINE IDecompressStream(const IDecompressStream &copy) = delete;
41#endif
42
43 INLINE IDecompressStream &open(std::istream *source, bool owns_source);
44 INLINE IDecompressStream &close();
45
46 private:
47 ZStreamBuf _buf;
48};
49
50/**
51 * An input stream object that uses zlib to compress (deflate) data to another
52 * destination stream on-the-fly.
53 *
54 * Attach an OCompressStream to an existing ostream that will accept
55 * compressed data, and write your uncompressed source data to the
56 * OCompressStream.
57 *
58 * Seeking is not supported.
59 */
60 class EXPCL_PANDA_EXPRESS OCompressStream : public std::ostream {
61PUBLISHED:
62 INLINE OCompressStream();
63 INLINE explicit OCompressStream(std::ostream *dest, bool owns_dest,
64 int compression_level = 6);
65
66#if _MSC_VER >= 1800
67 INLINE OCompressStream(const OCompressStream &copy) = delete;
68#endif
69
70 INLINE OCompressStream &open(std::ostream *dest, bool owns_dest,
71 int compression_level = 6);
72 INLINE OCompressStream &close();
73
74 private:
75 ZStreamBuf _buf;
76};
77
78#include "zStream.I"
79
80#endif // HAVE_ZLIB
81
82
83#endif
pandabase.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
zStreamBuf.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
zStream.I
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.