Panda3D
|
00001 // Filename: zStream.h 00002 // Created by: drose (05Aug02) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 #ifndef ZSTREAM_H 00016 #define ZSTREAM_H 00017 00018 #include "pandabase.h" 00019 00020 // This module is not compiled if zlib is not available. 00021 #ifdef HAVE_ZLIB 00022 00023 #include "zStreamBuf.h" 00024 00025 //////////////////////////////////////////////////////////////////// 00026 // Class : IDecompressStream 00027 // Description : An input stream object that uses zlib to decompress 00028 // (inflate) the input from another source stream 00029 // on-the-fly. 00030 // 00031 // Attach an IDecompressStream to an existing istream that 00032 // provides compressed data, and read the corresponding 00033 // uncompressed data from the IDecompressStream. 00034 // 00035 // Seeking is not supported. 00036 //////////////////////////////////////////////////////////////////// 00037 class EXPCL_PANDAEXPRESS IDecompressStream : public istream { 00038 PUBLISHED: 00039 INLINE IDecompressStream(); 00040 INLINE IDecompressStream(istream *source, bool owns_source); 00041 00042 INLINE IDecompressStream &open(istream *source, bool owns_source); 00043 INLINE IDecompressStream &close(); 00044 00045 private: 00046 ZStreamBuf _buf; 00047 }; 00048 00049 //////////////////////////////////////////////////////////////////// 00050 // Class : OCompressStream 00051 // Description : An input stream object that uses zlib to compress 00052 // (deflate) data to another destination stream 00053 // on-the-fly. 00054 // 00055 // Attach an OCompressStream to an existing ostream that will 00056 // accept compressed data, and write your uncompressed 00057 // source data to the OCompressStream. 00058 // 00059 // Seeking is not supported. 00060 //////////////////////////////////////////////////////////////////// 00061 class EXPCL_PANDAEXPRESS OCompressStream : public ostream { 00062 PUBLISHED: 00063 INLINE OCompressStream(); 00064 INLINE OCompressStream(ostream *dest, bool owns_dest, 00065 int compression_level = 6); 00066 00067 INLINE OCompressStream &open(ostream *dest, bool owns_dest, 00068 int compression_level = 6); 00069 INLINE OCompressStream &close(); 00070 00071 private: 00072 ZStreamBuf _buf; 00073 }; 00074 00075 #include "zStream.I" 00076 00077 #endif // HAVE_ZLIB 00078 00079 00080 #endif 00081 00082