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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
/*
Copyright 1990-2008 Light Infocon Tecnologia S/A
Este arquivo é parte do programa LightBase - Banco de Dados Textual Documental
O LightBase é um software livre; você pode redistribui-lo e/ou modifica-lo dentro
dos termos da Licença Pública Geral GNU como publicada pela Fundação do Software
Livre (FSF); na versão 2 da Licença.
Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA
GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou APLICAÇÃO
EM PARTICULAR. Veja a Licença Pública Geral GNU para maiores detalhes.
Você deve ter recebido uma cópia da Licença Pública Geral GNU versao 2, sob o
título "LICENCA.txt", junto com este programa, se não, escreva para a Fundação do
Software Livre(FSF) Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/*
* class ALArchiveBase
*
* DESCRIPTION
*
* This is the most important class definition in the library.
* ALArchiveBase defines the interface to archive objects, on disk,
* memory, or whatever. This class is a pure base class, so you
* won't ever create an instance of an ALArchiveBase object.
*
* The derived class for a given archive type has several very important
* virtual functions it has to provide. The most important two are
* CreateCompressionEngine() and CreateStorageObject(). These
* two functions are called when the directory is being read from
* a given archive. In the directory, the type of a storage object
* and the compression engine used to create it are defined as just
* plain integers. Somewhere, somebody has to look at these integers
* and create real objects based on their contents, and then maybe
* perform some initialization as well.
*
* At first glance it might seem like there is no reason the base class
* shouldn't just do all this work itself. However, there is a good reason
* not to do it this way. If the base class is designed to be a completely
* general purpose class, it would need to know how to create a Greenleaf
* compression engine, a Microsoft compression engine, and so on. It
* would also need to know how to create all different kinds of storage
* objects, probably including our demo storage objects. This would mean
* that the base ALArchiveBase class would basically have to link in our
* entire library. What is worse, if someone created a lean and mean
* derived class that only supported one storage type and one compression
* engine, they would still have to link in all that other code because
* it was referenced in the base class.
*
* So the compromise is the current hierarchy. We have a base class that
* has no links to any engines or storage objects. A user can derive
* a lean and mean class from the base class and not have to worry as much
* about code bloat. On the other hand, we have a relatively full
* featured derived class one level down, called ALArchive. It
* has the built in links to the "ordinary" object types. This way, you
* have a ready-built class that will do lots of ordinary jobs without a
* lot of fuss.
*
* DATA MEMBERS
*
* mpArchiveStorageObject : Pointer to the Archive's storage object.
* This is the ALFile, or whatever, that
* actually contains (or will contain) the
* archive.
*
* mszComment : The comment associated with this archive.
* This comment is stored on disk along with
* the archive directory.
*
* mlDirectoryOffset : The offset in the storage object to the
* archive's directory. All of the compressed
* objects in the archive are stored sequentially
* at the start of the file. The directory
* and other information starts after all of
* the objects. This data member tells us
* how to get there. Not filled in until
* an archive has actually been created.
*
* miVersion : The archive version. This version field
* refers to the format version of the archive,
* which won't necessarily be the save as
* the format of ArchiveLib.
*
* miDeleteStorageObject : If this flag is set, the storage object
* associated with the archive object will
* have its object destroyed in the
* archive destructor. This saves you
* from having to do the job explicitly
* in your code.
*
* mStatus : The only public data member, this is a
* standard ArchiveLib status object.
*
*
* MEMBER FUNCTIONS
*
* ALArchiveBase() : The only constructor.
* ~ALArchiveBase() : The virtual destructor.
* operator new() : Memory allocation operator used when
* the library is in a DLL
* AddJobs() : Protected function used to create
* CopyJobs() : Protected function used to create
* AddDirectoryEntries() : Protected function used to create, append
* CalculateJobSize() : Protected function to help monitor
* CalculateCompressedJobSize() : Protected function to help monitor
* ScanStatus() : Protected function to update status
* CreateCompressionEngine() : Virtual fn used when extracting
* CreateStorageObject() : Virtual fn used when extracting
* WriteArchiveData() : Protected fn to write part of directory
* ReadArchiveData() : Protected fn to read part of directory
* Create(ALEntryList&) : Create a new archive
* Create(ALArchiveBase&, : Create a new archive from another
* ALEntryList&)
* Append(ALEntryList&) : Add objects to archive
* Append(ALArchiveBase&, : Add objects to archive from another one
* ALEntryList&)
* Extract() : Extract objects from an archive
* Delete() : Delete objects from an archive
* GetComment() : Get the comment stored in the archive
* SetComment() : Set the comment that will be stored
* ReadDirectory() : Read the directory into an ALEntryList
* WriteDirectory() : Write the directory back out.
* GetVersion() : Get the archive's version
* GetStorageObject() : Get pointer to the archive's storage object
* FillListBox() : Fill a list box with the archive's entries
*
* REVISION HISTORY
*
* May 26, 1994 1.0A : First release
*
*/
class AL_CLASS_TYPE ALArchiveBase ;
/* #if defined( __cplusplus ) */
/* #ifndef _ARCHIVEB_H */