Panda3D

decompressor.h

00001 // Filename: decompressor.h
00002 // Created by:  mike (09Jan97)
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 DECOMPRESSOR_H
00016 #define DECOMPRESSOR_H
00017 
00018 #include "pandabase.h"
00019 
00020 #ifdef HAVE_ZLIB
00021 
00022 #include "filename.h"
00023 
00024 class Ramfile;
00025 
00026 ////////////////////////////////////////////////////////////////////
00027 //       Class : Decompressor
00028 // Description : This manages run-time decompression of a
00029 //               zlib-compressed stream, as a background or foreground
00030 //               task.
00031 ////////////////////////////////////////////////////////////////////
00032 class EXPCL_PANDAEXPRESS Decompressor {
00033 PUBLISHED:
00034   Decompressor();
00035   ~Decompressor();
00036 
00037   int initiate(const Filename &source_file);
00038   int initiate(const Filename &source_file, const Filename &dest_file);
00039   int run();
00040 
00041   bool decompress(const Filename &source_file);
00042   bool decompress(Ramfile &source_and_dest_file);
00043 
00044   PN_stdfloat get_progress() const;
00045 
00046 private:
00047   void cleanup();
00048 
00049   Filename _source_filename;
00050   
00051   istream *_source;
00052   istream *_decompress;
00053   ostream *_dest;
00054 
00055   size_t _source_length;
00056 };
00057 
00058 #include "decompressor.I"
00059 
00060 #endif  // HAVE_ZLIB
00061 
00062 #endif
 All Classes Functions Variables Enumerations