]> git.saurik.com Git - wxWidgets.git/blame_incremental - docs/latex/wx/archive.tex
More const bool (sigh)
[wxWidgets.git] / docs / latex / wx / archive.tex
... / ...
CommitLineData
1%
2% automatically generated by HelpGen $Revision$ from
3% wx/archive.h at 16/Sep/04 12:19:29
4%
5
6\section{\class{wxArchiveClassFactory}}\label{wxarchiveclassfactory}
7
8Allows the creation of streams to handle archive formats such
9as zip and tar.
10
11For example, given a filename you can search for a factory that will
12handle it and create a stream to read it:
13
14\begin{verbatim}
15 factory = wxArchiveClassFactory::Find(filename, wxSTREAM_FILEEXT);
16 if (factory)
17 stream = factory->NewStream(new wxFFileInputStream(filename));
18
19\end{verbatim}
20
21\helpref{Find()}{wxarchiveclassfactoryfind} can also search
22for a factory by MIME type or wxFileSystem protocol.
23The available factories can be enumerated
24using \helpref{GetFirst() and GetNext()}{wxarchiveclassfactorygetfirst}.
25
26\wxheading{Derived from}
27
28\helpref{wxObject}{wxobject}
29
30\wxheading{Include files}
31
32<wx/archive.h>
33
34\wxheading{Data structures}
35
36\begin{verbatim}
37enum wxStreamProtocolType
38{
39 wxSTREAM_PROTOCOL, // wxFileSystem protocol (should be only one)
40 wxSTREAM_MIMETYPE, // MIME types the stream handles
41 wxSTREAM_ENCODING, // Not used for archives
42 wxSTREAM_FILEEXT // File extensions the stream handles
43};
44
45\end{verbatim}
46
47\wxheading{See also}
48
49\helpref{Archive formats such as zip}{wxarc}\\
50\helpref{Generic archive programming}{wxarcgeneric}\\
51\helpref{wxArchiveEntry}{wxarchiveentry}\\
52\helpref{wxArchiveInputStream}{wxarchiveinputstream}\\
53\helpref{wxArchiveOutputStream}{wxarchiveoutputstream}\\
54\helpref{wxFilterClassFactory}{wxfilterclassfactory}
55
56\latexignore{\rtfignore{\wxheading{Members}}}
57
58
59\membersection{wxArchiveClassFactory::Get/SetConv}\label{wxarchiveclassfactoryconv}
60
61\constfunc{wxMBConv\&}{GetConv}{\void}
62
63\func{void}{SetConv}{\param{wxMBConv\& }{conv}}
64
65The \helpref{wxMBConv}{wxmbconv} object that the created streams
66will use when translating meta-data. The initial default, set by the
67constructor, is wxConvLocal.
68
69
70\membersection{wxArchiveClassFactory::CanHandle}\label{wxarchiveclassfactorycanhandle}
71
72\constfunc{bool}{CanHandle}{\param{const wxChar* }{protocol}, \param{wxStreamProtocolType }{type = wxSTREAM\_PROTOCOL}}
73
74Returns true if this factory can handle the given protocol, MIME type
75or file extension.
76
77When using wxSTREAM\_FILEEXT for the second parameter, the first parameter
78can be a complete filename rather than just an extension.
79
80
81\membersection{wxArchiveClassFactory::Find}\label{wxarchiveclassfactoryfind}
82
83\func{static const wxArchiveClassFactory*}{Find}{\param{const wxChar* }{protocol}, \param{wxStreamProtocolType }{type = wxSTREAM\_PROTOCOL}}
84
85A static member that finds a factory that can handle a given protocol, MIME
86type or file extension. Returns a pointer to the class factory if found, or
87NULL otherwise. It does not give away ownership of the factory.
88
89When using wxSTREAM\_FILEEXT for the second parameter, the first parameter
90can be a complete filename rather than just an extension.
91
92
93\membersection{wxArchiveClassFactory::GetFirst/GetNext}\label{wxarchiveclassfactorygetfirst}
94
95\func{static const wxArchiveClassFactory*}{GetFirst}{\void}
96
97\constfunc{const wxArchiveClassFactory*}{GetNext}{\void}
98
99GetFirst and GetNext can be used to enumerate the available factories.
100
101For example, to list them:
102
103\begin{verbatim}
104 wxString list;
105 const wxArchiveClassFactory *factory = wxArchiveClassFactory::GetFirst();
106
107 while (factory) {
108 list << factory->GetProtocol() << _T("\n");
109 factory = factory->GetNext();
110 }
111
112\end{verbatim}
113
114GetFirst()/GetNext() return a pointer to a factory or NULL if no more
115are available. They do not give away ownership of the factory.
116
117
118\membersection{wxArchiveClassFactory::GetInternalName}\label{wxarchiveclassfactorygetinternalname}
119
120\constfunc{wxString}{GetInternalName}{\param{const wxString\& }{name}, \param{wxPathFormat }{format = wxPATH\_NATIVE}}
121
122Calls the static GetInternalName() function for the archive entry type,
123for example
124 \helpref{wxZipEntry::GetInternalName()}{wxzipentrygetinternalname}.
125
126
127\membersection{wxArchiveClassFactory::GetProtocol}\label{wxarchiveclassfactorygetprotocol}
128
129\constfunc{wxString}{GetProtocol}{\void}
130
131Returns the wxFileSystem protocol supported by this factory. Equivalent
132to wxString(*GetProtcols()).
133
134
135\membersection{wxArchiveClassFactory::GetProtocols}\label{wxarchiveclassfactorygetprotocols}
136
137\constfunc{const wxChar * const*}{GetProtocols}{\param{wxStreamProtocolType }{type = wxSTREAM\_PROTOCOL}}
138
139Returns the protocols, MIME types or file extensions supported by this
140factory, as an array of null terminated strings. It does not give away
141ownership of the array or strings.
142
143For example, to list the file extensions a factory supports:
144
145\begin{verbatim}
146 wxString list;
147 const wxChar *const *p;
148
149 for (p = factory->GetProtocols(wxSTREAM_FILEEXT); *p; p++)
150 list << *p << _T("\n");
151
152\end{verbatim}
153
154
155\membersection{wxArchiveClassFactory::NewEntry}\label{wxarchiveclassfactorynewentry}
156
157\constfunc{wxArchiveEntry*}{NewEntry}{\void}
158
159Create a new \helpref{wxArchiveEntry}{wxarchiveentry} object of the
160appropriate type.
161
162
163\membersection{wxArchiveClassFactory::NewStream}\label{wxarchiveclassfactorynewstream}
164
165\constfunc{wxArchiveInputStream*}{NewStream}{\param{wxInputStream\& }{stream}}
166
167\constfunc{wxArchiveOutputStream*}{NewStream}{\param{wxOutputStream\& }{stream}}
168
169\constfunc{wxArchiveInputStream*}{NewStream}{\param{wxInputStream* }{stream}}
170
171\constfunc{wxArchiveOutputStream*}{NewStream}{\param{wxOutputStream* }{stream}}
172
173Create a new input or output stream to read or write an archive.
174
175If the parent stream is passed as a pointer then the new archive stream
176takes ownership of it. If it is passed by reference then it does not.
177
178
179\membersection{wxArchiveClassFactory::PushFront}\label{wxarchiveclassfactorypushfront}
180
181\func{void}{PushFront}{\void}
182
183Adds this class factory to the list returned
184by \helpref{GetFirst()/GetNext()}{wxarchiveclassfactorygetfirst}.
185
186It is not necessary to do this to use the archive streams. It is usually
187used when implementing streams, typically the implementation will
188add a static instance of its factory class.
189
190It can also be used to change the order of a factory already in the list,
191bringing it to the front. This isn't a thread safe operation
192so can't be done when other threads are running that will be using the list.
193
194The list does not take ownership of the factory.
195
196
197\membersection{wxArchiveClassFactory::Remove}\label{wxarchiveclassfactoryremove}
198
199\func{void}{Remove}{\void}
200
201Removes this class factory from the list returned
202by \helpref{GetFirst()/GetNext()}{wxarchiveclassfactorygetfirst}.
203
204Removing from the list isn't a thread safe operation
205so can't be done when other threads are running that will be using the list.
206
207The list does not own the factories, so removing a factory does not delete it.
208
209
210%
211% automatically generated by HelpGen $Revision$ from
212% wx/archive.h at 16/Sep/04 12:19:29
213%
214
215\section{\class{wxArchiveEntry}}\label{wxarchiveentry}
216
217An abstract base class which serves as a common interface to
218archive entry classes such as \helpref{wxZipEntry}{wxzipentry}.
219These hold the meta-data (filename, timestamp, etc.), for entries
220in archive files such as zips and tars.
221
222\wxheading{Derived from}
223
224\helpref{wxObject}{wxobject}
225
226\wxheading{Include files}
227
228<wx/archive.h>
229
230\wxheading{See also}
231
232\helpref{Archive formats such as zip}{wxarc}\\
233\helpref{Generic archive programming}{wxarcgeneric}\\
234\helpref{wxArchiveInputStream}{wxarchiveinputstream}\\
235\helpref{wxArchiveOutputStream}{wxarchiveoutputstream}\\
236\helpref{wxArchiveNotifier}{wxarchivenotifier}
237
238\wxheading{Non-seekable streams}
239
240This information applies only when reading archives from non-seekable
241streams. When the stream is
242seekable \helpref{GetNextEntry()}{wxarchiveinputstreamgetnextentry}
243returns a fully populated \helpref{wxArchiveEntry}{wxarchiveentry}.
244See '\helpref{Archives on non-seekable streams}{wxarcnoseek}' for
245more information.
246
247For generic programming, when the worst case must be assumed, you can
248rely on all the fields of wxArchiveEntry being fully populated when
249GetNextEntry() returns, with the the following exceptions:
250
251\begin{twocollist}\twocolwidtha{3cm}
252\twocolitem{\helpref{GetSize()}{wxarchiveentrysize}}{Guaranteed to be
253available after the entry has been read to \helpref{Eof()}{wxinputstreameof},
254or \helpref{CloseEntry()}{wxarchiveinputstreamcloseentry} has been called}
255\twocolitem{\helpref{IsReadOnly()}{wxarchiveentryisreadonly}}{Guaranteed to
256be available after the end of the archive has been reached, i.e. after
257GetNextEntry() returns NULL and Eof() is true}
258\end{twocollist}
259
260
261\latexignore{\rtfignore{\wxheading{Members}}}
262
263
264\membersection{wxArchiveEntry::Clone}\label{wxarchiveentryclone}
265
266\constfunc{wxArchiveEntry*}{Clone}{\void}
267
268Returns a copy of this entry object.
269
270
271\membersection{wxArchiveEntry::Get/SetDateTime}\label{wxarchiveentrydatetime}
272
273\constfunc{wxDateTime}{GetDateTime}{\void}
274
275\func{void}{SetDateTime}{\param{const wxDateTime\& }{dt}}
276
277The entry's timestamp.
278
279
280\membersection{wxArchiveEntry::GetInternalFormat}\label{wxarchiveentrygetinternalformat}
281
282\constfunc{wxPathFormat}{GetInternalFormat}{\void}
283
284Returns the path format used internally within the archive to store
285filenames.
286
287
288\membersection{wxArchiveEntry::GetInternalName}\label{wxarchiveentrygetinternalname}
289
290\constfunc{wxString}{GetInternalName}{\void}
291
292Returns the entry's filename in the internal format used within the
293archive. The name can include directory components, i.e. it can be a
294full path.
295
296The names of directory entries are returned without any trailing path
297separator. This gives a canonical name that can be used in comparisons.
298
299\wxheading{See also}
300
301\helpref{Looking up an archive entry by name}{wxarcbyname}
302
303
304\membersection{wxArchiveEntry::Get/SetName}\label{wxarchiveentryname}
305
306\constfunc{wxString}{GetName}{\param{wxPathFormat }{format = wxPATH\_NATIVE}}
307
308\func{void}{SetName}{\param{const wxString\& }{name}, \param{wxPathFormat }{format = wxPATH\_NATIVE}}
309
310The entry's name, by default in the native format. The name can include
311directory components, i.e. it can be a full path.
312
313If this is a directory entry, (i.e. if \helpref{IsDir()}{wxarchiveentryisdir}
314is true) then GetName() returns the name with a trailing path separator.
315
316Similarly, setting a name with a trailing path separator sets IsDir().
317
318
319\membersection{wxArchiveEntry::GetOffset}\label{wxarchiveentrygetoffset}
320
321\constfunc{off\_t}{GetOffset}{\void}
322
323Returns a numeric value unique to the entry within the archive.
324
325
326\membersection{wxArchiveEntry::Get/SetSize}\label{wxarchiveentrysize}
327
328\constfunc{off\_t}{GetSize}{\void}
329
330\func{void}{SetSize}{\param{off\_t }{size}}
331
332The size of the entry's data in bytes.
333
334
335\membersection{wxArchiveEntry::IsDir/SetIsDir}\label{wxarchiveentryisdir}
336
337\constfunc{bool}{IsDir}{\void}
338
339\func{void}{SetIsDir}{\param{bool }{isDir = true}}
340
341True if this is a directory entry.
342
343Directory entries are entries with no data, which are used to store
344the meta-data of directories. They also make it possible for completely
345empty directories to be stored.
346
347The names of entries within an archive can be complete paths, and
348unarchivers typically create whatever directories are necessary as they
349restore files, even if the archive contains no explicit directory entries.
350
351
352\membersection{wxArchiveEntry::IsReadOnly/SetIsReadOnly}\label{wxarchiveentryisreadonly}
353
354\constfunc{bool}{IsReadOnly}{\void}
355
356\func{void}{SetIsReadOnly}{\param{bool }{isReadOnly = true}}
357
358True if the entry is a read-only file.
359
360
361\membersection{wxArchiveEntry::Set/UnsetNotifier}\label{wxarchiveentrynotifier}
362
363\func{void}{SetNotifier}{\param{wxArchiveNotifier\& }{notifier}}
364
365\func{void}{UnsetNotifier}{\void}
366
367Sets the \helpref{notifier}{wxarchivenotifier} for this entry.
368Whenever the \helpref{wxArchiveInputStream}{wxarchiveinputstream} updates
369this entry, it will then invoke the associated
370notifier's \helpref{OnEntryUpdated}{wxarchivenotifieronentryupdated}
371method.
372
373Setting a notifier is not usually necessary. It is used to handle
374certain cases when modifying an archive in a pipeline (i.e. between
375non-seekable streams).
376
377\wxheading{See also}
378
379\helpref{Archives on non-seekable streams}{wxarcnoseek}\\
380\helpref{wxArchiveNotifier}{wxarchivenotifier}
381
382
383%
384% automatically generated by HelpGen $Revision$ from
385% wx/archive.h at 16/Sep/04 12:19:29
386%
387
388\section{\class{wxArchiveInputStream}}\label{wxarchiveinputstream}
389
390An abstract base class which serves as a common interface to
391archive input streams such as \helpref{wxZipInputStream}{wxzipinputstream}.
392
393\helpref{GetNextEntry()}{wxarchiveinputstreamgetnextentry} returns an
394 \helpref{wxArchiveEntry}{wxarchiveentry} object containing the meta-data
395for the next entry in the archive (and gives away ownership). Reading from
396the wxArchiveInputStream then returns the entry's data. Eof() becomes true
397after an attempt has been made to read past the end of the entry's data.
398When there are no more entries, GetNextEntry() returns NULL and sets Eof().
399
400\wxheading{Derived from}
401
402\helpref{wxFilterInputStream}{wxfilterinputstream}
403
404\wxheading{Include files}
405
406<wx/archive.h>
407
408\wxheading{Data structures}
409\begin{verbatim}
410typedef wxArchiveEntry entry_type
411\end{verbatim}
412
413\wxheading{See also}
414
415\helpref{Archive formats such as zip}{wxarc}\\
416\helpref{wxArchiveEntry}{wxarchiveentry}\\
417\helpref{wxArchiveOutputStream}{wxarchiveoutputstream}
418
419\latexignore{\rtfignore{\wxheading{Members}}}
420
421
422\membersection{wxArchiveInputStream::CloseEntry}\label{wxarchiveinputstreamcloseentry}
423
424\func{bool}{CloseEntry}{\void}
425
426Closes the current entry. On a non-seekable stream reads to the end of
427the current entry first.
428
429
430\membersection{wxArchiveInputStream::GetNextEntry}\label{wxarchiveinputstreamgetnextentry}
431
432\func{wxArchiveEntry*}{GetNextEntry}{\void}
433
434Closes the current entry if one is open, then reads the meta-data for
435the next entry and returns it in a \helpref{wxArchiveEntry}{wxarchiveentry}
436object, giving away ownership. Reading this wxArchiveInputStream then
437returns the entry's data.
438
439
440\membersection{wxArchiveInputStream::OpenEntry}\label{wxarchiveinputstreamopenentry}
441
442\func{bool}{OpenEntry}{\param{wxArchiveEntry\& }{entry}}
443
444Closes the current entry if one is open, then opens the entry specified
445by the \helpref{wxArchiveEntry}{wxarchiveentry} object.
446
447{\it entry} must be from the same archive file that this
448wxArchiveInputStream is reading, and it must be reading it from a
449seekable stream.
450
451\wxheading{See also}
452
453\helpref{Looking up an archive entry by name}{wxarcbyname}
454
455
456%
457% automatically generated by HelpGen $Revision$ from
458% wx/archive.h at 16/Sep/04 12:19:29
459%
460
461\section{\class{wxArchiveIterator}}\label{wxarchiveiterator}
462
463An input iterator template class that can be used to transfer an archive's
464catalogue to a container. It is only available if wxUSE\_STL is set to 1
465in setup.h, and the uses for it outlined below require a compiler which
466supports member templates.
467
468\begin{verbatim}
469template <class Arc, class T = typename Arc::entry_type*>
470class wxArchiveIterator
471{
472 // this constructor creates an 'end of sequence' object
473 wxArchiveIterator();
474
475 // template parameter 'Arc' should be the type of an archive input stream
476 wxArchiveIterator(Arc& arc) {
477
478 /* ... */
479};
480
481\end{verbatim}
482
483The first template parameter should be the type of archive input stream
484(e.g. \helpref{wxArchiveInputStream}{wxarchiveinputstream}) and the
485second can either be a pointer to an entry
486(e.g. \helpref{wxArchiveEntry}{wxarchiveentry}*), or a string/pointer pair
487(e.g. std::pair<wxString, wxArchiveEntry*>).
488
489The {\tt <wx/archive.h>} header defines the following typedefs:
490
491\begin{verbatim}
492 typedef wxArchiveIterator<wxArchiveInputStream> wxArchiveIter;
493
494 typedef wxArchiveIterator<wxArchiveInputStream,
495 std::pair<wxString, wxArchiveEntry*> > wxArchivePairIter;
496
497\end{verbatim}
498
499The header for any implementation of this interface should define similar
500typedefs for its types, for example in {\tt <wx/zipstrm.h>} there is:
501
502\begin{verbatim}
503 typedef wxArchiveIterator<wxZipInputStream> wxZipIter;
504
505 typedef wxArchiveIterator<wxZipInputStream,
506 std::pair<wxString, wxZipEntry*> > wxZipPairIter;
507
508\end{verbatim}
509
510Transferring the catalogue of an archive {\it arc} to a vector {\it cat},
511can then be done something like this:
512
513\begin{verbatim}
514 std::vector<wxArchiveEntry*> cat((wxArchiveIter)arc, wxArchiveIter());
515
516\end{verbatim}
517
518When the iterator is dereferenced, it gives away ownership of an entry
519object. So in the above example, when you have finished with {\it cat}
520you must delete the pointers it contains.
521
522If you have smart pointers with normal copy semantics (i.e. not auto\_ptr
523or \helpref{wxScopedPtr}{wxscopedptr}), then you can create an iterator
524which uses them instead. For example, with a smart pointer class for
525zip entries {\it ZipEntryPtr}:
526
527\begin{verbatim}
528 typedef std::vector<ZipEntryPtr> ZipCatalog;
529 typedef wxArchiveIterator<wxZipInputStream, ZipEntryPtr> ZipIter;
530 ZipCatalog cat((ZipIter)zip, ZipIter());
531
532\end{verbatim}
533
534Iterators that return std::pair objects can be used to
535populate a std::multimap, to allow entries to be looked
536up by name. The string is initialised using the wxArchiveEntry object's
537 \helpref{GetInternalName()}{wxarchiveentrygetinternalname} function.
538
539\begin{verbatim}
540 typedef std::multimap<wxString, wxZipEntry*> ZipCatalog;
541 ZipCatalog cat((wxZipPairIter)zip, wxZipPairIter());
542
543\end{verbatim}
544
545Note that this iterator also gives away ownership of an entry
546object each time it is dereferenced. So in the above example, when
547you have finished with {\it cat} you must delete the pointers it contains.
548
549Or if you have them, a pair containing a smart pointer can be used
550(again {\it ZipEntryPtr}), no worries about ownership:
551
552\begin{verbatim}
553 typedef std::multimap<wxString, ZipEntryPtr> ZipCatalog;
554 typedef wxArchiveIterator<wxZipInputStream,
555 std::pair<wxString, ZipEntryPtr> > ZipPairIter;
556 ZipCatalog cat((ZipPairIter)zip, ZipPairIter());
557
558\end{verbatim}
559
560\wxheading{Derived from}
561
562No base class
563
564\wxheading{Include files}
565
566<wx/archive.h>
567
568\wxheading{See also}
569
570\helpref{wxArchiveEntry}{wxarchiveentry}\\
571\helpref{wxArchiveInputStream}{wxarchiveinputstream}\\
572\helpref{wxArchiveOutputStream}{wxarchiveoutputstream}
573
574\wxheading{Data structures}
575\begin{verbatim}
576typedef std::input_iterator_tag iterator_category
577typedef T value_type
578typedef ptrdiff_t difference_type
579typedef T* pointer
580typedef T& reference
581\end{verbatim}
582
583\latexignore{\rtfignore{\wxheading{Members}}}
584
585
586\membersection{wxArchiveIterator::wxArchiveIterator}\label{wxarchiveiteratorwxarchiveiterator}
587
588\func{}{wxArchiveIterator}{\void}
589
590Construct an 'end of sequence' instance.
591
592\func{}{wxArchiveIterator}{\param{Arc\& }{arc}}
593
594Construct iterator that returns all the entries in the archive input
595stream {\it arc}.
596
597
598\membersection{wxArchiveIterator::operator*}\label{wxarchiveiteratoroperatorstar}
599
600\constfunc{const T\&}{operator*}{\void}
601
602Returns an entry object from the archive input stream, giving away
603ownership.
604
605
606\membersection{wxArchiveIterator::operator++}\label{wxarchiveiteratoroperatorincrement}
607
608\func{wxArchiveIterator\&}{operator++}{\void}
609
610\func{wxArchiveIterator\&}{operator++}{\param{int}{}}
611
612Position the input iterator at the next entry in the archive input stream.
613
614
615%
616% automatically generated by HelpGen $Revision$ from
617% wx/archive.h at 16/Sep/04 12:19:29
618%
619
620\section{\class{wxArchiveNotifier}}\label{wxarchivenotifier}
621
622If you need to know when a
623 \helpref{wxArchiveInputStream}{wxarchiveinputstream} updates a
624 \helpref{wxArchiveEntry}{wxarchiveentry} object, you can create
625a notifier by deriving from this abstract base class, overriding
626 \helpref{OnEntryUpdated()}{wxarchivenotifieronentryupdated}. An instance
627of your notifier class can then be assigned to the wxArchiveEntry object
628using \helpref{wxArchiveEntry::SetNotifier()}{wxarchiveentrynotifier}.
629Your OnEntryUpdated() method will then be invoked whenever the input
630stream updates the entry.
631
632Setting a notifier is not usually necessary. It is used to handle
633certain cases when modifying an archive in a pipeline (i.e. between
634non-seekable streams).
635See \helpref{Archives on non-seekable streams}{wxarcnoseek}.
636
637\wxheading{Derived from}
638
639No base class
640
641\wxheading{Include files}
642
643<wx/archive.h>
644
645\wxheading{See also}
646
647\helpref{Archives on non-seekable streams}{wxarcnoseek}\\
648\helpref{wxArchiveEntry}{wxarchiveentry}\\
649\helpref{wxArchiveInputStream}{wxarchiveinputstream}\\
650\helpref{wxArchiveOutputStream}{wxarchiveoutputstream}
651
652\latexignore{\rtfignore{\wxheading{Members}}}
653
654
655\membersection{wxArchiveNotifier::OnEntryUpdated}\label{wxarchivenotifieronentryupdated}
656
657\func{void}{OnEntryUpdated}{\param{class wxArchiveEntry\& }{entry}}
658
659This method must be overridden in your derived class.
660
661
662%
663% automatically generated by HelpGen $Revision$ from
664% wx/archive.h at 16/Sep/04 12:19:29
665%
666
667\section{\class{wxArchiveOutputStream}}\label{wxarchiveoutputstream}
668
669An abstract base class which serves as a common interface to
670archive output streams such as \helpref{wxZipOutputStream}{wxzipoutputstream}.
671
672\helpref{PutNextEntry()}{wxarchiveoutputstreamputnextentry} is used
673to create a new entry in the output archive, then the entry's data is
674written to the wxArchiveOutputStream. Another call to PutNextEntry()
675closes the current entry and begins the next.
676
677\wxheading{Derived from}
678
679\helpref{wxFilterOutputStream}{wxfilteroutputstream}
680
681\wxheading{Include files}
682
683<wx/archive.h>
684
685\wxheading{See also}
686
687\helpref{Archive formats such as zip}{wxarc}\\
688\helpref{wxArchiveEntry}{wxarchiveentry}\\
689\helpref{wxArchiveInputStream}{wxarchiveinputstream}
690
691\latexignore{\rtfignore{\wxheading{Members}}}
692
693
694\membersection{wxArchiveOutputStream::\destruct{wxArchiveOutputStream}}\label{wxarchiveoutputstreamdtor}
695
696\func{}{\destruct{wxArchiveOutputStream}}{\void}
697
698Calls \helpref{Close()}{wxarchiveoutputstreamclose} if it has not already
699been called.
700
701
702\membersection{wxArchiveOutputStream::Close}\label{wxarchiveoutputstreamclose}
703
704\func{bool}{Close}{\void}
705
706Closes the archive, returning true if it was successfully written.
707Called by the destructor if not called explicitly.
708
709
710\membersection{wxArchiveOutputStream::CloseEntry}\label{wxarchiveoutputstreamcloseentry}
711
712\func{bool}{CloseEntry}{\void}
713
714Close the current entry. It is called implicitly whenever another new
715entry is created with \helpref{CopyEntry()}{wxarchiveoutputstreamcopyentry}
716or \helpref{PutNextEntry()}{wxarchiveoutputstreamputnextentry}, or
717when the archive is closed.
718
719
720\membersection{wxArchiveOutputStream::CopyArchiveMetaData}\label{wxarchiveoutputstreamcopyarchivemetadata}
721
722\func{bool}{CopyArchiveMetaData}{\param{wxArchiveInputStream\& }{stream}}
723
724Some archive formats have additional meta-data that applies to the archive
725as a whole. For example in the case of zip there is a comment, which
726is stored at the end of the zip file. CopyArchiveMetaData() can be used
727to transfer such information when writing a modified copy of an archive.
728
729Since the position of the meta-data can vary between the various archive
730formats, it is best to call CopyArchiveMetaData() before transferring
731the entries. The \helpref{wxArchiveOutputStream}{wxarchiveoutputstream}
732will then hold on to the meta-data and write it at the correct point in
733the output file.
734
735When the input archive is being read from a non-seekable stream, the
736meta-data may not be available when CopyArchiveMetaData() is called,
737in which case the two streams set up a link and transfer the data
738when it becomes available.
739
740
741\membersection{wxArchiveOutputStream::CopyEntry}\label{wxarchiveoutputstreamcopyentry}
742
743\func{bool}{CopyEntry}{\param{wxArchiveEntry* }{entry}, \param{wxArchiveInputStream\& }{stream}}
744
745Takes ownership of {\it entry} and uses it to create a new entry in the
746archive. {\it entry} is then opened in the input stream {\it stream}
747and its contents copied to this stream.
748
749For archive types which compress entry data, CopyEntry() is likely to be
750much more efficient than transferring the data using Read() and Write()
751since it will copy them without decompressing and recompressing them.
752
753{\it entry} must be from the same archive file that {\it stream} is
754accessing. For non-seekable streams, {\it entry} must also be the last
755thing read from {\it stream}.
756
757
758\membersection{wxArchiveOutputStream::PutNextDirEntry}\label{wxarchiveoutputstreamputnextdirentry}
759
760\func{bool}{PutNextDirEntry}{\param{const wxString\& }{name}, \param{const wxDateTime\& }{dt = wxDateTime::Now()}}
761
762Create a new directory entry
763(see \helpref{wxArchiveEntry::IsDir()}{wxarchiveentryisdir})
764with the given name and timestamp.
765
766\helpref{PutNextEntry()}{wxarchiveoutputstreamputnextentry} can
767also be used to create directory entries, by supplying a name with
768a trailing path separator.
769
770
771\membersection{wxArchiveOutputStream::PutNextEntry}\label{wxarchiveoutputstreamputnextentry}
772
773\func{bool}{PutNextEntry}{\param{wxArchiveEntry* }{entry}}
774
775Takes ownership of {\it entry} and uses it to create a new entry in
776the archive. The entry's data can then be written by writing to this
777wxArchiveOutputStream.
778
779\func{bool}{PutNextEntry}{\param{const wxString\& }{name}, \param{const wxDateTime\& }{dt = wxDateTime::Now()}, \param{off\_t }{size = wxInvalidOffset}}
780
781Create a new entry with the given name, timestamp and size. The entry's
782data can then be written by writing to this wxArchiveOutputStream.
783
784