]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/tarstrm.tex
test wxTE_NO_VSCROLL
[wxWidgets.git] / docs / latex / wx / tarstrm.tex
CommitLineData
b34c7f3c
MW
1%
2% automatically generated by HelpGen $Revision$ from
3% wx/tarstrm.h at 28/Oct/06 18:27:02
4%
5
6\section{\class{wxTarClassFactory}}\label{wxtarclassfactory}
7
8Class factory for the tar archive format. See the base class
9for details.
10
11\wxheading{Derived from}
12
13\helpref{wxArchiveClassFactory}{wxarchiveclassfactory}
14
15\wxheading{Include files}
16
17<wx/tarstrm.h>
18
19\wxheading{See also}
20
21\helpref{Archive formats such as zip}{wxarc}\\
22\helpref{Generic archive programming}{wxarcgeneric}\\
23\helpref{wxTarEntry}{wxtarentry}\\
24\helpref{wxTarInputStream}{wxtarinputstream}\\
25\helpref{wxTarOutputStream}{wxtaroutputstream}
26
27
28%
29% automatically generated by HelpGen $Revision$ from
30% wx/tarstrm.h at 28/Oct/06 18:27:02
31%
32
33\section{\class{wxTarEntry}}\label{wxtarentry}
34
35Holds the meta-data for an entry in a tar.
36
37\wxheading{Derived from}
38
39\helpref{wxArchiveEntry}{wxarchiveentry}
40
41\wxheading{Include files}
42
43<wx/tarstrm.h>
44
45\wxheading{Data structures}
46
47Constants for \helpref{Get/SetTypeFlag}{wxtarentrytypeflag}:
48
49\begin{verbatim}
50// TypeFlag values
51enum {
52 wxTAR_REGTYPE = '0', // regular file
53 wxTAR_LNKTYPE = '1', // hard link
54 wxTAR_SYMTYPE = '2', // symbolic link
55 wxTAR_CHRTYPE = '3', // character special
56 wxTAR_BLKTYPE = '4', // block special
57 wxTAR_DIRTYPE = '5', // directory
58 wxTAR_FIFOTYPE = '6', // named pipe
59 wxTAR_CONTTYPE = '7' // contiguous file
60};
61
62\end{verbatim}
63
64\wxheading{See also}
65
66\helpref{Archive formats such as zip}{wxarc}\\
67\helpref{wxTarInputStream}{wxtarinputstream}\\
68\helpref{wxTarOutputStream}{wxtaroutputstream}
69
70\wxheading{Field availability}
71
72The tar format stores all the meta-data for an entry ahead of its data,
73therefore \helpref{GetNextEntry()}{wxtarinputstreamgetnextentry} always returns
74a fully populated wxTarEntry object, both when reading from seekable and
75non-seekable streams.
76
77
78\latexignore{\rtfignore{\wxheading{Members}}}
79
80
81\membersection{wxTarEntry::wxTarEntry}\label{wxtarentrywxtarentry}
82
83\func{}{wxTarEntry}{\param{const wxString\& }{name = wxEmptyString}, \param{const wxDateTime\& }{dt = wxDateTime::Now()}, \param{wxFileOffset }{size = wxInvalidOffset}}
84
85Constructor. The tar archive format stores the entry's size ahead of the
86entry's data. Therefore when creating an archive on a non-seekable stream it
87is necessary to supply the correct size when each entry is created.
88
89\func{}{wxTarEntry}{\param{const wxTarEntry\& }{entry}}
90
91Copy constructor.
92
93
94\membersection{wxTarEntry::Get/SetAccessTime}\label{wxtarentryaccesstime}
95
96\constfunc{wxDateTime}{GetAccessTime}{\void}
97
98\func{void}{SetAccessTime}{\param{const wxDateTime\& }{dt}}
99
100The entry's access time stamp. See also
101 \helpref{wxArchiveEntry::Get/SetDateTime}{wxarchiveentrydatetime}.
102
103
104\membersection{wxTarEntry::Get/SetCreateTime}\label{wxtarentrycreatetime}
105
106\constfunc{wxDateTime}{GetCreateTime}{\void}
107
108\func{void}{SetCreateTime}{\param{const wxDateTime\& }{dt}}
109
110The entry's creation time stamp. See also
111 \helpref{wxArchiveEntry::Get/SetDateTime}{wxarchiveentrydatetime}.
112
113
114\membersection{wxTarEntry::Get/SetDevMajor and Get/SetDevMinor}\label{wxtarentrydev}
115
116\constfunc{int}{GetDevMajor}{\void}
117
118\constfunc{int}{GetDevMinor}{\void}
119
120\func{void}{SetDevMajor}{\param{int }{dev}}
121
122\func{void}{SetDevMinor}{\param{int }{dev}}
123
124OS specific IDs defining a device, these are only meaningful when
125 \helpref{TypeFlag}{wxtarentrytypeflag} is set to {\it wxTAR\_CHRTYPE}
126 or {\it wxTAR\_BLKTYPE}.
127
128
129\membersection{wxTarEntry::Get/SetGroupId and Get/SetUserId}\label{wxtarentryuidgid}
130
131\constfunc{int}{GetGroupId}{\void}
132
133\constfunc{int}{GetUserId}{\void}
134
135\func{void}{SetGroupId}{\param{int }{id}}
136
137\func{void}{SetUserId}{\param{int }{id}}
138
139The user ID and group ID that has \helpref{permissions}{wxtarentrymode} over
140this entry. These values aren't usually useful unless the file will only be
141restored to the same system it originated from. \helpref{Get/SetGroupName and
142Get/SetUserName}{wxtarentryunamegname} can be used instead.
143
144
e9a4b51d 145\membersection{wxTarEntry::Get/SetGroupName and Get/SetUserName}\label{wxtarentryunamegname}
b34c7f3c
MW
146
147\constfunc{wxString}{GetGroupName}{\void}
148
149\constfunc{wxString}{GetUserName}{\void}
150
151\func{void}{SetGroupName}{\param{const wxString\& }{group}}
152
153\func{void}{SetUserName}{\param{const wxString\& }{user}}
154
155The names of the user and group that has \helpref{permissions}{wxtarentrymode}
156over this entry. These are not present in very old tars.
157
158
159\membersection{wxTarEntry::GetInternalName}\label{wxtarentrygetinternalname}
160
161\constfunc{wxString}{GetInternalName}{\void}
162
163Returns the entry's filename in the internal format used within the
164archive. The name can include directory components, i.e. it can be a
165full path.
166
167The names of directory entries are returned without any trailing path
168separator. This gives a canonical name that can be used in comparisons.
169
170\func{wxString}{GetInternalName}{\param{const wxString\& }{name}, \param{wxPathFormat }{format = wxPATH\_NATIVE}, \param{bool* }{pIsDir = NULL}}
171
172A static member that translates a filename into the internal format used
173within the archive. If the third parameter is provided, the bool pointed
174to is set to indicate whether the name looks like a directory name
175(i.e. has a trailing path separator).
176
177
178\membersection{wxTarEntry::Get/SetLinkName}\label{wxtarentrylinkname}
179
180\constfunc{wxString}{GetLinkName}{\void}
181
182\func{void}{SetLinkName}{\param{const wxString\& }{link}}
183
184The filename of a previous entry in the tar that this entry is a link to.
185Only meaningful when \helpref{TypeFlag}{wxtarentrytypeflag} is set
186to {\it wxTAR\_LNKTYPE} or {\it wxTAR\_SYMTYPE}.
187
188
189\membersection{wxTarEntry::Get/SetMode}\label{wxtarentrymode}
190
191\constfunc{int}{GetMode}{\void}
192
193\func{void}{SetMode}{\param{int }{mode}}
194
195UNIX permission bits for this entry. Giving read, write and execute permissions
196to the file's \helpref{User and Group}{wxtarentryunamegname} and to others.
197Symbols are defined for them in <wx/file.h>.
198
199\begin{verbatim}
200#define wxS_IRUSR 00400
201#define wxS_IWUSR 00200
202#define wxS_IXUSR 00100
203
204#define wxS_IRGRP 00040
205#define wxS_IWGRP 00020
206#define wxS_IXGRP 00010
207
208#define wxS_IROTH 00004
209#define wxS_IWOTH 00002
210#define wxS_IXOTH 00001
211
212\end{verbatim}
213
214
215\membersection{wxTarEntry::Get/SetSize}\label{wxtarentrysize}
216
217\func{void}{SetSize}{\param{wxFileOffset }{size}}
218
219\constfunc{wxFileOffset}{GetSize}{\void}
220
221The size of the entry's data in bytes.
222
223The tar archive format stores the entry's size ahead of the entry's data.
224Therefore when creating an archive on a non-seekable stream it is necessary to
225supply the correct size when each entry is created. For seekable streams this
226is not necessary as \helpref{wxTarOutputStream}{wxtaroutputstream} will attempt
227to seek back and fix the entry's header when the entry is closed, though it is
228still more efficient if the size is given beforehand.
229
230
231\membersection{wxTarEntry::Get/SetTypeFlag}\label{wxtarentrytypeflag}
232
233\constfunc{int}{GetTypeFlag}{\void}
234
235\func{void}{SetTypeFlag}{\param{int }{type}}
236
237Returns the type of the entry. It should be one of the following:
238
239\begin{verbatim}
240// TypeFlag values
241enum {
242 wxTAR_REGTYPE = '0', // regular file
243 wxTAR_LNKTYPE = '1', // hard link
244 wxTAR_SYMTYPE = '2', // symbolic link
245 wxTAR_CHRTYPE = '3', // character special
246 wxTAR_BLKTYPE = '4', // block special
247 wxTAR_DIRTYPE = '5', // directory
248 wxTAR_FIFOTYPE = '6', // named pipe
249 wxTAR_CONTTYPE = '7' // contiguous file
250};
251
252\end{verbatim}
253
254When creating archives use just these values. When reading archives
255any other values should be treated as {\it wxTAR\_REGTYPE}.
256
257
258\membersection{wxTarEntry::operator=}\label{wxtarentryoperatorassign}
259
260\func{wxTarEntry\& operator}{operator=}{\param{const wxTarEntry\& }{entry}}
261
262Assignment operator.
263
264
265%
266% automatically generated by HelpGen $Revision$ from
267% wx/tarstrm.h at 28/Oct/06 18:27:02
268%
269
270\section{\class{wxTarInputStream}}\label{wxtarinputstream}
271
272Input stream for reading tar files.
273
274\helpref{GetNextEntry()}{wxtarinputstreamgetnextentry} returns an
275 \helpref{wxTarEntry}{wxtarentry} object containing the meta-data
276for the next entry in the tar (and gives away ownership). Reading from
277the wxTarInputStream then returns the entry's data. Eof() becomes true
278after an attempt has been made to read past the end of the entry's data.
279When there are no more entries, GetNextEntry() returns NULL and sets Eof().
280
281Tar entries are seekable if the parent stream is seekable. In practice this
282usually means they are only seekable if the tar is stored as a local file and
283is not compressed.
284
285\wxheading{Derived from}
286
287\helpref{wxArchiveInputStream}{wxarchiveinputstream}
288
289\wxheading{Include files}
290
291<wx/tarstrm.h>
292
293\wxheading{Data structures}
294\begin{verbatim}
295typedef wxTarEntry entry_type
296\end{verbatim}
297
298\helpref{Archive formats such as zip}{wxarc}\\
299\helpref{wxTarEntry}{wxtarentry}\\
300\helpref{wxTarOutputStream}{wxtaroutputstream}
301
302\latexignore{\rtfignore{\wxheading{Members}}}
303
304
305\membersection{wxTarInputStream::wxTarInputStream}\label{wxtarinputstreamwxtarinputstream}
306
307\func{}{wxTarInputStream}{\param{wxInputStream\& }{stream}, \param{wxMBConv\& }{conv = wxConvLocal}}
308
309\func{}{wxTarInputStream}{\param{wxInputStream* }{stream}, \param{wxMBConv\& }{conv = wxConvLocal}}
310
311Constructor. In a Unicode build the second parameter {\it conv} is
312used to translate fields from the standard tar header into Unicode. It has
313no effect on the stream's data. {\it conv} is only used for the standard
314tar headers, any pax extended headers are always UTF-8 encoded.
315
316If the parent stream is passed as a pointer then the new filter stream
317takes ownership of it. If it is passed by reference then it does not.
318
319
320\membersection{wxTarInputStream::CloseEntry}\label{wxtarinputstreamcloseentry}
321
322\func{bool}{CloseEntry}{\void}
323
324Closes the current entry. On a non-seekable stream reads to the end of
325the current entry first.
326
327
328\membersection{wxTarInputStream::GetNextEntry}\label{wxtarinputstreamgetnextentry}
329
330\func{wxTarEntry*}{GetNextEntry}{\void}
331
332Closes the current entry if one is open, then reads the meta-data for
333the next entry and returns it in a \helpref{wxTarEntry}{wxtarentry}
334object, giving away ownership. The stream is then open and can be read.
335
336
337\membersection{wxTarInputStream::OpenEntry}\label{wxtarinputstreamopenentry}
338
339\func{bool}{OpenEntry}{\param{wxTarEntry\& }{entry}}
340
341Closes the current entry if one is open, then opens the entry specified
342by the {\it entry} object.
343
344{\it entry} should be from the same tar file, and the tar should
345be on a seekable stream.
346
347\wxheading{See also}
348
349\helpref{Looking up an archive entry by name}{wxarcbyname}
350
351
352%
353% automatically generated by HelpGen $Revision$ from
354% wx/tarstrm.h at 28/Oct/06 18:27:02
355%
356
357\section{\class{wxTarOutputStream}}\label{wxtaroutputstream}
358
359Output stream for writing tar files.
360
361\helpref{PutNextEntry()}{wxtaroutputstreamputnextentry} is used to create
362a new entry in the output tar, then the entry's data is written to the
363wxTarOutputStream. Another call to PutNextEntry() closes the current
364entry and begins the next.
365
366\wxheading{Derived from}
367
368\helpref{wxArchiveOutputStream}{wxarchiveoutputstream}
369
370\wxheading{Include files}
371
372<wx/tarstrm.h>
373
374\wxheading{Data structures}
375
376Constants for the {\it format} parameter of the
377 \helpref{constructor}{wxtaroutputstreamwxtaroutputstream}.
378
379\begin{verbatim}
380// Archive Formats (use wxTAR_PAX, it's backward compatible)
381enum wxTarFormat
382{
383 wxTAR_USTAR, // POSIX.1-1990 tar format
384 wxTAR_PAX // POSIX.1-2001 tar format
385};
386
387\end{verbatim}
388
389\wxheading{See also}
390
391\helpref{Archive formats such as zip}{wxarc}\\
392\helpref{wxTarEntry}{wxtarentry}\\
393\helpref{wxTarInputStream}{wxtarinputstream}
394
395
396\latexignore{\rtfignore{\wxheading{Members}}}
397
398
399\membersection{wxTarOutputStream::wxTarOutputStream}\label{wxtaroutputstreamwxtaroutputstream}
400
401\func{}{wxTarOutputStream}{\param{wxOutputStream\& }{stream}, \param{wxTarFormat }{format = wxTAR\_PAX}, \param{wxMBConv\& }{conv = wxConvLocal}}
402
403\func{}{wxTarOutputStream}{\param{wxOutputStream* }{stream}, \param{wxTarFormat }{format = wxTAR\_PAX}, \param{wxMBConv\& }{conv = wxConvLocal}}
404
405If the parent stream is passed as a pointer then the new filter stream
406takes ownership of it. If it is passed by reference then it does not.
407
408In a Unicode build the third parameter {\it conv} is used to translate the
409headers fields into an 8-bit encoding. It has no effect on the stream's data.
410
411When the {\it format} is {\it wxTAR\_PAX}, pax extended headers are generated
412when any header field will not fit the standard tar header block or if it
413uses any non-ascii characters.
414
415Extended headers are stored as extra 'files' within the tar, and will be
416extracted as such by any other tar program that does not understand them.
417The {\it conv} parameter only affect the standard tar headers, the extended
418headers are always UTF-8 encoded.
419
420When the {\it format} is {\it wxTAR\_USTAR}, no extended headers are
421generated, and instead a warning message is logged if any header field
422overflows.
423
424
425\membersection{wxTarOutputStream::\destruct{wxTarOutputStream}}\label{wxtaroutputstreamdtor}
426
427\func{}{\destruct{wxTarOutputStream}}{\void}
428
429The destructor calls \helpref{Close()}{wxtaroutputstreamclose} to finish
430writing the tar if it has not been called already.
431
432
433\membersection{wxTarOutputStream::Close}\label{wxtaroutputstreamclose}
434
435\func{bool}{Close}{\void}
436
437Finishes writing the tar, returning true if successful.
438Called by the destructor if not called explicitly.
439
440
441\membersection{wxTarOutputStream::CloseEntry}\label{wxtaroutputstreamcloseentry}
442
443\func{bool}{CloseEntry}{\void}
444
445Close the current entry. It is called implicitly whenever another new
446entry is created with \helpref{CopyEntry()}{wxtaroutputstreamcopyentry}
447or \helpref{PutNextEntry()}{wxtaroutputstreamputnextentry}, or
448when the tar is closed.
449
450
451\membersection{wxTarOutputStream::CopyArchiveMetaData}\label{wxtaroutputstreamcopyarchivemetadata}
452
453\func{bool}{CopyArchiveMetaData}{\param{wxTarInputStream\& }{s}}
454
455See \helpref{wxArchiveOutputStream::CopyArchiveMetaData}{wxarchiveoutputstreamcopyarchivemetadata}.
456For the tar format this function does nothing.
457
458
459\membersection{wxTarOutputStream::CopyEntry}\label{wxtaroutputstreamcopyentry}
460
461\func{bool}{CopyEntry}{\param{wxTarEntry* }{entry}, \param{wxTarInputStream\& }{inputStream}}
462
463Takes ownership of {\it entry} and uses it to create a new entry
464in the tar. {\it entry} is then opened in {\it inputStream} and its contents
465copied to this stream.
466
467For some other archive formats CopyEntry() is much more efficient than
468transferring the data using Read() and Write() since it will copy them
469without decompressing and recompressing them. For tar however it makes
470no difference.
471
472For tars on seekable streams, {\it entry} must be from the same tar file
473as {\it stream}. For non-seekable streams, {\it entry} must also be the
474last thing read from {\it inputStream}.
475
476
477\membersection{wxTarOutputStream::Get/SetBlockingFactor}\label{wxtaroutputstreamblockingfactor}
478
479\constfunc{int}{GetBlockingFactor}{\void}
480
481\func{void}{SetBlockingFactor}{\param{int }{factor}}
482
483The tar is zero padded to round its size up to {\it BlockingFactor * 512} bytes.
484
485Defaults to 10 for {\it wxTAR\_PAX} and 20 for {\it wxTAR\_USTAR}
486(see the \helpref{constructor}{wxtaroutputstreamwxtaroutputstream}), as
487specified in the POSIX standards.
488
489
490\membersection{wxTarOutputStream::PutNextDirEntry}\label{wxtaroutputstreamputnextdirentry}
491
492\func{bool}{PutNextDirEntry}{\param{const wxString\& }{name}, \param{const wxDateTime\& }{dt = wxDateTime::Now()}}
493
494Create a new directory entry
495(see \helpref{wxArchiveEntry::IsDir()}{wxarchiveentryisdir})
496with the given name and timestamp.
497
498\helpref{PutNextEntry()}{wxtaroutputstreamputnextentry} can
499also be used to create directory entries, by supplying a name with
500a trailing path separator.
501
502
503\membersection{wxTarOutputStream::PutNextEntry}\label{wxtaroutputstreamputnextentry}
504
505\func{bool}{PutNextEntry}{\param{wxTarEntry* }{entry}}
506
507Takes ownership of {\it entry} and uses it to create a new entry
508in the tar.
509
510\func{bool}{PutNextEntry}{\param{const wxString\& }{name}, \param{const wxDateTime\& }{dt = wxDateTime::Now()}, \param{wxFileOffset }{size = wxInvalidOffset}}
511
512Create a new entry with the given name, timestamp and size.
513