blob: 9312fb2f70eb1dd130bcc6232a5f166efb83fc40 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
|
/************** filamzip H Declares Source Code File (.H) **************/
/* Name: filamzip.h Version 1.0 */
/* */
/* (C) Copyright to the author Olivier BERTRAND 2016 */
/* */
/* This file contains the ZIP file access method classes declares. */
/***********************************************************************/
#ifndef __FILAMZIP_H
#define __FILAMZIP_H
#include "block.h"
#include "filamap.h"
#include "unzip.h"
#define DLLEXPORT extern "C"
typedef class ZIPFAM *PZIPFAM;
typedef class ZPXFAM *PZPXFAM;
/***********************************************************************/
/* This is the ZIP utility fonctions class. */
/***********************************************************************/
class DllExport ZIPUTIL : public BLOCK {
public:
// Constructor
ZIPUTIL(PSZ tgt, bool mul);
//ZIPUTIL(ZIPUTIL *zutp);
// Implementation
//PTXF Duplicate(PGLOBAL g) { return (PTXF) new(g)ZIPFAM(this); }
// Methods
virtual bool OpenTable(PGLOBAL g, MODE mode, char *fn);
bool open(PGLOBAL g, char *fn);
bool openEntry(PGLOBAL g);
void close(void);
void closeEntry(void);
bool WildMatch(PSZ pat, PSZ str);
int findEntry(PGLOBAL g, bool next);
int nextEntry(PGLOBAL g);
// Members
unzFile zipfile; // The ZIP container file
PSZ target; // The target file name
unz_file_info finfo; // The current file info
PFBLOCK fp;
char *memory;
uint size;
int multiple; // Multiple targets
bool entryopen; // True when open current entry
char fn[FILENAME_MAX]; // The current entry file name
char mapCaseTable[256];
}; // end of ZIPFAM
/***********************************************************************/
/* This is the ZIP file access method. */
/***********************************************************************/
class DllExport ZIPFAM : public MAPFAM {
friend class ZPXFAM;
public:
// Constructors
ZIPFAM(PDOSDEF tdp);
ZIPFAM(PZIPFAM txfp);
ZIPFAM(PDOSDEF tdp, PZPXFAM txfp);
// Implementation
virtual AMT GetAmType(void) { return TYPE_AM_ZIP; }
virtual PTXF Duplicate(PGLOBAL g) { return (PTXF) new(g)ZIPFAM(this); }
// Methods
virtual int Cardinality(PGLOBAL g);
virtual int GetFileLength(PGLOBAL g);
//virtual int MaxBlkSize(PGLOBAL g, int s) {return s;}
virtual bool OpenTableFile(PGLOBAL g);
virtual bool DeferReading(void) { return false; }
virtual int GetNext(PGLOBAL g);
//virtual int ReadBuffer(PGLOBAL g);
//virtual int WriteBuffer(PGLOBAL g);
//virtual int DeleteRecords(PGLOBAL g, int irc);
//virtual void CloseTableFile(PGLOBAL g, bool abort);
protected:
// Members
ZIPUTIL *zutp;
PSZ target;
bool mul;
}; // end of ZIPFAM
/***********************************************************************/
/* This is the fixed ZIP file access method. */
/***********************************************************************/
class DllExport ZPXFAM : public MPXFAM {
friend class ZIPFAM;
public:
// Constructors
ZPXFAM(PDOSDEF tdp);
ZPXFAM(PZPXFAM txfp);
// Implementation
virtual AMT GetAmType(void) { return TYPE_AM_ZIP; }
virtual PTXF Duplicate(PGLOBAL g) { return (PTXF) new(g)ZPXFAM(this); }
// Methods
virtual int GetFileLength(PGLOBAL g);
virtual int Cardinality(PGLOBAL g);
virtual bool OpenTableFile(PGLOBAL g);
virtual int GetNext(PGLOBAL g);
//virtual int ReadBuffer(PGLOBAL g);
protected:
// Members
ZIPUTIL *zutp;
PSZ target;
bool mul;
}; // end of ZPXFAM
#endif // __FILAMZIP_H
|