]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/tarstrm.tex
typo fix
[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
a7af285d
VZ
19\wxheading{Library}
20
21\helpref{wxBase}{librarieslist}
22
b34c7f3c
MW
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
39Holds 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
a7af285d
VZ
49\wxheading{Library}
50
51\helpref{wxBase}{librarieslist}
52
b34c7f3c
MW
53\wxheading{Data structures}
54
55Constants for \helpref{Get/SetTypeFlag}{wxtarentrytypeflag}:
56
57\begin{verbatim}
58// TypeFlag values
59enum {
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
80The tar format stores all the meta-data for an entry ahead of its data,
81therefore \helpref{GetNextEntry()}{wxtarinputstreamgetnextentry} always returns
82a fully populated wxTarEntry object, both when reading from seekable and
83non-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
93Constructor. The tar archive format stores the entry's size ahead of the
94entry's data. Therefore when creating an archive on a non-seekable stream it
95is necessary to supply the correct size when each entry is created.
96
97\func{}{wxTarEntry}{\param{const wxTarEntry\& }{entry}}
98
99Copy 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
108The 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
118The 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
132OS 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
147The user ID and group ID that has \helpref{permissions}{wxtarentrymode} over
148this entry. These values aren't usually useful unless the file will only be
149restored to the same system it originated from. \helpref{Get/SetGroupName and
150Get/SetUserName}{wxtarentryunamegname} can be used instead.
151
152
e9a4b51d 153\membersection{wxTarEntry::Get/SetGroupName and Get/SetUserName}\label{wxtarentryunamegname}
b34c7f3c
MW
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
163The names of the user and group that has \helpref{permissions}{wxtarentrymode}
164over 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
171Returns the entry's filename in the internal format used within the
172archive. The name can include directory components, i.e. it can be a
173full path.
174
175The names of directory entries are returned without any trailing path
176separator. 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
180A static member that translates a filename into the internal format used
181within the archive. If the third parameter is provided, the bool pointed
182to 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
192The filename of a previous entry in the tar that this entry is a link to.
193Only meaningful when \helpref{TypeFlag}{wxtarentrytypeflag} is set
194to {\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
203UNIX permission bits for this entry. Giving read, write and execute permissions
204to the file's \helpref{User and Group}{wxtarentryunamegname} and to others.
205Symbols 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
229The size of the entry's data in bytes.
230
231The tar archive format stores the entry's size ahead of the entry's data.
232Therefore when creating an archive on a non-seekable stream it is necessary to
233supply the correct size when each entry is created. For seekable streams this
234is not necessary as \helpref{wxTarOutputStream}{wxtaroutputstream} will attempt
235to seek back and fix the entry's header when the entry is closed, though it is
236still 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
245Returns the type of the entry. It should be one of the following:
246
247\begin{verbatim}
248// TypeFlag values
249enum {
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
262When creating archives use just these values. When reading archives
263any 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
270Assignment 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
280Input stream for reading tar files.
281
282\helpref{GetNextEntry()}{wxtarinputstreamgetnextentry} returns an
283 \helpref{wxTarEntry}{wxtarentry} object containing the meta-data
284for the next entry in the tar (and gives away ownership). Reading from
285the wxTarInputStream then returns the entry's data. Eof() becomes true
286after an attempt has been made to read past the end of the entry's data.
287When there are no more entries, GetNextEntry() returns NULL and sets Eof().
288
289Tar entries are seekable if the parent stream is seekable. In practice this
290usually means they are only seekable if the tar is stored as a local file and
291is not compressed.
292
293\wxheading{Derived from}
294
295\helpref{wxArchiveInputStream}{wxarchiveinputstream}
296
297\wxheading{Include files}
298
299<wx/tarstrm.h>
300
a7af285d
VZ
301\wxheading{Library}
302
303\helpref{wxBase}{librarieslist}
304
b34c7f3c
MW
305\wxheading{Data structures}
306\begin{verbatim}
307typedef 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
323Constructor. In a Unicode build the second parameter {\it conv} is
324used to translate fields from the standard tar header into Unicode. It has
325no effect on the stream's data. {\it conv} is only used for the standard
326tar headers, any pax extended headers are always UTF-8 encoded.
327
328If the parent stream is passed as a pointer then the new filter stream
329takes 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
336Closes the current entry. On a non-seekable stream reads to the end of
337the current entry first.
338
339
340\membersection{wxTarInputStream::GetNextEntry}\label{wxtarinputstreamgetnextentry}
341
342\func{wxTarEntry*}{GetNextEntry}{\void}
343
344Closes the current entry if one is open, then reads the meta-data for
345the next entry and returns it in a \helpref{wxTarEntry}{wxtarentry}
346object, 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
353Closes the current entry if one is open, then opens the entry specified
354by the {\it entry} object.
355
356{\it entry} should be from the same tar file, and the tar should
357be 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
371Output stream for writing tar files.
372
373\helpref{PutNextEntry()}{wxtaroutputstreamputnextentry} is used to create
374a new entry in the output tar, then the entry's data is written to the
375wxTarOutputStream. Another call to PutNextEntry() closes the current
376entry 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
a7af285d
VZ
386\wxheading{Library}
387
388\helpref{wxBase}{librarieslist}
389
b34c7f3c
MW
390\wxheading{Data structures}
391
392Constants 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)
397enum 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
421If the parent stream is passed as a pointer then the new filter stream
422takes ownership of it. If it is passed by reference then it does not.
423
424In a Unicode build the third parameter {\it conv} is used to translate the
425headers fields into an 8-bit encoding. It has no effect on the stream's data.
426
427When the {\it format} is {\it wxTAR\_PAX}, pax extended headers are generated
428when any header field will not fit the standard tar header block or if it
429uses any non-ascii characters.
430
431Extended headers are stored as extra 'files' within the tar, and will be
432extracted as such by any other tar program that does not understand them.
433The {\it conv} parameter only affect the standard tar headers, the extended
434headers are always UTF-8 encoded.
435
436When the {\it format} is {\it wxTAR\_USTAR}, no extended headers are
437generated, and instead a warning message is logged if any header field
438overflows.
439
440
441\membersection{wxTarOutputStream::\destruct{wxTarOutputStream}}\label{wxtaroutputstreamdtor}
442
443\func{}{\destruct{wxTarOutputStream}}{\void}
444
445The destructor calls \helpref{Close()}{wxtaroutputstreamclose} to finish
446writing the tar if it has not been called already.
447
448
449\membersection{wxTarOutputStream::Close}\label{wxtaroutputstreamclose}
450
451\func{bool}{Close}{\void}
452
453Finishes writing the tar, returning true if successful.
454Called by the destructor if not called explicitly.
455
456
457\membersection{wxTarOutputStream::CloseEntry}\label{wxtaroutputstreamcloseentry}
458
459\func{bool}{CloseEntry}{\void}
460
461Close the current entry. It is called implicitly whenever another new
462entry is created with \helpref{CopyEntry()}{wxtaroutputstreamcopyentry}
463or \helpref{PutNextEntry()}{wxtaroutputstreamputnextentry}, or
464when the tar is closed.
465
466
467\membersection{wxTarOutputStream::CopyArchiveMetaData}\label{wxtaroutputstreamcopyarchivemetadata}
468
469\func{bool}{CopyArchiveMetaData}{\param{wxTarInputStream\& }{s}}
470
471See \helpref{wxArchiveOutputStream::CopyArchiveMetaData}{wxarchiveoutputstreamcopyarchivemetadata}.
472For 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
479Takes ownership of {\it entry} and uses it to create a new entry
480in the tar. {\it entry} is then opened in {\it inputStream} and its contents
481copied to this stream.
482
483For some other archive formats CopyEntry() is much more efficient than
484transferring the data using Read() and Write() since it will copy them
485without decompressing and recompressing them. For tar however it makes
486no difference.
487
488For tars on seekable streams, {\it entry} must be from the same tar file
489as {\it stream}. For non-seekable streams, {\it entry} must also be the
490last 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
499The tar is zero padded to round its size up to {\it BlockingFactor * 512} bytes.
500
501Defaults to 10 for {\it wxTAR\_PAX} and 20 for {\it wxTAR\_USTAR}
502(see the \helpref{constructor}{wxtaroutputstreamwxtaroutputstream}), as
503specified 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
510Create a new directory entry
511(see \helpref{wxArchiveEntry::IsDir()}{wxarchiveentryisdir})
512with the given name and timestamp.
513
514\helpref{PutNextEntry()}{wxtaroutputstreamputnextentry} can
515also be used to create directory entries, by supplying a name with
516a trailing path separator.
517
518
519\membersection{wxTarOutputStream::PutNextEntry}\label{wxtaroutputstreamputnextentry}
520
521\func{bool}{PutNextEntry}{\param{wxTarEntry* }{entry}}
522
523Takes ownership of {\it entry} and uses it to create a new entry
524in the tar.
525
526\func{bool}{PutNextEntry}{\param{const wxString\& }{name}, \param{const wxDateTime\& }{dt = wxDateTime::Now()}, \param{wxFileOffset }{size = wxInvalidOffset}}
527
528Create a new entry with the given name, timestamp and size.
529