Panda3D
decompressor.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 decompressor.h
10  * @author mike
11  * @date 1997-01-09
12  */
13 
14 #ifndef DECOMPRESSOR_H
15 #define DECOMPRESSOR_H
16 
17 #include "pandabase.h"
18 
19 #ifdef HAVE_ZLIB
20 
21 #include "filename.h"
22 
23 class Ramfile;
24 
25 /**
26  * This manages run-time decompression of a zlib-compressed stream, as a
27  * background or foreground task.
28  */
29 class EXPCL_PANDA_DOWNLOADER Decompressor {
30 PUBLISHED:
31  Decompressor();
32  ~Decompressor();
33 
34  int initiate(const Filename &source_file);
35  int initiate(const Filename &source_file, const Filename &dest_file);
36  int run();
37 
38  bool decompress(const Filename &source_file);
39  bool decompress(Ramfile &source_and_dest_file);
40 
41  PN_stdfloat get_progress() const;
42 
43 PUBLISHED:
44  MAKE_PROPERTY(progress, get_progress);
45 
46 private:
47  void cleanup();
48 
49  Filename _source_filename;
50 
51  std::istream *_source;
52  std::istream *_decompress;
53  std::ostream *_dest;
54 
55  size_t _source_length;
56 };
57 
58 #include "decompressor.I"
59 
60 #endif // HAVE_ZLIB
61 
62 #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.
The name of a file, such as a texture file or an Egg file.
Definition: filename.h:39
An in-memory buffer specifically designed for downloading files to memory.
Definition: ramfile.h:25