]> git.saurik.com Git - wxWidgets.git/blob - docs/latex/wx/zipstrm.tex
added null pointer check and assert
[wxWidgets.git] / docs / latex / wx / zipstrm.tex
1 %
2 % automatically generated by HelpGen $Revision$ from
3 % wx/zipstrm.h at 16/Sep/04 12:19:29
4 %
5
6 \section{\class{wxZipClassFactory}}\label{wxzipclassfactory}
7
8 Class factory for the zip archive format. See the base class
9 for details.
10
11 \wxheading{Derived from}
12
13 \helpref{wxArchiveClassFactory}{wxarchiveclassfactory}\\
14 \helpref{wxObject}{wxobject}
15
16 \wxheading{Include files}
17
18 <wx/zipstrm.h>
19
20 \wxheading{Library}
21
22 \helpref{wxBase}{librarieslist}
23
24 \wxheading{See also}
25
26 \helpref{Archive formats such as zip}{wxarc}\\
27 \helpref{Generic archive programming}{wxarcgeneric}\\
28 \helpref{wxZipEntry}{wxzipentry}\\
29 \helpref{wxZipInputStream}{wxzipinputstream}\\
30 \helpref{wxZipOutputStream}{wxzipoutputstream}
31
32
33 %
34 % automatically generated by HelpGen $Revision$ from
35 % wx/zipstrm.h at 16/Sep/04 12:19:29
36 %
37
38 \section{\class{wxZipEntry}}\label{wxzipentry}
39
40 Holds the meta-data for an entry in a zip.
41
42 \wxheading{Derived from}
43
44 \helpref{wxArchiveEntry}{wxarchiveentry}\\
45 \helpref{wxObject}{wxobject}
46
47 \wxheading{Include files}
48
49 <wx/zipstrm.h>
50
51 \wxheading{Library}
52
53 \helpref{wxBase}{librarieslist}
54
55 \wxheading{Data structures}
56
57 Constants for \helpref{Get/SetMethod}{wxzipentrymethod}:
58
59 \begin{verbatim}
60 // Compression Method, only 0 (store) and 8 (deflate) are supported here
61 //
62 enum wxZipMethod
63 {
64 wxZIP_METHOD_STORE,
65 wxZIP_METHOD_SHRINK,
66 wxZIP_METHOD_REDUCE1,
67 wxZIP_METHOD_REDUCE2,
68 wxZIP_METHOD_REDUCE3,
69 wxZIP_METHOD_REDUCE4,
70 wxZIP_METHOD_IMPLODE,
71 wxZIP_METHOD_TOKENIZE,
72 wxZIP_METHOD_DEFLATE,
73 wxZIP_METHOD_DEFLATE64,
74 wxZIP_METHOD_BZIP2 = 12,
75 wxZIP_METHOD_DEFAULT = 0xffff
76 };
77
78 \end{verbatim}
79
80 Constants for \helpref{Get/SetSystemMadeBy}{wxzipentrysystemmadeby}:
81
82 \begin{verbatim}
83 // Originating File-System.
84 //
85 // These are Pkware's values. Note that Info-zip disagree on some of them,
86 // most notably NTFS.
87 //
88 enum wxZipSystem
89 {
90 wxZIP_SYSTEM_MSDOS,
91 wxZIP_SYSTEM_AMIGA,
92 wxZIP_SYSTEM_OPENVMS,
93 wxZIP_SYSTEM_UNIX,
94 wxZIP_SYSTEM_VM_CMS,
95 wxZIP_SYSTEM_ATARI_ST,
96 wxZIP_SYSTEM_OS2_HPFS,
97 wxZIP_SYSTEM_MACINTOSH,
98 wxZIP_SYSTEM_Z_SYSTEM,
99 wxZIP_SYSTEM_CPM,
100 wxZIP_SYSTEM_WINDOWS_NTFS,
101 wxZIP_SYSTEM_MVS,
102 wxZIP_SYSTEM_VSE,
103 wxZIP_SYSTEM_ACORN_RISC,
104 wxZIP_SYSTEM_VFAT,
105 wxZIP_SYSTEM_ALTERNATE_MVS,
106 wxZIP_SYSTEM_BEOS,
107 wxZIP_SYSTEM_TANDEM,
108 wxZIP_SYSTEM_OS_400
109 };
110
111 \end{verbatim}
112
113 Constants for \helpref{Get/SetExternalAttributes}{wxzipentryexternalattributes}:
114
115 \begin{verbatim}
116 // Dos/Win file attributes
117 //
118 enum wxZipAttributes
119 {
120 wxZIP_A_RDONLY = 0x01,
121 wxZIP_A_HIDDEN = 0x02,
122 wxZIP_A_SYSTEM = 0x04,
123 wxZIP_A_SUBDIR = 0x10,
124 wxZIP_A_ARCH = 0x20,
125
126 wxZIP_A_MASK = 0x37
127 };
128
129 \end{verbatim}
130
131 Constants for \helpref{Get/SetFlags}{wxzipentrygetflags}:
132
133 \begin{verbatim}
134 // Values for the flags field in the zip headers
135 //
136 enum wxZipFlags
137 {
138 wxZIP_ENCRYPTED = 0x0001,
139 wxZIP_DEFLATE_NORMAL = 0x0000, // normal compression
140 wxZIP_DEFLATE_EXTRA = 0x0002, // extra compression
141 wxZIP_DEFLATE_FAST = 0x0004, // fast compression
142 wxZIP_DEFLATE_SUPERFAST = 0x0006, // superfast compression
143 wxZIP_DEFLATE_MASK = 0x0006,
144 wxZIP_SUMS_FOLLOW = 0x0008, // crc and sizes come after the data
145 wxZIP_ENHANCED = 0x0010,
146 wxZIP_PATCH = 0x0020,
147 wxZIP_STRONG_ENC = 0x0040,
148 wxZIP_UNUSED = 0x0F80,
149 wxZIP_RESERVED = 0xF000
150 };
151
152 \end{verbatim}
153
154 \wxheading{See also}
155
156 \helpref{Archive formats such as zip}{wxarc}\\
157 \helpref{wxZipInputStream}{wxzipinputstream}\\
158 \helpref{wxZipOutputStream}{wxzipoutputstream}\\
159 \helpref{wxZipNotifier}{wxzipnotifier}
160
161 \wxheading{Field availability}
162
163 When reading a zip from a stream that is seekable,
164 \helpref{GetNextEntry()}{wxzipinputstreamgetnextentry} returns
165 a fully populated wxZipEntry object except for
166 \helpref{wxZipEntry::GetLocalExtra()}{wxzipentrylocalextra}. GetLocalExtra()
167 becomes available when the entry is opened, either by calling
168 \helpref{wxZipInputStream::OpenEntry}{wxzipinputstreamopenentry} or by
169 making an attempt to read the entry's data.
170
171 For zips on \helpref{non-seekable}{wxarcnoseek} streams, the following
172 fields are always available when GetNextEntry() returns:
173
174 \helpref{GetDateTime}{wxarchiveentrydatetime}\\
175 \helpref{GetInternalFormat}{wxarchiveentrygetinternalformat}\\
176 \helpref{GetInternalName}{wxzipentrygetinternalname}\\
177 \helpref{GetFlags}{wxzipentrygetflags}\\
178 \helpref{GetLocalExtra}{wxzipentrylocalextra}\\
179 \helpref{GetMethod}{wxzipentrymethod}\\
180 \helpref{GetName}{wxarchiveentryname}\\
181 \helpref{GetOffset}{wxarchiveentrygetoffset}\\
182 \helpref{IsDir}{wxarchiveentryisdir}
183
184 The following fields are also usually available when GetNextEntry()
185 returns, however, if the zip was also written to a non-seekable stream
186 the zipper is permitted to store them after the entry's data. In that
187 case they become available when the entry's data has been read to Eof(),
188 or \helpref{CloseEntry()}{wxarchiveinputstreamcloseentry} has been called.
189 {\tt (GetFlags() \& wxZIP\_SUMS\_FOLLOW) != 0} indicates that one or
190 more of these come after the data:
191
192 \helpref{GetCompressedSize}{wxzipentrygetcompressedsize}\\
193 \helpref{GetCrc}{wxzipentrygetcrc}\\
194 \helpref{GetSize}{wxarchiveentrysize}
195
196 The following are stored at the end of the zip, and become available
197 when the end of the zip has been reached, i.e. after GetNextEntry()
198 returns NULL and Eof() is true:
199
200 \helpref{GetComment}{wxzipentrycomment}\\
201 \helpref{GetExternalAttributes}{wxzipentryexternalattributes}\\
202 \helpref{GetExtra}{wxzipentryextra}\\
203 \helpref{GetMode}{wxzipentrymode}\\
204 \helpref{GetSystemMadeBy}{wxzipentrysystemmadeby}\\
205 \helpref{IsReadOnly}{wxarchiveentryisreadonly}\\
206 \helpref{IsMadeByUnix}{wxzipentryismadebyunix}\\
207 \helpref{IsText}{wxzipentryistext}
208
209
210 \latexignore{\rtfignore{\wxheading{Members}}}
211
212
213 \membersection{wxZipEntry::wxZipEntry}\label{wxzipentrywxzipentry}
214
215 \func{}{wxZipEntry}{\param{const wxString\& }{name = wxEmptyString}, \param{const wxDateTime\& }{dt = wxDateTime::Now()}, \param{off\_t }{size = wxInvalidOffset}}
216
217 Constructor.
218
219 \func{}{wxZipEntry}{\param{const wxZipEntry\& }{entry}}
220
221 Copy constructor.
222
223
224 \membersection{wxZipEntry::Clone}\label{wxzipentryclone}
225
226 \constfunc{wxZipEntry*}{Clone}{\void}
227
228 Make a copy of this entry.
229
230
231 \membersection{wxZipEntry::Get/SetComment}\label{wxzipentrycomment}
232
233 \constfunc{wxString}{GetComment}{\void}
234
235 \func{void}{SetComment}{\param{const wxString\& }{comment}}
236
237 A short comment for this entry.
238
239
240 \membersection{wxZipEntry::GetCompressedSize}\label{wxzipentrygetcompressedsize}
241
242 \constfunc{off\_t}{GetCompressedSize}{\void}
243
244 The compressed size of this entry in bytes.
245
246
247 \membersection{wxZipEntry::GetCrc}\label{wxzipentrygetcrc}
248
249 \constfunc{wxUint32}{GetCrc}{\void}
250
251 CRC32 for this entry's data.
252
253
254 \membersection{wxZipEntry::Get/SetExternalAttributes}\label{wxzipentryexternalattributes}
255
256 \constfunc{wxUint32}{GetExternalAttributes}{\void}
257
258 \func{void}{SetExternalAttributes}{\param{wxUint32 }{attr}}
259
260 The low 8 bits are always the DOS/Windows file attributes for this entry.
261 The values of these attributes are given in the
262 enumeration {\tt wxZipAttributes}.
263
264 The remaining bits can store platform specific permission bits or
265 attributes, and their meaning depends on the value
266 of \helpref{SetSystemMadeBy()}{wxzipentrysystemmadeby}.
267 If \helpref{IsMadeByUnix()}{wxzipentryismadebyunix} is true then the
268 high 16 bits are unix mode bits.
269
270 The following other accessors access these bits:
271
272 \helpref{IsReadOnly/SetIsReadOnly}{wxarchiveentryisreadonly}\\
273 \helpref{IsDir/SetIsDir}{wxarchiveentryisdir}\\
274 \helpref{Get/SetMode}{wxzipentrymode}
275
276
277 \membersection{wxZipEntry::Get/SetExtra}\label{wxzipentryextra}
278
279 \constfunc{const char*}{GetExtra}{\void}
280
281 \constfunc{size\_t}{GetExtraLen}{\void}
282
283 \func{void}{SetExtra}{\param{const char* }{extra}, \param{size\_t }{len}}
284
285 The extra field from the entry's central directory record.
286
287 The extra field is used to store platform or application specific
288 data. See Pkware's document 'appnote.txt' for information on its format.
289
290
291 \membersection{wxZipEntry::GetFlags}\label{wxzipentrygetflags}
292
293 \constfunc{int}{GetFlags}{\void}
294
295 Returns a combination of the bits flags in the enumeration {\tt wxZipFlags}.
296
297
298 \membersection{wxZipEntry::GetInternalName}\label{wxzipentrygetinternalname}
299
300 \constfunc{wxString}{GetInternalName}{\void}
301
302 Returns the entry's filename in the internal format used within the
303 archive. The name can include directory components, i.e. it can be a
304 full path.
305
306 The names of directory entries are returned without any trailing path
307 separator. This gives a canonical name that can be used in comparisons.
308
309 \func{wxString}{GetInternalName}{\param{const wxString\& }{name}, \param{wxPathFormat }{format = wxPATH\_NATIVE}, \param{bool* }{pIsDir = NULL}}
310
311 A static member that translates a filename into the internal format used
312 within the archive. If the third parameter is provided, the bool pointed
313 to is set to indicate whether the name looks like a directory name
314 (i.e. has a trailing path separator).
315
316 \wxheading{See also}
317
318 \helpref{Looking up an archive entry by name}{wxarcbyname}
319
320
321 \membersection{wxZipEntry::Get/SetLocalExtra}\label{wxzipentrylocalextra}
322
323 \constfunc{const char*}{GetLocalExtra}{\void}
324
325 \constfunc{size\_t}{GetLocalExtraLen}{\void}
326
327 \func{void}{SetLocalExtra}{\param{const char* }{extra}, \param{size\_t }{len}}
328
329 The extra field from the entry's local record.
330
331 The extra field is used to store platform or application specific
332 data. See Pkware's document 'appnote.txt' for information on its format.
333
334
335 \membersection{wxZipEntry::Get/SetMethod}\label{wxzipentrymethod}
336
337 \constfunc{int}{GetMethod}{\void}
338
339 \func{void}{SetMethod}{\param{int }{method}}
340
341 The compression method. The enumeration {\tt wxZipMethod} lists the
342 possible values.
343
344 The default constructor sets this to wxZIP\_METHOD\_DEFAULT,
345 which allows \helpref{wxZipOutputStream}{wxzipoutputstream} to
346 choose the method when writing the entry.
347
348
349 \membersection{wxZipEntry::Get/SetMode}\label{wxzipentrymode}
350
351 \constfunc{int}{GetMode}{\void}
352
353 If \helpref{IsMadeByUnix()}{wxzipentryismadebyunix} is true then
354 returns the unix permission bits stored in
355 \helpref{GetExternalAttributes()}{wxzipentryexternalattributes}.
356 Otherwise synthesises them from the DOS attributes.
357
358 \func{void}{SetMode}{\param{int }{mode}}
359
360 Sets the DOS attributes
361 in \helpref{GetExternalAttributes()}{wxzipentryexternalattributes}
362 to be consistent with the {\tt mode} given.
363
364 If \helpref{IsMadeByUnix()}{wxzipentryismadebyunix} is true then also
365 stores {\tt mode} in GetExternalAttributes().
366
367 Note that the default constructor
368 sets \helpref{GetSystemMadeBy()}{wxzipentrysystemmadeby} to
369 wxZIP\_SYSTEM\_MSDOS by default. So to be able to store unix
370 permissions when creating zips, call SetSystemMadeBy(wxZIP\_SYSTEM\_UNIX).
371
372
373 \membersection{wxZipEntry::SetNotifier}\label{wxzipentrynotifier}
374
375 \func{void}{SetNotifier}{\param{wxZipNotifier\& }{notifier}}
376
377 \func{void}{UnsetNotifier}{\void}
378
379 Sets the \helpref{notifier}{wxzipnotifier} for this entry.
380 Whenever the \helpref{wxZipInputStream}{wxzipinputstream} updates
381 this entry, it will then invoke the associated
382 notifier's \helpref{OnEntryUpdated}{wxzipnotifieronentryupdated}
383 method.
384
385 Setting a notifier is not usually necessary. It is used to handle
386 certain cases when modifying an zip in a pipeline (i.e. between
387 non-seekable streams).
388
389 \wxheading{See also}
390
391 \helpref{Archives on non-seekable streams}{wxarcnoseek}\\
392 \helpref{wxZipNotifier}{wxzipnotifier}
393
394
395 \membersection{wxZipEntry::Get/SetSystemMadeBy}\label{wxzipentrysystemmadeby}
396
397 \constfunc{int}{GetSystemMadeBy}{\void}
398
399 \func{void}{SetSystemMadeBy}{\param{int }{system}}
400
401 The originating file-system. The default constructor sets this to
402 wxZIP\_SYSTEM\_MSDOS. Set it to wxZIP\_SYSTEM\_UNIX in order to be
403 able to store unix permissions using \helpref{SetMode()}{wxzipentrymode}.
404
405
406 \membersection{wxZipEntry::IsMadeByUnix}\label{wxzipentryismadebyunix}
407
408 \constfunc{bool}{IsMadeByUnix}{\void}
409
410 Returns true if \helpref{GetSystemMadeBy()}{wxzipentrysystemmadeby}
411 is a flavour of unix.
412
413
414 \membersection{wxZipEntry::IsText/SetIsText}\label{wxzipentryistext}
415
416 \constfunc{bool}{IsText}{\void}
417
418 \func{void}{SetIsText}{\param{bool }{isText = true}}
419
420 Indicates that this entry's data is text in an 8-bit encoding.
421
422
423 \membersection{wxZipEntry::operator=}\label{wxzipentryoperatorassign}
424
425 \func{wxZipEntry\& operator}{operator=}{\param{const wxZipEntry\& }{entry}}
426
427 Assignment operator.
428
429
430 %
431 % automatically generated by HelpGen $Revision$ from
432 % wx/zipstrm.h at 16/Sep/04 12:19:29
433 %
434
435 \section{\class{wxZipInputStream}}\label{wxzipinputstream}
436
437 Input stream for reading zip files.
438
439 \helpref{GetNextEntry()}{wxzipinputstreamgetnextentry} returns an
440 \helpref{wxZipEntry}{wxzipentry} object containing the meta-data
441 for the next entry in the zip (and gives away ownership). Reading from
442 the wxZipInputStream then returns the entry's data. Eof() becomes true
443 after an attempt has been made to read past the end of the entry's data.
444 When there are no more entries, GetNextEntry() returns NULL and sets Eof().
445
446 Note that in general zip entries are not seekable, and
447 wxZipInputStream::SeekI() always returns wxInvalidOffset.
448
449 \wxheading{Derived from}
450
451 \helpref{wxArchiveInputStream}{wxarchiveinputstream}\\
452 \helpref{wxFilterInputStream}{wxfilterinputstream}\\
453 \helpref{wxInputStream}{wxinputstream}\\
454 \helpref{wxStreamBase}{wxstreambase}
455
456 \wxheading{Include files}
457
458 <wx/zipstrm.h>
459
460 \wxheading{Library}
461
462 \helpref{wxBase}{librarieslist}
463
464 \wxheading{Data structures}
465 \begin{verbatim}
466 typedef wxZipEntry entry_type
467 \end{verbatim}
468
469 \wxheading{See also}
470
471 \helpref{Archive formats such as zip}{wxarc}\\
472 \helpref{wxZipEntry}{wxzipentry}\\
473 \helpref{wxZipOutputStream}{wxzipoutputstream}
474
475 \latexignore{\rtfignore{\wxheading{Members}}}
476
477
478 \membersection{wxZipInputStream::wxZipInputStream}\label{wxzipinputstreamwxzipinputstream}
479
480 \func{}{wxZipInputStream}{\param{wxInputStream\& }{stream}, \param{wxMBConv\& }{conv = wxConvLocal}}
481
482 \func{}{wxZipInputStream}{\param{wxInputStream*}{stream}, \param{wxMBConv\& }{conv = wxConvLocal}}
483
484 Constructor. In a Unicode build the second parameter {\tt conv} is
485 used to translate the filename and comment fields into Unicode. It has
486 no effect on the stream's data.
487
488 If the parent stream is passed as a pointer then the new filter stream
489 takes ownership of it. If it is passed by reference then it does not.
490
491 \func{}{wxZipInputStream}{\param{const wxString\& }{archive}, \param{const wxString\& }{file}}
492
493 Compatibility constructor (requires WXWIN\_COMPATIBILITY\_2\_6).
494
495 When this constructor is used, an emulation of seeking is
496 switched on for compatibility with previous versions. Note however,
497 that it is deprecated.
498
499
500 \membersection{wxZipInputStream::CloseEntry}\label{wxzipinputstreamcloseentry}
501
502 \func{bool}{CloseEntry}{\void}
503
504 Closes the current entry. On a non-seekable stream reads to the end of
505 the current entry first.
506
507
508 \membersection{wxZipInputStream::GetComment}\label{wxzipinputstreamgetcomment}
509
510 \func{wxString}{GetComment}{\void}
511
512 Returns the zip comment.
513
514 This is stored at the end of the zip, therefore when reading a zip
515 from a non-seekable stream, it returns the empty string until the
516 end of the zip has been reached, i.e. when GetNextEntry() returns
517 NULL.
518
519
520 \membersection{wxZipInputStream::GetNextEntry}\label{wxzipinputstreamgetnextentry}
521
522 \func{wxZipEntry*}{GetNextEntry}{\void}
523
524 Closes the current entry if one is open, then reads the meta-data for
525 the next entry and returns it in a \helpref{wxZipEntry}{wxzipentry}
526 object, giving away ownership. The stream is then open and can be read.
527
528
529 \membersection{wxZipInputStream::GetTotalEntries}\label{wxzipinputstreamgettotalentries}
530
531 \func{int}{GetTotalEntries}{\void}
532
533 For a zip on a seekable stream returns the total number of entries in
534 the zip. For zips on non-seekable streams returns the number of entries
535 returned so far by \helpref{GetNextEntry()}{wxzipinputstreamgetnextentry}.
536
537
538 \membersection{wxZipInputStream::OpenEntry}\label{wxzipinputstreamopenentry}
539
540 \func{bool}{OpenEntry}{\param{wxZipEntry\& }{entry}}
541
542 Closes the current entry if one is open, then opens the entry specified
543 by the {\it entry} object.
544
545 {\it entry} should be from the same zip file, and the zip should
546 be on a seekable stream.
547
548 \wxheading{See also}
549
550 \helpref{Looking up an archive entry by name}{wxarcbyname}
551
552
553 %
554 % automatically generated by HelpGen $Revision$ from
555 % wx/zipstrm.h at 16/Sep/04 12:19:29
556 %
557
558 \section{\class{wxZipNotifier}}\label{wxzipnotifier}
559
560 If you need to know when a \helpref{wxZipInputStream}{wxzipinputstream}
561 updates a \helpref{wxZipEntry}{wxzipentry},
562 you can create a notifier by deriving from this abstract base class,
563 overriding \helpref{OnEntryUpdated()}{wxzipnotifieronentryupdated}.
564 An instance of your notifier class can then be assigned to wxZipEntry
565 objects, using \helpref{wxZipEntry::SetNotifier()}{wxzipentrynotifier}.
566
567 Setting a notifier is not usually necessary. It is used to handle
568 certain cases when modifying an zip in a pipeline (i.e. between
569 non-seekable streams).
570 See '\helpref{Archives on non-seekable streams}{wxarcnoseek}'.
571
572 \wxheading{Derived from}
573
574 No base class
575
576 \wxheading{Include files}
577
578 <wx/zipstrm.h>
579
580 \wxheading{Library}
581
582 \helpref{wxBase}{librarieslist}
583
584 \wxheading{See also}
585
586 \helpref{Archives on non-seekable streams}{wxarcnoseek}\\
587 \helpref{wxZipEntry}{wxzipentry}\\
588 \helpref{wxZipInputStream}{wxzipinputstream}\\
589 \helpref{wxZipOutputStream}{wxzipoutputstream}
590
591 \latexignore{\rtfignore{\wxheading{Members}}}
592
593
594 \membersection{wxZipNotifier::OnEntryUpdated}\label{wxzipnotifieronentryupdated}
595
596 \func{void}{OnEntryUpdated}{\param{wxZipEntry\& }{entry}}
597
598 Override this to receive notifications when
599 an \helpref{wxZipEntry}{wxzipentry} object changes.
600
601
602 %
603 % automatically generated by HelpGen $Revision$ from
604 % wx/zipstrm.h at 16/Sep/04 12:19:29
605 %
606
607 \section{\class{wxZipOutputStream}}\label{wxzipoutputstream}
608
609 Output stream for writing zip files.
610
611 \helpref{PutNextEntry()}{wxzipoutputstreamputnextentry} is used to create
612 a new entry in the output zip, then the entry's data is written to the
613 wxZipOutputStream. Another call to PutNextEntry() closes the current
614 entry and begins the next.
615
616 \wxheading{Derived from}
617
618 \helpref{wxArchiveOutputStream}{wxarchiveoutputstream}\\
619 \helpref{wxFilterOutputStream}{wxfilteroutputstream}\\
620 \helpref{wxOutputStream}{wxoutputstream}\\
621 \helpref{wxStreamBase}{wxstreambase}
622
623 \wxheading{Include files}
624
625 <wx/zipstrm.h>
626
627 \wxheading{Library}
628
629 \helpref{wxBase}{librarieslist}
630
631 \wxheading{See also}
632
633 \helpref{Archive formats such as zip}{wxarc}\\
634 \helpref{wxZipEntry}{wxzipentry}\\
635 \helpref{wxZipInputStream}{wxzipinputstream}
636
637 \latexignore{\rtfignore{\wxheading{Members}}}
638
639
640 \membersection{wxZipOutputStream::wxZipOutputStream}\label{wxzipoutputstreamwxzipoutputstream}
641
642 \func{}{wxZipOutputStream}{\param{wxOutputStream\& }{stream}, \param{int }{level = -1}, \param{wxMBConv\& }{conv = wxConvLocal}}
643
644 \func{}{wxZipOutputStream}{\param{wxOutputStream*}{stream}, \param{int }{level = -1}, \param{wxMBConv\& }{conv = wxConvLocal}}
645
646 Constructor. {\tt level} is the compression level to use.
647 It can be a value between 0 and 9 or -1 to use the default value
648 which currently is equivalent to 6.
649
650 If the parent stream is passed as a pointer then the new filter stream
651 takes ownership of it. If it is passed by reference then it does not.
652
653 In a Unicode build the third parameter {\tt conv} is used to translate
654 the filename and comment fields to an 8-bit encoding. It has no effect on the
655 stream's data.
656
657
658 \membersection{wxZipOutputStream::\destruct{wxZipOutputStream}}\label{wxzipoutputstreamdtor}
659
660 \func{}{\destruct{wxZipOutputStream}}{\void}
661
662 The destructor calls \helpref{Close()}{wxzipoutputstreamclose} to finish
663 writing the zip if it has not been called already.
664
665
666 \membersection{wxZipOutputStream::Close}\label{wxzipoutputstreamclose}
667
668 \func{bool}{Close}{\void}
669
670 Finishes writing the zip, returning true if successful.
671 Called by the destructor if not called explicitly.
672
673
674 \membersection{wxZipOutputStream::CloseEntry}\label{wxzipoutputstreamcloseentry}
675
676 \func{bool}{CloseEntry}{\void}
677
678 Close the current entry. It is called implicitly whenever another new
679 entry is created with \helpref{CopyEntry()}{wxzipoutputstreamcopyentry}
680 or \helpref{PutNextEntry()}{wxzipoutputstreamputnextentry}, or
681 when the zip is closed.
682
683
684 \membersection{wxZipOutputStream::CopyArchiveMetaData}\label{wxzipoutputstreamcopyarchivemetadata}
685
686 \func{bool}{CopyArchiveMetaData}{\param{wxZipInputStream\& }{inputStream}}
687
688 Transfers the zip comment from the \helpref{wxZipInputStream}{wxzipinputstream}
689 to this output stream.
690
691
692 \membersection{wxZipOutputStream::CopyEntry}\label{wxzipoutputstreamcopyentry}
693
694 \func{bool}{CopyEntry}{\param{wxZipEntry* }{entry}, \param{wxZipInputStream\& }{inputStream}}
695
696 Takes ownership of {\tt entry} and uses it to create a new entry
697 in the zip. {\tt entry} is then opened in {\tt inputStream} and its contents
698 copied to this stream.
699
700 CopyEntry() is much more efficient than transferring the data using
701 Read() and Write() since it will copy them without decompressing and
702 recompressing them.
703
704 For zips on seekable streams, {\tt entry} must be from the same zip file
705 as {\tt stream}. For non-seekable streams, {\tt entry} must also be the
706 last thing read from {\tt inputStream}.
707
708
709 \membersection{wxZipOutputStream::Get/SetLevel}\label{wxzipoutputstreamlevel}
710
711 \constfunc{int}{GetLevel}{\void}
712
713 \func{void}{SetLevel}{\param{int }{level}}
714
715 Set the compression level that will be used the next time an entry is
716 created. It can be a value between 0 and 9 or -1 to use the default value
717 which currently is equivalent to 6.
718
719
720 \membersection{wxZipOutputStream::PutNextDirEntry}\label{wxzipoutputstreamputnextdirentry}
721
722 \func{bool}{PutNextDirEntry}{\param{const wxString\& }{name}, \param{const wxDateTime\& }{dt = wxDateTime::Now()}}
723
724 Create a new directory entry
725 (see \helpref{wxArchiveEntry::IsDir()}{wxarchiveentryisdir})
726 with the given name and timestamp.
727
728 \helpref{PutNextEntry()}{wxzipoutputstreamputnextentry} can
729 also be used to create directory entries, by supplying a name with
730 a trailing path separator.
731
732
733 \membersection{wxZipOutputStream::PutNextEntry}\label{wxzipoutputstreamputnextentry}
734
735 \func{bool}{PutNextEntry}{\param{wxZipEntry* }{entry}}
736
737 Takes ownership of {\tt entry} and uses it to create a new entry
738 in the zip.
739
740 \func{bool}{PutNextEntry}{\param{const wxString\& }{name}, \param{const wxDateTime\& }{dt = wxDateTime::Now()}, \param{off\_t }{size = wxInvalidOffset}}
741
742 Create a new entry with the given name, timestamp and size.
743
744
745 \membersection{wxZipOutputStream::SetComment}\label{wxzipoutputstreamsetcomment}
746
747 \func{void}{SetComment}{\param{const wxString\& }{comment}}
748
749 Sets a comment for the zip as a whole. It is written at the end of the
750 zip.
751