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