// Purpose: topic overview
// Author: wxWidgets team
// RCS-ID: $Id$
-// Licence: wxWindows license
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
/**
@page overview_archive Archive Formats
+@tableofcontents
+
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):
disk files, or non-seekable streams such as pipes and sockets (see
@ref overview_archive_noseek).
-See also wxFileSystem.
-
-@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_archive_create Creating an Archive
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
@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)
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;
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);
}
else
{
- wxLogError(_T("can't handle '%s'"), filename.c_str());
+ wxLogError(wxT("can't handle '%s'"), filename.c_str());
}
}
@endcode
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()