]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/zipstrm.tex
escape underscores introduced by the last change
[wxWidgets.git] / docs / latex / wx / zipstrm.tex
CommitLineData
704a4b75 1%
00375592
VZ
2% automatically generated by HelpGen $Revision$ from
3% wx/zipstrm.h at 16/Sep/04 12:19:29
704a4b75
VS
4%
5
00375592 6\section{\class{wxZipClassFactory}}\label{wxzipclassfactory}
704a4b75 7
00375592
VZ
8Class factory for the zip archive format. See the base class
9for details.
704a4b75 10
00375592 11\wxheading{Derived from}
f6bcfd97 12
7376079d
VZ
13\helpref{wxArchiveClassFactory}{wxarchiveclassfactory}\\
14\helpref{wxObject}{wxobject}
f6bcfd97 15
00375592
VZ
16\wxheading{Include files}
17
18<wx/zipstrm.h>
19
a7af285d
VZ
20\wxheading{Library}
21
22\helpref{wxBase}{librarieslist}
23
00375592
VZ
24\wxheading{See also}
25
26\helpref{Archive formats such as zip}{wxarc}\\
601bee5c 27\helpref{Generic archive programming}{wxarcgeneric}\\
00375592
VZ
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
40Holds the meta-data for an entry in a zip.
f6bcfd97 41
704a4b75
VS
42\wxheading{Derived from}
43
7376079d
VZ
44\helpref{wxArchiveEntry}{wxarchiveentry}\\
45\helpref{wxObject}{wxobject}
9704b250
VS
46
47\wxheading{Include files}
48
49<wx/zipstrm.h>
704a4b75 50
a7af285d
VZ
51\wxheading{Library}
52
53\helpref{wxBase}{librarieslist}
54
00375592
VZ
55\wxheading{Data structures}
56
57Constants for \helpref{Get/SetMethod}{wxzipentrymethod}:
58
59\begin{verbatim}
60// Compression Method, only 0 (store) and 8 (deflate) are supported here
61//
62enum 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
80Constants 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//
88enum 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
113Constants for \helpref{Get/SetExternalAttributes}{wxzipentryexternalattributes}:
114
115\begin{verbatim}
116// Dos/Win file attributes
117//
118enum 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
131Constants for \helpref{Get/SetFlags}{wxzipentrygetflags}:
132
133\begin{verbatim}
134// Values for the flags field in the zip headers
135//
136enum 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
163When reading a zip from a stream that is seekable,
164 \helpref{GetNextEntry()}{wxzipinputstreamgetnextentry} returns
165a fully populated wxZipEntry object except for
166 \helpref{wxZipEntry::GetLocalExtra()}{wxzipentrylocalextra}. GetLocalExtra()
167becomes available when the entry is opened, either by calling
168 \helpref{wxZipInputStream::OpenEntry}{wxzipinputstreamopenentry} or by
169making an attempt to read the entry's data.
170
171For zips on \helpref{non-seekable}{wxarcnoseek} streams, the following
172fields 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
184The following fields are also usually available when GetNextEntry()
185returns, however, if the zip was also written to a non-seekable stream
186the zipper is permitted to store them after the entry's data. In that
187case they become available when the entry's data has been read to Eof(),
188or \helpref{CloseEntry()}{wxarchiveinputstreamcloseentry} has been called.
189{\tt (GetFlags() \& wxZIP\_SUMS\_FOLLOW) != 0} indicates that one or
190more of these come after the data:
191
192\helpref{GetCompressedSize}{wxzipentrygetcompressedsize}\\
193\helpref{GetCrc}{wxzipentrygetcrc}\\
194\helpref{GetSize}{wxarchiveentrysize}
195
196The following are stored at the end of the zip, and become available
197when the end of the zip has been reached, i.e. after GetNextEntry()
198returns 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
704a4b75
VS
210\latexignore{\rtfignore{\wxheading{Members}}}
211
00375592
VZ
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
217Constructor.
218
219\func{}{wxZipEntry}{\param{const wxZipEntry\& }{entry}}
220
221Copy constructor.
222
223
224\membersection{wxZipEntry::Clone}\label{wxzipentryclone}
225
226\constfunc{wxZipEntry*}{Clone}{\void}
227
228Make 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
237A short comment for this entry.
238
239
240\membersection{wxZipEntry::GetCompressedSize}\label{wxzipentrygetcompressedsize}
241
242\constfunc{off\_t}{GetCompressedSize}{\void}
243
244The compressed size of this entry in bytes.
245
246
247\membersection{wxZipEntry::GetCrc}\label{wxzipentrygetcrc}
248
249\constfunc{wxUint32}{GetCrc}{\void}
250
251CRC32 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
260The low 8 bits are always the DOS/Windows file attributes for this entry.
261The values of these attributes are given in the
262enumeration {\tt wxZipAttributes}.
263
264The remaining bits can store platform specific permission bits or
265attributes, and their meaning depends on the value
266of \helpref{SetSystemMadeBy()}{wxzipentrysystemmadeby}.
267If \helpref{IsMadeByUnix()}{wxzipentryismadebyunix} is true then the
268high 16 bits are unix mode bits.
269
270The 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
285The extra field from the entry's central directory record.
286
287The extra field is used to store platform or application specific
288data. 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
295Returns 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
302Returns the entry's filename in the internal format used within the
303archive. The name can include directory components, i.e. it can be a
304full path.
305
306The names of directory entries are returned without any trailing path
307separator. 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
311A static member that translates a filename into the internal format used
312within the archive. If the third parameter is provided, the bool pointed
313to 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
329The extra field from the entry's local record.
330
331The extra field is used to store platform or application specific
332data. 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
341The compression method. The enumeration {\tt wxZipMethod} lists the
342possible values.
343
344The default constructor sets this to wxZIP\_METHOD\_DEFAULT,
345which allows \helpref{wxZipOutputStream}{wxzipoutputstream} to
346choose the method when writing the entry.
347
348
349\membersection{wxZipEntry::Get/SetMode}\label{wxzipentrymode}
350
351\constfunc{int}{GetMode}{\void}
352
353If \helpref{IsMadeByUnix()}{wxzipentryismadebyunix} is true then
354returns the unix permission bits stored in
355 \helpref{GetExternalAttributes()}{wxzipentryexternalattributes}.
356Otherwise synthesises them from the DOS attributes.
357
358\func{void}{SetMode}{\param{int }{mode}}
359
360Sets the DOS attributes
361in \helpref{GetExternalAttributes()}{wxzipentryexternalattributes}
362to be consistent with the {\tt mode} given.
363
364If \helpref{IsMadeByUnix()}{wxzipentryismadebyunix} is true then also
365stores {\tt mode} in GetExternalAttributes().
366
367Note that the default constructor
368sets \helpref{GetSystemMadeBy()}{wxzipentrysystemmadeby} to
369wxZIP\_SYSTEM\_MSDOS by default. So to be able to store unix
370permissions 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
379Sets the \helpref{notifier}{wxzipnotifier} for this entry.
380Whenever the \helpref{wxZipInputStream}{wxzipinputstream} updates
381this entry, it will then invoke the associated
382notifier's \helpref{OnEntryUpdated}{wxzipnotifieronentryupdated}
383method.
384
385Setting a notifier is not usually necessary. It is used to handle
386certain cases when modifying an zip in a pipeline (i.e. between
387non-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
401The originating file-system. The default constructor sets this to
402wxZIP\_SYSTEM\_MSDOS. Set it to wxZIP\_SYSTEM\_UNIX in order to be
403able to store unix permissions using \helpref{SetMode()}{wxzipentrymode}.
404
405
406\membersection{wxZipEntry::IsMadeByUnix}\label{wxzipentryismadebyunix}
407
408\constfunc{bool}{IsMadeByUnix}{\void}
409
410Returns true if \helpref{GetSystemMadeBy()}{wxzipentrysystemmadeby}
411is 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
420Indicates 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
427Assignment 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
437Input stream for reading zip files.
438
439\helpref{GetNextEntry()}{wxzipinputstreamgetnextentry} returns an
440 \helpref{wxZipEntry}{wxzipentry} object containing the meta-data
441for the next entry in the zip (and gives away ownership). Reading from
442the wxZipInputStream then returns the entry's data. Eof() becomes true
443after an attempt has been made to read past the end of the entry's data.
444When there are no more entries, GetNextEntry() returns NULL and sets Eof().
445
df467a9d
MW
446Note that in general zip entries are not seekable, and
447wxZipInputStream::SeekI() always returns wxInvalidOffset.
448
00375592
VZ
449\wxheading{Derived from}
450
7376079d
VZ
451\helpref{wxArchiveInputStream}{wxarchiveinputstream}\\
452\helpref{wxFilterInputStream}{wxfilterinputstream}\\
453\helpref{wxInputStream}{wxinputstream}\\
454\helpref{wxStreamBase}{wxstreambase}
00375592
VZ
455
456\wxheading{Include files}
457
458<wx/zipstrm.h>
459
a7af285d
VZ
460\wxheading{Library}
461
462\helpref{wxBase}{librarieslist}
463
00375592 464\wxheading{Data structures}
46263455
VZ
465\begin{verbatim}
466typedef wxZipEntry entry_type
467\end{verbatim}
00375592
VZ
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
704a4b75
VS
478\membersection{wxZipInputStream::wxZipInputStream}\label{wxzipinputstreamwxzipinputstream}
479
00375592
VZ
480\func{}{wxZipInputStream}{\param{wxInputStream\& }{stream}, \param{wxMBConv\& }{conv = wxConvLocal}}
481
716b1f70
MW
482\func{}{wxZipInputStream}{\param{wxInputStream*}{stream}, \param{wxMBConv\& }{conv = wxConvLocal}}
483
00375592
VZ
484Constructor. In a Unicode build the second parameter {\tt conv} is
485used to translate the filename and comment fields into Unicode. It has
486no effect on the stream's data.
487
716b1f70
MW
488If the parent stream is passed as a pointer then the new filter stream
489takes ownership of it. If it is passed by reference then it does not.
490
704a4b75
VS
491\func{}{wxZipInputStream}{\param{const wxString\& }{archive}, \param{const wxString\& }{file}}
492
716b1f70 493Compatibility constructor (requires WXWIN\_COMPATIBILITY\_2\_6).
00375592 494
df467a9d
MW
495When this constructor is used, an emulation of seeking is
496switched on for compatibility with previous versions. Note however,
497that it is deprecated.
498
00375592
VZ
499
500\membersection{wxZipInputStream::CloseEntry}\label{wxzipinputstreamcloseentry}
501
502\func{bool}{CloseEntry}{\void}
503
504Closes the current entry. On a non-seekable stream reads to the end of
505the current entry first.
506
507
508\membersection{wxZipInputStream::GetComment}\label{wxzipinputstreamgetcomment}
509
510\func{wxString}{GetComment}{\void}
511
512Returns the zip comment.
513
43e8916f 514This is stored at the end of the zip, therefore when reading a zip
00375592
VZ
515from a non-seekable stream, it returns the empty string until the
516end of the zip has been reached, i.e. when GetNextEntry() returns
517NULL.
518
519
520\membersection{wxZipInputStream::GetNextEntry}\label{wxzipinputstreamgetnextentry}
521
522\func{wxZipEntry*}{GetNextEntry}{\void}
523
524Closes the current entry if one is open, then reads the meta-data for
525the next entry and returns it in a \helpref{wxZipEntry}{wxzipentry}
526object, 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
533For a zip on a seekable stream returns the total number of entries in
534the zip. For zips on non-seekable streams returns the number of entries
535returned so far by \helpref{GetNextEntry()}{wxzipinputstreamgetnextentry}.
536
537
538\membersection{wxZipInputStream::OpenEntry}\label{wxzipinputstreamopenentry}
539
540\func{bool}{OpenEntry}{\param{wxZipEntry\& }{entry}}
541
542Closes the current entry if one is open, then opens the entry specified
543by the {\it entry} object.
544
545{\it entry} should be from the same zip file, and the zip should
546be 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
560If you need to know when a \helpref{wxZipInputStream}{wxzipinputstream}
561updates a \helpref{wxZipEntry}{wxzipentry},
562you can create a notifier by deriving from this abstract base class,
563overriding \helpref{OnEntryUpdated()}{wxzipnotifieronentryupdated}.
564An instance of your notifier class can then be assigned to wxZipEntry
565objects, using \helpref{wxZipEntry::SetNotifier()}{wxzipentrynotifier}.
566
567Setting a notifier is not usually necessary. It is used to handle
568certain cases when modifying an zip in a pipeline (i.e. between
569non-seekable streams).
570See '\helpref{Archives on non-seekable streams}{wxarcnoseek}'.
571
572\wxheading{Derived from}
573
574No base class
575
576\wxheading{Include files}
577
578<wx/zipstrm.h>
579
a7af285d
VZ
580\wxheading{Library}
581
582\helpref{wxBase}{librarieslist}
583
00375592
VZ
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
598Override this to receive notifications when
599an \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
609Output stream for writing zip files.
610
611\helpref{PutNextEntry()}{wxzipoutputstreamputnextentry} is used to create
612a new entry in the output zip, then the entry's data is written to the
613wxZipOutputStream. Another call to PutNextEntry() closes the current
614entry and begins the next.
615
616\wxheading{Derived from}
617
7376079d
VZ
618\helpref{wxArchiveOutputStream}{wxarchiveoutputstream}\\
619\helpref{wxFilterOutputStream}{wxfilteroutputstream}\\
620\helpref{wxOutputStream}{wxoutputstream}\\
621\helpref{wxStreamBase}{wxstreambase}
00375592
VZ
622
623\wxheading{Include files}
624
625<wx/zipstrm.h>
626
a7af285d
VZ
627\wxheading{Library}
628
629\helpref{wxBase}{librarieslist}
630
00375592
VZ
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
716b1f70
MW
644\func{}{wxZipOutputStream}{\param{wxOutputStream*}{stream}, \param{int }{level = -1}, \param{wxMBConv\& }{conv = wxConvLocal}}
645
00375592
VZ
646Constructor. {\tt level} is the compression level to use.
647It can be a value between 0 and 9 or -1 to use the default value
648which currently is equivalent to 6.
649
716b1f70
MW
650If the parent stream is passed as a pointer then the new filter stream
651takes ownership of it. If it is passed by reference then it does not.
652
00375592 653In a Unicode build the third parameter {\tt conv} is used to translate
08202189 654the filename and comment fields to an 8-bit encoding. It has no effect on the
00375592
VZ
655stream's data.
656
657
658\membersection{wxZipOutputStream::\destruct{wxZipOutputStream}}\label{wxzipoutputstreamdtor}
659
660\func{}{\destruct{wxZipOutputStream}}{\void}
661
662The destructor calls \helpref{Close()}{wxzipoutputstreamclose} to finish
663writing the zip if it has not been called already.
664
665
666\membersection{wxZipOutputStream::Close}\label{wxzipoutputstreamclose}
667
668\func{bool}{Close}{\void}
669
08202189 670Finishes writing the zip, returning true if successful.
00375592
VZ
671Called by the destructor if not called explicitly.
672
673
674\membersection{wxZipOutputStream::CloseEntry}\label{wxzipoutputstreamcloseentry}
675
676\func{bool}{CloseEntry}{\void}
677
678Close the current entry. It is called implicitly whenever another new
679entry is created with \helpref{CopyEntry()}{wxzipoutputstreamcopyentry}
680or \helpref{PutNextEntry()}{wxzipoutputstreamputnextentry}, or
681when the zip is closed.
682
683
684\membersection{wxZipOutputStream::CopyArchiveMetaData}\label{wxzipoutputstreamcopyarchivemetadata}
685
686\func{bool}{CopyArchiveMetaData}{\param{wxZipInputStream\& }{inputStream}}
687
688Transfers the zip comment from the \helpref{wxZipInputStream}{wxzipinputstream}
689to this output stream.
690
691
692\membersection{wxZipOutputStream::CopyEntry}\label{wxzipoutputstreamcopyentry}
693
694\func{bool}{CopyEntry}{\param{wxZipEntry* }{entry}, \param{wxZipInputStream\& }{inputStream}}
695
696Takes ownership of {\tt entry} and uses it to create a new entry
697in the zip. {\tt entry} is then opened in {\tt inputStream} and its contents
698copied to this stream.
699
700CopyEntry() is much more efficient than transferring the data using
701Read() and Write() since it will copy them without decompressing and
702recompressing them.
703
704For zips on seekable streams, {\tt entry} must be from the same zip file
705as {\tt stream}. For non-seekable streams, {\tt entry} must also be the
706last 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
715Set the compression level that will be used the next time an entry is
716created. It can be a value between 0 and 9 or -1 to use the default value
717which 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
724Create a new directory entry
725(see \helpref{wxArchiveEntry::IsDir()}{wxarchiveentryisdir})
726with the given name and timestamp.
727
728\helpref{PutNextEntry()}{wxzipoutputstreamputnextentry} can
729also be used to create directory entries, by supplying a name with
730a trailing path separator.
731
732
733\membersection{wxZipOutputStream::PutNextEntry}\label{wxzipoutputstreamputnextentry}
734
735\func{bool}{PutNextEntry}{\param{wxZipEntry* }{entry}}
736
737Takes ownership of {\tt entry} and uses it to create a new entry
738in the zip.
739
740\func{bool}{PutNextEntry}{\param{const wxString\& }{name}, \param{const wxDateTime\& }{dt = wxDateTime::Now()}, \param{off\_t }{size = wxInvalidOffset}}
741
742Create a new entry with the given name, timestamp and size.
743
704a4b75 744
00375592 745\membersection{wxZipOutputStream::SetComment}\label{wxzipoutputstreamsetcomment}
704a4b75 746
00375592 747\func{void}{SetComment}{\param{const wxString\& }{comment}}
704a4b75 748
00375592
VZ
749Sets a comment for the zip as a whole. It is written at the end of the
750zip.
704a4b75 751