1/*************** tabzip H Declares Source Code File (.H) ***************/
2/* Name: tabzip.h Version 1.0 */
3/* */
4/* (C) Copyright to the author Olivier BERTRAND 2016 */
5/* */
6/* This file contains the ZIP classe declares. */
7/***********************************************************************/
8#include "osutil.h"
9#include "block.h"
10#include "colblk.h"
11#include "xtable.h"
12#include "unzip.h"
13
14typedef class ZIPDEF *PZIPDEF;
15typedef class TDBZIP *PTDBZIP;
16typedef class ZIPCOL *PZIPCOL;
17
18/***********************************************************************/
19/* ZIP table: display info about a ZIP file. */
20/***********************************************************************/
21class DllExport ZIPDEF : public DOSDEF { /* Table description */
22 friend class TDBZIP;
23 friend class UNZFAM;
24public:
25 // Constructor
26 ZIPDEF(void) {}
27
28 // Implementation
29 virtual const char *GetType(void) {return "ZIP";}
30
31 // Methods
32 virtual bool DefineAM(PGLOBAL g, LPCSTR am, int poff);
33 virtual PTDB GetTable(PGLOBAL g, MODE m);
34
35protected:
36 // Members
37 PCSZ target; // The inside file to query
38}; // end of ZIPDEF
39
40/***********************************************************************/
41/* This is the ZIP Access Method class declaration. */
42/***********************************************************************/
43class DllExport TDBZIP : public TDBASE {
44 friend class ZIPCOL;
45public:
46 // Constructor
47 TDBZIP(PZIPDEF tdp);
48
49 // Implementation
50 virtual AMT GetAmType(void) {return TYPE_AM_ZIP;}
51
52 // Methods
53 virtual PCOL MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n);
54 virtual int Cardinality(PGLOBAL g);
55 virtual int GetMaxSize(PGLOBAL g);
56 virtual int GetRecpos(void) {return 0;}
57
58 // Database routines
59 virtual bool OpenDB(PGLOBAL g);
60 virtual int ReadDB(PGLOBAL g);
61 virtual int WriteDB(PGLOBAL g);
62 virtual int DeleteDB(PGLOBAL g, int irc);
63 virtual void CloseDB(PGLOBAL g);
64
65protected:
66 bool open(PGLOBAL g, const char *filename);
67 void close(void);
68
69 // Members
70 unzFile zipfile; // The ZIP container file
71 PCSZ zfn; // The ZIP file name
72//PSZ target;
73 unz_file_info64 finfo; // The current file info
74 char fn[FILENAME_MAX]; // The current file name
75 int nexterr; // Next file error
76}; // end of class TDBZIP
77
78/***********************************************************************/
79/* Class ZIPCOL: ZIP access method column descriptor. */
80/***********************************************************************/
81class DllExport ZIPCOL : public COLBLK {
82 friend class TDBZIP;
83public:
84 // Constructors
85 ZIPCOL(PCOLDEF cdp, PTDB tdbp, PCOL cprec, int i, PCSZ am = "ZIP");
86
87 // Implementation
88 virtual int GetAmType(void) { return TYPE_AM_ZIP; }
89
90 // Methods
91 virtual void ReadColumn(PGLOBAL g);
92
93protected:
94 // Default constructor not to be used
95 ZIPCOL(void) {}
96
97 // Members
98 TDBZIP *Tdbz;
99 int flag;
100}; // end of class ZIPCOL
101