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