// Purpose: topic overview
// Author: wxWidgets team
// RCS-ID: $Id$
-// Licence: wxWindows license
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
-/*!
+/**
-@page overview_arc Archive Formats
+@page overview_archive Archive Formats
The archive classes handle archive formats such as zip, tar, rar and cab.
-Currently wxZip and wxTar classes are included.
+Currently wxZip, wxTar and wxZlib classes are included.
For each archive type, there are the following classes (using zip here as an
example):
@li wxZipEntry: Holds meta-data for an entry (e.g. filename, timestamp, etc.)
There are also abstract wxArchive classes that can be used to write code that
-can handle any of the archive types, see @ref overview_arc_generic.
+can handle any of the archive types, see @ref overview_archive_generic.
Also see wxFileSystem for a higher level interface that can handle archive
files in a generic way.
The classes are designed to handle archives on both seekable streams such as
disk files, or non-seekable streams such as pipes and sockets (see
-@ref overview_arc_noseek).
+@ref overview_archive_noseek).
See also wxFileSystem.
-@li @ref overview_arc_create
-@li @ref overview_arc_extract
-@li @ref overview_arc_modify
-@li @ref overview_arc_byname
-@li @ref overview_arc_generic
-@li @ref overview_arc_noseek
+@li @ref overview_archive_create
+@li @ref overview_archive_extract
+@li @ref overview_archive_modify
+@li @ref overview_archive_byname
+@li @ref overview_archive_generic
+@li @ref overview_archive_noseek
<hr>
-@section overview_arc_create Creating an Archive
+@section overview_archive_create Creating an Archive
Call wxArchiveOutputStream::PutNextEntry() to create each new entry in the
archive, then write the entry's data. Another call to PutNextEntry() closes the
current entry and begins the next. For example:
@code
-wxFFileOutputStream out(_T("test.zip"));
+wxFFileOutputStream out(wxT("test.zip"));
wxZipOutputStream zip(out);
wxTextOutputStream txt(zip);
wxString sep(wxFileName::GetPathSeparator());
-zip.PutNextEntry(_T("entry1.txt"));
-txt << _T("Some text for entry1.txt\n");
+zip.PutNextEntry(wxT("entry1.txt"));
+txt << wxT("Some text for entry1.txt\n");
-zip.PutNextEntry(_T("subdir") + sep + _T("entry2.txt"));
-txt << _T("Some text for subdir/entry2.txt\n");
+zip.PutNextEntry(wxT("subdir") + sep + wxT("entry2.txt"));
+txt << wxT("Some text for subdir/entry2.txt\n");
@endcode
The name of each entry can be a full path, which makes it possible to store
entries in subdirectories.
-@section overview_arc_extract Extracting an Archive
+@section overview_archive_extract Extracting an Archive
wxArchiveInputStream::GetNextEntry() returns a pointer to entry object
containing the meta-data for the next entry in the archive (and gives away
@code
auto_ptr<wxZipEntry> entry;
-wxFFileInputStream in(_T("test.zip"));
+wxFFileInputStream in(wxT("test.zip"));
wxZipInputStream zip(in);
while (entry.reset(zip.GetNextEntry()), entry.get() != NULL)
-@section overview_arc_modify Modifying an Archive
+@section overview_archive_modify Modifying an Archive
To modify an existing archive, write a new copy of the archive to a new file,
making any necessary changes along the way and transferring any unchanged
For example to delete all entries matching the pattern "*.txt":
@code
-auto_ptr<wxFFileInputStream> in(new wxFFileInputStream(_T("test.zip")));
-wxTempFileOutputStream out(_T("test.zip"));
+auto_ptr<wxFFileInputStream> in(new wxFFileInputStream(wxT("test.zip")));
+wxTempFileOutputStream out(wxT("test.zip"));
wxZipInputStream inzip(*in);
wxZipOutputStream outzip(out);
// call CopyEntry for each entry except those matching the pattern
while (entry.reset(inzip.GetNextEntry()), entry.get() != NULL)
- if (!entry->GetName().Matches(_T("*.txt")))
+ if (!entry->GetName().Matches(wxT("*.txt")))
if (!outzip.CopyEntry(entry.release(), inzip))
break;
-@section overview_arc_byname Looking Up an Archive Entry by Name
+@section overview_archive_byname Looking Up an Archive Entry by Name
Also see wxFileSystem for a higher level interface that is more convenient for
accessing archive entries by name.
wxString name = wxZipEntry::GetInternalName(localname);
// open the zip
-wxFFileInputStream in(_T("test.zip"));
+wxFFileInputStream in(wxT("test.zip"));
wxZipInputStream zip(in);
// call GetNextEntry() until the required internal name is found
ZipCatalog cat;
// open the zip
-wxFFileInputStream in(_T("test.zip"));
+wxFFileInputStream in(wxT("test.zip"));
wxZipInputStream zip(in);
// load the zip catalog
@code
// opening another entry without closing the first requires another
// input stream for the same file
-wxFFileInputStream in2(_T("test.zip"));
+wxFFileInputStream in2(wxT("test.zip"));
wxZipInputStream zip2(in2);
if ((it = cat.find(wxZipEntry::GetInternalName(local2))) != cat.end())
zip2.OpenEntry(*it->second);
-@section overview_arc_generic Generic Archive Programming
+@section overview_archive_generic Generic Archive Programming
Also see wxFileSystem for a higher level interface that can handle archive
files in a generic way.
}
else
{
- wxLogError(_T("can't handle '%s'"), filename.c_str());
+ wxLogError(wxT("can't handle '%s'"), filename.c_str());
}
}
@endcode
-@section overview_arc_noseek Archives on Non-Seekable Streams
+@section overview_archive_noseek Archives on Non-Seekable Streams
In general, handling archives on non-seekable streams is done in the same way
as for seekable streams, with a few caveats.
on the order the entries' meta-data is stored within the archive. These are not
too difficult to deal with, and are outlined below.
-@subsection overview_arc_noseek_entrysize PutNextEntry and the Entry Size
+@subsection overview_archive_noseek_entrysize PutNextEntry and the Entry Size
When writing archives, some archive formats store the entry size before the
entry's data (tar has this limitation, zip doesn't). In this case the entry's
it is known, and rely on the error message from the output stream when the
operation is not supported.
-@subsection overview_arc_noseek_weak GetNextEntry and the Weak Reference Mechanism
+@subsection overview_archive_noseek_weak GetNextEntry and the Weak Reference Mechanism
Some archive formats do not store all an entry's meta-data before the entry's
data (zip is an example). In this case, when reading from a non-seekable
The documentation for each archive entry type gives the details of what
meta-data becomes available and when. For generic programming, when the worst
case must be assumed, you can rely on all the fields of wxArchiveEntry being
-fully populated when GetNextEntry() returns, with the the following exceptions:
+fully populated when GetNextEntry() returns, with the following exceptions:
@li wxArchiveEntry::GetSize(): Guaranteed to be available after the entry has
been read to wxInputStream::Eof(), or wxArchiveInputStream::CloseEntry()
within the archive, the input stream will always have read it before the output
stream must write it.
-@subsection overview_arc_noseek_notifier wxArchiveNotifier
+@subsection overview_archive_noseek_notifier wxArchiveNotifier
Notifier objects can be used to get a notification whenever an input stream
updates a wxArchiveEntry object's data via the weak reference mechanism.