Umasoft
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
vtUnzip.h
1 //
2 // Unzip.h
3 //
4 // Copyright (c) 2006 Virtual Terrain Project
5 // Free for all uses, see license.txt for details.
6 //
7 
8 #ifndef UNZIP_H
9 #define UNZIP_H
10 
11 #include <stdio.h>
12 #include "unzip/unzip.h" // Lower-level 'unzip' library
13 
14 class vtUnzip
15 {
16 public:
17  // Construction
18  vtUnzip();
19 
20  // Operations
21  bool Open(const char *lpszFilePath, zlib_filefunc_def *p = NULL);
22  bool IsOpen(void) const;
23 
24  bool GetGlobalInfo(unz_global_info *) const;
25  int GetGlobalCount(void) const;
26  bool GetGlobalComment(char *szComment, uLong uSizeBuf) const;
27 
28  bool GoToFirstFile(void);
29  bool GoToNextFile(void);
30  bool GetCurrentFileInfo(unz_file_info *pfile_info,
31  char *szFileName = NULL,
32  uLong fileNameBufferSize = 0,
33  void *extraField = NULL,
34  uLong extraFieldBufferSize = 0,
35  char *szComment = NULL,
36  uLong commentBufferSize = 0) const;
37 
38  bool OpenCurrentFile(const char *password = NULL);
39  int ReadCurrentFile(voidp buf, size_t len);
40  bool ExtractCurrentFile(FILE *file, void *buf, size_t buf_size);
41  bool CloseCurrentFile();
42 
43  bool ExtractAccept(const char *write_filename, bool bOverwrite);
44  int Extract(bool bFullPath, bool bOverwrite, const char *lpszDst,
45  bool progress_callback(int) = NULL);
46 
47  bool Attach(unzFile);
48  unzFile Detach(void);
49 
50  operator unzFile(void);
51 
52  static bool change_file_date(const char *filename,uLong dosdate,tm_unz tmu_date);
53 
54 public:
55  // Implementation
56  virtual ~vtUnzip();
57  virtual void Close();
58  int m_error_count;
59  virtual void OnError(const char *lpszFilePath) {}
60 
61 public:
62  // Attributes
63  unzFile m_handle;
64 };
65 
66 #endif // UNZIP_H
67