]> git.saurik.com Git - wxWidgets.git/blob - docs/latex/wx/tarstrm.tex
Limit indentation in style listbox, and also show centring
[wxWidgets.git] / docs / latex / wx / tarstrm.tex
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
8 Class factory for the tar archive format. See the base class
9 for 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
35 Holds 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
47 Constants for \helpref{Get/SetTypeFlag}{wxtarentrytypeflag}:
48
49 \begin{verbatim}
50 // TypeFlag values
51 enum {
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
72 The tar format stores all the meta-data for an entry ahead of its data,
73 therefore \helpref{GetNextEntry()}{wxtarinputstreamgetnextentry} always returns
74 a fully populated wxTarEntry object, both when reading from seekable and
75 non-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
85 Constructor. The tar archive format stores the entry's size ahead of the
86 entry's data. Therefore when creating an archive on a non-seekable stream it
87 is necessary to supply the correct size when each entry is created.
88
89 \func{}{wxTarEntry}{\param{const wxTarEntry\& }{entry}}
90
91 Copy 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
100 The 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
110 The 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
124 OS 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
139 The user ID and group ID that has \helpref{permissions}{wxtarentrymode} over
140 this entry. These values aren't usually useful unless the file will only be
141 restored to the same system it originated from. \helpref{Get/SetGroupName and
142 Get/SetUserName}{wxtarentryunamegname} can be used instead.
143
144
145 \membersection{wxTarEntry::Get/SetGroupName and Get/SetUserName}\label{wxtarentryunamegname}
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
155 The names of the user and group that has \helpref{permissions}{wxtarentrymode}
156 over 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
163 Returns the entry's filename in the internal format used within the
164 archive. The name can include directory components, i.e. it can be a
165 full path.
166
167 The names of directory entries are returned without any trailing path
168 separator. 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
172 A static member that translates a filename into the internal format used
173 within the archive. If the third parameter is provided, the bool pointed
174 to 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
184 The filename of a previous entry in the tar that this entry is a link to.
185 Only meaningful when \helpref{TypeFlag}{wxtarentrytypeflag} is set
186 to {\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
195 UNIX permission bits for this entry. Giving read, write and execute permissions
196 to the file's \helpref{User and Group}{wxtarentryunamegname} and to others.
197 Symbols 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
221 The size of the entry's data in bytes.
222
223 The tar archive format stores the entry's size ahead of the entry's data.
224 Therefore when creating an archive on a non-seekable stream it is necessary to
225 supply the correct size when each entry is created. For seekable streams this
226 is not necessary as \helpref{wxTarOutputStream}{wxtaroutputstream} will attempt
227 to seek back and fix the entry's header when the entry is closed, though it is
228 still 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
237 Returns the type of the entry. It should be one of the following:
238
239 \begin{verbatim}
240 // TypeFlag values
241 enum {
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
254 When creating archives use just these values. When reading archives
255 any 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
262 Assignment 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
272 Input stream for reading tar files.
273
274 \helpref{GetNextEntry()}{wxtarinputstreamgetnextentry} returns an
275 \helpref{wxTarEntry}{wxtarentry} object containing the meta-data
276 for the next entry in the tar (and gives away ownership). Reading from
277 the wxTarInputStream then returns the entry's data. Eof() becomes true
278 after an attempt has been made to read past the end of the entry's data.
279 When there are no more entries, GetNextEntry() returns NULL and sets Eof().
280
281 Tar entries are seekable if the parent stream is seekable. In practice this
282 usually means they are only seekable if the tar is stored as a local file and
283 is 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}
295 typedef 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
311 Constructor. In a Unicode build the second parameter {\it conv} is
312 used to translate fields from the standard tar header into Unicode. It has
313 no effect on the stream's data. {\it conv} is only used for the standard
314 tar headers, any pax extended headers are always UTF-8 encoded.
315
316 If the parent stream is passed as a pointer then the new filter stream
317 takes 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
324 Closes the current entry. On a non-seekable stream reads to the end of
325 the current entry first.
326
327
328 \membersection{wxTarInputStream::GetNextEntry}\label{wxtarinputstreamgetnextentry}
329
330 \func{wxTarEntry*}{GetNextEntry}{\void}
331
332 Closes the current entry if one is open, then reads the meta-data for
333 the next entry and returns it in a \helpref{wxTarEntry}{wxtarentry}
334 object, 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
341 Closes the current entry if one is open, then opens the entry specified
342 by the {\it entry} object.
343
344 {\it entry} should be from the same tar file, and the tar should
345 be 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
359 Output stream for writing tar files.
360
361 \helpref{PutNextEntry()}{wxtaroutputstreamputnextentry} is used to create
362 a new entry in the output tar, then the entry's data is written to the
363 wxTarOutputStream. Another call to PutNextEntry() closes the current
364 entry 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
376 Constants 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)
381 enum 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
405 If the parent stream is passed as a pointer then the new filter stream
406 takes ownership of it. If it is passed by reference then it does not.
407
408 In a Unicode build the third parameter {\it conv} is used to translate the
409 headers fields into an 8-bit encoding. It has no effect on the stream's data.
410
411 When the {\it format} is {\it wxTAR\_PAX}, pax extended headers are generated
412 when any header field will not fit the standard tar header block or if it
413 uses any non-ascii characters.
414
415 Extended headers are stored as extra 'files' within the tar, and will be
416 extracted as such by any other tar program that does not understand them.
417 The {\it conv} parameter only affect the standard tar headers, the extended
418 headers are always UTF-8 encoded.
419
420 When the {\it format} is {\it wxTAR\_USTAR}, no extended headers are
421 generated, and instead a warning message is logged if any header field
422 overflows.
423
424
425 \membersection{wxTarOutputStream::\destruct{wxTarOutputStream}}\label{wxtaroutputstreamdtor}
426
427 \func{}{\destruct{wxTarOutputStream}}{\void}
428
429 The destructor calls \helpref{Close()}{wxtaroutputstreamclose} to finish
430 writing the tar if it has not been called already.
431
432
433 \membersection{wxTarOutputStream::Close}\label{wxtaroutputstreamclose}
434
435 \func{bool}{Close}{\void}
436
437 Finishes writing the tar, returning true if successful.
438 Called by the destructor if not called explicitly.
439
440
441 \membersection{wxTarOutputStream::CloseEntry}\label{wxtaroutputstreamcloseentry}
442
443 \func{bool}{CloseEntry}{\void}
444
445 Close the current entry. It is called implicitly whenever another new
446 entry is created with \helpref{CopyEntry()}{wxtaroutputstreamcopyentry}
447 or \helpref{PutNextEntry()}{wxtaroutputstreamputnextentry}, or
448 when the tar is closed.
449
450
451 \membersection{wxTarOutputStream::CopyArchiveMetaData}\label{wxtaroutputstreamcopyarchivemetadata}
452
453 \func{bool}{CopyArchiveMetaData}{\param{wxTarInputStream\& }{s}}
454
455 See \helpref{wxArchiveOutputStream::CopyArchiveMetaData}{wxarchiveoutputstreamcopyarchivemetadata}.
456 For 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
463 Takes ownership of {\it entry} and uses it to create a new entry
464 in the tar. {\it entry} is then opened in {\it inputStream} and its contents
465 copied to this stream.
466
467 For some other archive formats CopyEntry() is much more efficient than
468 transferring the data using Read() and Write() since it will copy them
469 without decompressing and recompressing them. For tar however it makes
470 no difference.
471
472 For tars on seekable streams, {\it entry} must be from the same tar file
473 as {\it stream}. For non-seekable streams, {\it entry} must also be the
474 last 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
483 The tar is zero padded to round its size up to {\it BlockingFactor * 512} bytes.
484
485 Defaults to 10 for {\it wxTAR\_PAX} and 20 for {\it wxTAR\_USTAR}
486 (see the \helpref{constructor}{wxtaroutputstreamwxtaroutputstream}), as
487 specified 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
494 Create a new directory entry
495 (see \helpref{wxArchiveEntry::IsDir()}{wxarchiveentryisdir})
496 with the given name and timestamp.
497
498 \helpref{PutNextEntry()}{wxtaroutputstreamputnextentry} can
499 also be used to create directory entries, by supplying a name with
500 a trailing path separator.
501
502
503 \membersection{wxTarOutputStream::PutNextEntry}\label{wxtaroutputstreamputnextentry}
504
505 \func{bool}{PutNextEntry}{\param{wxTarEntry* }{entry}}
506
507 Takes ownership of {\it entry} and uses it to create a new entry
508 in the tar.
509
510 \func{bool}{PutNextEntry}{\param{const wxString\& }{name}, \param{const wxDateTime\& }{dt = wxDateTime::Now()}, \param{wxFileOffset }{size = wxInvalidOffset}}
511
512 Create a new entry with the given name, timestamp and size.
513