Panda3D
 All Classes Functions Variables Enumerations
decompressor.h
1 // Filename: decompressor.h
2 // Created by: mike (09Jan97)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #ifndef DECOMPRESSOR_H
16 #define DECOMPRESSOR_H
17 
18 #include "pandabase.h"
19 
20 #ifdef HAVE_ZLIB
21 
22 #include "filename.h"
23 
24 class Ramfile;
25 
26 ////////////////////////////////////////////////////////////////////
27 // Class : Decompressor
28 // Description : This manages run-time decompression of a
29 // zlib-compressed stream, as a background or foreground
30 // task.
31 ////////////////////////////////////////////////////////////////////
32 class EXPCL_PANDAEXPRESS Decompressor {
33 PUBLISHED:
34  Decompressor();
35  ~Decompressor();
36 
37  int initiate(const Filename &source_file);
38  int initiate(const Filename &source_file, const Filename &dest_file);
39  int run();
40 
41  bool decompress(const Filename &source_file);
42  bool decompress(Ramfile &source_and_dest_file);
43 
44  PN_stdfloat get_progress() const;
45 
46 private:
47  void cleanup();
48 
49  Filename _source_filename;
50 
51  istream *_source;
52  istream *_decompress;
53  ostream *_dest;
54 
55  size_t _source_length;
56 };
57 
58 #include "decompressor.I"
59 
60 #endif // HAVE_ZLIB
61 
62 #endif
The name of a file, such as a texture file or an Egg file.
Definition: filename.h:44
An in-memory buffer specifically designed for downloading files to memory.
Definition: ramfile.h:27