added ZIP classes by M.J.Wetherell (patch 1030239)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@30436 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -217,6 +217,7 @@ OTHER CHANGES
|
||||
|
||||
All:
|
||||
|
||||
- new classes for reading and writing ZIP files (M.J.Wetherell)
|
||||
- Norwegian (Bokm<6B>l) translation added (Hans F. Nordhaug)
|
||||
- wxDynamicLibrary::HasSymbol() added
|
||||
- added wxTextInputStream::operator>>(wchar_t) for compilers which support this
|
||||
|
433
docs/latex/wx/arc.tex
Normal file
433
docs/latex/wx/arc.tex
Normal file
@@ -0,0 +1,433 @@
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%% Name: arc.tex
|
||||
%% Purpose: Overview of the archive classes
|
||||
%% Author: M.J.Wetherell
|
||||
%% RCS-ID: $Id$
|
||||
%% Copyright: 2004 M.J.Wetherell
|
||||
%% License: wxWidgets license
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
\section{Archive formats such as zip}\label{wxarc}
|
||||
|
||||
The archive classes handle archive formats such as zip, tar, rar and cab.
|
||||
Currently only the wxZip classes are included.
|
||||
|
||||
For each archive type, there are the following classes (using zip here
|
||||
as an example):
|
||||
|
||||
\begin{twocollist}\twocolwidtha{4cm}
|
||||
\twocolitem{\helpref{wxZipInputStream}{wxzipinputstream}}{Input stream}
|
||||
\twocolitem{\helpref{wxZipOutputStream}{wxzipoutputstream}}{Output stream}
|
||||
\twocolitem{\helpref{wxZipEntry}{wxzipentry}}{Holds the meta-data for an
|
||||
entry (e.g. filename, timestamp, etc.)}
|
||||
\end{twocollist}
|
||||
|
||||
There are also abstract wxArchive classes that can be used to write code
|
||||
that can handle any of the archive types,
|
||||
see '\helpref{Generic archive programming}{wxarcgeneric}'.
|
||||
Also see \helpref{wxFileSystem}{fs} 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 '\helpref{Archives on non-seekable streams}{wxarcnoseek}').
|
||||
|
||||
\wxheading{See also}
|
||||
|
||||
\helpref{wxFileSystem}{fs}
|
||||
|
||||
|
||||
\subsection{Creating an archive}\label{wxarccreate}
|
||||
|
||||
\helpref{Archive formats such as zip}{wxarc}
|
||||
|
||||
Call \helpref{PutNextEntry()}{wxarchiveoutputstreamputnextentry} 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:
|
||||
|
||||
\begin{verbatim}
|
||||
wxFFileOutputStream out(_T("test.zip"));
|
||||
wxZipOutputStream zip(out);
|
||||
wxTextOutputStream txt(zip);
|
||||
|
||||
zip.PutNextEntry(_T("entry1.txt"));
|
||||
txt << _T("Some text for entry1\n");
|
||||
|
||||
zip.PutNextEntry(_T("entry2.txt"));
|
||||
txt << _T("Some text for entry2\n");
|
||||
|
||||
\end{verbatim}
|
||||
|
||||
|
||||
\subsection{Extracting an archive}\label{wxarcextract}
|
||||
|
||||
\helpref{Archive formats such as zip}{wxarc}
|
||||
|
||||
\helpref{GetNextEntry()}{wxarchiveinputstreamgetnextentry} returns an
|
||||
entry object containing the meta-data for the next entry in the archive
|
||||
(and gives away ownership). Reading from the input stream then returns
|
||||
the entry's data. Eof() becomes true after an attempt has been made to
|
||||
read past the end of the entry's data.
|
||||
|
||||
When there are no more entries, GetNextEntry() returns NULL and sets Eof().
|
||||
|
||||
\begin{verbatim}
|
||||
wxDEFINE_SCOPED_PTR_TYPE(wxZipEntry);
|
||||
wxZipEntryPtr entry;
|
||||
|
||||
wxFFileInputStream in(_T("test.zip"));
|
||||
wxZipInputStream zip(in);
|
||||
wxTextInputStream txt(zip);
|
||||
wxString data;
|
||||
|
||||
while (entry.reset(zip.GetNextEntry()), entry.get() != NULL)
|
||||
{
|
||||
wxString name = entry->GetName(); // access meta-data
|
||||
txt >> data; // access data
|
||||
}
|
||||
|
||||
\end{verbatim}
|
||||
|
||||
|
||||
\subsection{Modifying an archive}\label{wxarcmodify}
|
||||
|
||||
\helpref{Archive formats such as zip}{wxarc}
|
||||
|
||||
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
|
||||
entries using \helpref{CopyEntry()}{wxarchiveoutputstreamcopyentry}.
|
||||
For archive types which compress entry data, CopyEntry() is likely to be
|
||||
much more efficient than transferring the data using Read() and Write()
|
||||
since it will copy them without decompressing and recompressing them.
|
||||
|
||||
In general modifications are not possible without rewriting the archive,
|
||||
though it may be possible in some limited cases. Even then, rewriting
|
||||
the archive is usually a better choice since a failure can be handled
|
||||
without losing the whole archive.
|
||||
|
||||
For example to delete all entries matching the pattern "*.txt":
|
||||
|
||||
\begin{verbatim}
|
||||
wxFFileInputStream in(_T("in.zip"));
|
||||
wxFFileOutputStream out(_T("out.zip"));
|
||||
|
||||
wxZipInputStream inzip(in);
|
||||
wxZipOutputStream outzip(out);
|
||||
wxZipEntryPtr entry;
|
||||
|
||||
// transfer any meta-data for the archive as a whole (the zip comment
|
||||
// in the case of zip)
|
||||
outzip.CopyArchiveMetaData(inzip);
|
||||
|
||||
// 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 (!outzip.CopyEntry(entry.release(), inzip))
|
||||
break;
|
||||
|
||||
bool success = inzip.Eof() && outzip.Close();
|
||||
|
||||
\end{verbatim}
|
||||
|
||||
|
||||
\subsection{Looking up an archive entry by name}\label{wxarcbyname}
|
||||
|
||||
\helpref{Archive formats such as zip}{wxarc}
|
||||
|
||||
Also see \helpref{wxFileSystem}{fs} for a higher level interface that is
|
||||
more convenient for accessing archive entries by name.
|
||||
|
||||
To open just one entry in an archive, the most efficient way is
|
||||
to simply search for it linearly by calling
|
||||
\helpref{GetNextEntry()}{wxarchiveinputstreamgetnextentry} until the
|
||||
required entry is found. This works both for archives on seekable and
|
||||
non-seekable streams.
|
||||
|
||||
The format of filenames in the archive is likely to be different
|
||||
from the local filename format. For example zips and tars use
|
||||
unix style names, with forward slashes as the path separator,
|
||||
and absolute paths are not allowed. So if on Windows the file
|
||||
"C:$\backslash$MYDIR$\backslash$MYFILE.TXT" is stored, then when reading
|
||||
the entry back \helpref{GetName()}{wxarchiveentryname} will return
|
||||
"MYDIR$\backslash$MYFILE.TXT". The conversion into the internal format
|
||||
and back has lost some information.
|
||||
|
||||
So to avoid ambiguity when searching for an entry matching a local name,
|
||||
it is better to convert the local name to the archive's internal format
|
||||
and search for that:
|
||||
|
||||
\begin{verbatim}
|
||||
wxDEFINE_SCOPED_PTR_TYPE(wxZipEntry);
|
||||
wxZipEntryPtr entry;
|
||||
|
||||
// convert the local name we are looking for into the internal format
|
||||
wxString name = wxZipEntry::GetInternalName(localname);
|
||||
|
||||
// open the zip
|
||||
wxFFileInputStream in(_T("test.zip"));
|
||||
wxZipInputStream zip(in);
|
||||
|
||||
// call GetNextEntry() until the required internal name is found
|
||||
do {
|
||||
entry.reset(zip.GetNextEntry());
|
||||
}
|
||||
while (entry.get() != NULL && entry->GetInternalName() != name);
|
||||
|
||||
if (entry.get() != NULL) {
|
||||
// read the entry's data...
|
||||
}
|
||||
|
||||
\end{verbatim}
|
||||
|
||||
To access several entries randomly, it is most efficient to transfer the
|
||||
entire catalogue of entries to a container such as a std::map or a
|
||||
\helpref{wxHashMap}{wxhashmap} then entries looked up by name can be
|
||||
opened using the \helpref{OpenEntry()}{wxarchiveinputstreamopenentry} method.
|
||||
|
||||
\begin{verbatim}
|
||||
WX_DECLARE_STRING_HASH_MAP(wxZipEntry*, ZipCatalog);
|
||||
ZipCatalog::iterator it;
|
||||
wxZipEntry *entry;
|
||||
ZipCatalog cat;
|
||||
|
||||
// open the zip
|
||||
wxFFileInputStream in(_T("test.zip"));
|
||||
wxZipInputStream zip(in);
|
||||
|
||||
// load the zip catalog
|
||||
while ((entry = zip.GetNextEntry()) != NULL) {
|
||||
wxZipEntry*& current = cat[entry->GetInternalName()];
|
||||
// some archive formats can have multiple entries with the same name
|
||||
// (e.g. tar) though it is an error in the case of zip
|
||||
delete current;
|
||||
current = entry;
|
||||
}
|
||||
|
||||
// open an entry by name
|
||||
if ((it = cat.find(wxZipEntry::GetInternalName(localname))) != cat.end()) {
|
||||
zip.OpenEntry(*it->second);
|
||||
// ... now read entry's data
|
||||
}
|
||||
|
||||
\end{verbatim}
|
||||
|
||||
To open more than one entry simultaneously you need more than one
|
||||
underlying stream on the same archive:
|
||||
|
||||
\begin{verbatim}
|
||||
// opening another entry without closing the first requires another
|
||||
// input stream for the same file
|
||||
wxFFileInputStream in2(_T("test.zip"));
|
||||
wxZipInputStream zip2(in2);
|
||||
if ((it = cat.find(wxZipEntry::GetInternalName(local2))) != cat.end())
|
||||
zip2.OpenEntry(*it->second);
|
||||
|
||||
\end{verbatim}
|
||||
|
||||
|
||||
\subsection{Generic archive programming}\label{wxarcgeneric}
|
||||
|
||||
\helpref{Archive formats such as zip}{wxarc}
|
||||
|
||||
Also see \helpref{wxFileSystem}{fs} for a higher level interface that
|
||||
can handle archive files in a generic way.
|
||||
|
||||
The specific archive classes, such as the wxZip classes, inherit from
|
||||
the following abstract classes which can be used to write code that can
|
||||
handle any of the archive types:
|
||||
|
||||
\begin{twocollist}\twocolwidtha{5cm}
|
||||
\twocolitem{\helpref{wxArchiveInputStream}{wxarchiveinputstream}}{Input stream}
|
||||
\twocolitem{\helpref{wxArchiveOutputStream}{wxarchiveoutputstream}}{Output stream}
|
||||
\twocolitem{\helpref{wxArchiveEntry}{wxarchiveentry}}{Holds the meta-data for an
|
||||
entry (e.g. filename)}
|
||||
\end{twocollist}
|
||||
|
||||
In order to able to write generic code it's necessary to be able to create
|
||||
instances of the classes without knowing which archive type is being used.
|
||||
So there is a class factory for each archive type, derived from
|
||||
\helpref{wxArchiveClassFactory}{wxarchiveclassfactory}, which can create
|
||||
the other classes.
|
||||
|
||||
For example, given {\it wxArchiveClassFactory* factory}:
|
||||
|
||||
\begin{verbatim}
|
||||
// create streams without knowing their type
|
||||
wxArchiveInputStreamPtr inarc(factory->NewStream(in));
|
||||
wxArchiveOutputStreamPtr outarc(factory->NewStream(out));
|
||||
|
||||
// create an empty entry object
|
||||
wxArchiveEntryPtr entry(factory->NewEntry());
|
||||
|
||||
\end{verbatim}
|
||||
|
||||
The class factory itself can either be created explicitly:
|
||||
|
||||
\begin{verbatim}
|
||||
wxArchiveClassFactory *factory = new wxZipClassFactory;
|
||||
|
||||
\end{verbatim}
|
||||
|
||||
or using wxWidgets' \helpref{RTTI}{runtimeclassoverview}:
|
||||
|
||||
\begin{verbatim}
|
||||
wxArchiveClassFactory *MakeFactory(const wxString& type)
|
||||
{
|
||||
wxString name = _T("wx") + type.Left(1).Upper() +
|
||||
type.Mid(1).Lower() + _T("ClassFactory");
|
||||
|
||||
wxObject *pObj = wxCreateDynamicObject(name);
|
||||
wxArchiveClassFactory *pcf = wxDynamicCast(pObj, wxArchiveClassFactory);
|
||||
|
||||
if (!pcf) {
|
||||
wxLogError(_T("can't handle '%s' archives"), type.c_str());
|
||||
delete pObj;
|
||||
}
|
||||
|
||||
return pcf;
|
||||
}
|
||||
|
||||
\end{verbatim}
|
||||
|
||||
|
||||
\subsection{Archives on non-seekable streams}\label{wxarcnoseek}
|
||||
|
||||
\helpref{Archive formats such as zip}{wxarc}
|
||||
|
||||
In general, handling archives on non-seekable streams is done in the same
|
||||
way as for seekable streams, with a few caveats.
|
||||
|
||||
The main limitation is that accessing entries randomly using
|
||||
\helpref{OpenEntry()}{wxarchiveinputstreamopenentry}
|
||||
is not possible, the entries can only be accessed sequentially in the order
|
||||
they are stored within the archive.
|
||||
|
||||
For each archive type, there will also be other limitations which will
|
||||
depend on the order the entries' meta-data is stored within the archive.
|
||||
These are not too difficult to deal with, and are outlined below.
|
||||
|
||||
\wxheading{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 size must be passed to
|
||||
\helpref{PutNextEntry()}{wxarchiveoutputstreamputnextentry} or an error
|
||||
occurs.
|
||||
|
||||
This is only an issue on non-seekable streams, since otherwise the archive
|
||||
output stream can seek back and fix up the header once the size of the
|
||||
entry is known.
|
||||
|
||||
For generic programming, one way to handle this is to supply the size
|
||||
whenever it is known, and rely on the error message from the output
|
||||
stream when the operation is not supported.
|
||||
|
||||
\wxheading{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 stream, \helpref{GetNextEntry()}{wxarchiveinputstreamgetnextentry}
|
||||
can only return a partially populated \helpref{wxArchiveEntry}{wxarchiveentry}
|
||||
object - not all the fields are set.
|
||||
|
||||
The input stream then keeps a weak reference to the entry object and
|
||||
updates it when more meta-data becomes available. A weak reference being
|
||||
one that does not prevent you from deleting the wxArchiveEntry object - the
|
||||
input stream only attempts to update it if it is still around.
|
||||
|
||||
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:
|
||||
|
||||
\begin{twocollist}\twocolwidtha{3cm}
|
||||
\twocolitem{\helpref{GetSize()}{wxarchiveentrysize}}{Guaranteed to be
|
||||
available after the entry has been read to \helpref{Eof()}{wxinputstreameof},
|
||||
or \helpref{CloseEntry()}{wxarchiveinputstreamcloseentry} has been called}
|
||||
\twocolitem{\helpref{IsReadOnly()}{wxarchiveentryisreadonly}}{Guaranteed to
|
||||
be available after the end of the archive has been reached, i.e. after
|
||||
GetNextEntry() returns NULL and Eof() is true}
|
||||
\end{twocollist}
|
||||
|
||||
This mechanism allows \helpref{CopyEntry()}{wxarchiveoutputstreamcopyentry}
|
||||
to always fully preserve entries' meta-data. No matter what order order
|
||||
the meta-data occurs within the archive, the input stream will always
|
||||
have read it before the output stream must write it.
|
||||
|
||||
\wxheading{wxArchiveNotifier}
|
||||
|
||||
Notifier objects can be used to get a notification whenever an input
|
||||
stream updates a \helpref{wxArchiveEntry}{wxarchiveentry} object's data
|
||||
via the weak reference mechanism.
|
||||
|
||||
Consider the following code which renames an entry in an archive.
|
||||
This is the usual way to modify an entry's meta-data, simply set the
|
||||
required field before writing it with
|
||||
\helpref{CopyEntry()}{wxarchiveoutputstreamcopyentry}:
|
||||
|
||||
\begin{verbatim}
|
||||
wxArchiveInputStreamPtr arc(factory->NewStream(in));
|
||||
wxArchiveOutputStreamPtr outarc(factory->NewStream(out));
|
||||
wxArchiveEntryPtr entry;
|
||||
|
||||
outarc->CopyArchiveMetaData(*arc);
|
||||
|
||||
while (entry.reset(arc->GetNextEntry()), entry.get() != NULL) {
|
||||
if (entry->GetName() == from)
|
||||
entry->SetName(to);
|
||||
if (!outarc->CopyEntry(entry.release(), *arc))
|
||||
break;
|
||||
}
|
||||
|
||||
bool success = arc->Eof() && outarc->Close();
|
||||
|
||||
\end{verbatim}
|
||||
|
||||
However, for non-seekable streams, this technique cannot be used for
|
||||
fields such as \helpref{IsReadOnly()}{wxarchiveentryisreadonly},
|
||||
which are not necessarily set when
|
||||
\helpref{GetNextEntry()}{wxarchiveinputstreamgetnextentry} returns. In
|
||||
this case a \helpref{wxArchiveNotifier}{wxarchivenotifier} can be used:
|
||||
|
||||
\begin{verbatim}
|
||||
class MyNotifier : public wxArchiveNotifier
|
||||
{
|
||||
public:
|
||||
void OnEntryUpdated(wxArchiveEntry& entry) { entry.SetIsReadOnly(false); }
|
||||
};
|
||||
|
||||
\end{verbatim}
|
||||
|
||||
The meta-data changes are done in your notifier's
|
||||
\helpref{OnEntryUpdated()}{wxarchivenotifieronentryupdated} method,
|
||||
then \helpref{SetNotifier()}{wxarchiveentrynotifier} is called before
|
||||
CopyEntry():
|
||||
|
||||
\begin{verbatim}
|
||||
wxArchiveInputStreamPtr arc(factory->NewStream(in));
|
||||
wxArchiveOutputStreamPtr outarc(factory->NewStream(out));
|
||||
wxArchiveEntryPtr entry;
|
||||
MyNotifier notifier;
|
||||
|
||||
outarc->CopyArchiveMetaData(*arc);
|
||||
|
||||
while (entry.reset(arc->GetNextEntry()), entry.get() != NULL) {
|
||||
entry->SetNotifier(notifier);
|
||||
if (!outarc->CopyEntry(entry.release(), *arc))
|
||||
break;
|
||||
}
|
||||
|
||||
bool success = arc->Eof() && outarc->Close();
|
||||
|
||||
\end{verbatim}
|
||||
|
||||
SetNotifier() calls OnEntryUpdated() immediately, then the input
|
||||
stream calls it again whenever it sets more fields in the entry. Since
|
||||
OnEntryUpdated() will be called at least once, this technique always
|
||||
works even when it is not strictly necessary to use it. For example,
|
||||
changing the entry name can be done this way too and it works on seekable
|
||||
streams as well as non-seekable.
|
||||
|
648
docs/latex/wx/archive.tex
Normal file
648
docs/latex/wx/archive.tex
Normal file
@@ -0,0 +1,648 @@
|
||||
%
|
||||
% automatically generated by HelpGen $Revision$ from
|
||||
% wx/archive.h at 16/Sep/04 12:19:29
|
||||
%
|
||||
|
||||
\section{\class{wxArchiveClassFactory}}\label{wxarchiveclassfactory}
|
||||
|
||||
An abstract base class which serves as a common interface to
|
||||
archive class factories such as \helpref{wxZipClassFactory}{wxzipclassfactory}.
|
||||
|
||||
For each supported archive type (such as zip) there is a class factory
|
||||
derived from wxArchiveClassFactory, which allows archive objects to be
|
||||
created in a generic way, without knowing the particular type of archive
|
||||
being used.
|
||||
|
||||
\wxheading{Derived from}
|
||||
|
||||
\helpref{wxObject}{wxobject}
|
||||
|
||||
\wxheading{Include files}
|
||||
|
||||
<wx/archive.h>
|
||||
|
||||
\wxheading{See also}
|
||||
|
||||
\helpref{Archive formats such as zip}{wxarc}\\
|
||||
\helpref{Generic archive programming}{wxarcgeneric}\\
|
||||
\helpref{wxArchiveEntry}{wxarchiveentry}\\
|
||||
\helpref{wxArchiveInputStream}{wxarchiveinputstream}\\
|
||||
\helpref{wxArchiveOutputStream}{wxarchiveoutputstream}
|
||||
|
||||
\latexignore{\rtfignore{\wxheading{Members}}}
|
||||
|
||||
|
||||
\membersection{wxArchiveClassFactory::Get/SetConv}\label{wxarchiveclassfactoryconv}
|
||||
|
||||
\constfunc{wxMBConv\&}{GetConv}{\void}
|
||||
|
||||
\func{void}{SetConv}{\param{wxMBConv\& }{conv}}
|
||||
|
||||
The \helpref{wxMBConv}{wxmbconv} object that the created streams
|
||||
will use when translating meta-data. The initial default, set by the
|
||||
constructor, is wxConvLocal.
|
||||
|
||||
|
||||
\membersection{wxArchiveClassFactory::GetInternalName}\label{wxarchiveclassfactorygetinternalname}
|
||||
|
||||
\constfunc{wxString}{GetInternalName}{\param{const wxString\& }{name}, \param{wxPathFormat }{format = wxPATH\_NATIVE}}
|
||||
|
||||
Calls the static GetInternalName() function for the archive entry type,
|
||||
for example
|
||||
\helpref{wxZipEntry::GetInternalName()}{wxzipentrygetinternalname}.
|
||||
|
||||
|
||||
\membersection{wxArchiveClassFactory::NewEntry}\label{wxarchiveclassfactorynewentry}
|
||||
|
||||
\constfunc{wxArchiveEntry*}{NewEntry}{\void}
|
||||
|
||||
Create a new \helpref{wxArchiveEntry}{wxarchiveentry} object of the
|
||||
appropriate type.
|
||||
|
||||
|
||||
\membersection{wxArchiveClassFactory::NewStream}\label{wxarchiveclassfactorynewstream}
|
||||
|
||||
\constfunc{wxArchiveInputStream*}{NewStream}{\param{wxInputStream\& }{stream}}
|
||||
|
||||
\constfunc{wxArchiveOutputStream*}{NewStream}{\param{wxOutputStream\& }{stream}}
|
||||
|
||||
Create a new \helpref{wxArchiveInputStream}{wxarchiveinputstream}
|
||||
or \helpref{wxArchiveOutputStream}{wxarchiveoutputstream} of the
|
||||
appropriate type.
|
||||
|
||||
|
||||
%
|
||||
% automatically generated by HelpGen $Revision$ from
|
||||
% wx/archive.h at 16/Sep/04 12:19:29
|
||||
%
|
||||
|
||||
\section{\class{wxArchiveEntry}}\label{wxarchiveentry}
|
||||
|
||||
An abstract base class which serves as a common interface to
|
||||
archive entry classes such as \helpref{wxZipEntry}{wxzipentry}.
|
||||
These hold the meta-data (filename, timestamp, etc.), for entries
|
||||
in archive files such as zips and tars.
|
||||
|
||||
\wxheading{Derived from}
|
||||
|
||||
\helpref{wxObject}{wxobject}
|
||||
|
||||
\wxheading{Include files}
|
||||
|
||||
<wx/archive.h>
|
||||
|
||||
\wxheading{See also}
|
||||
|
||||
\helpref{Archive formats such as zip}{wxarc}\\
|
||||
\helpref{Generic archive programming}{wxarcgeneric}\\
|
||||
\helpref{wxArchiveInputStream}{wxarchiveinputstream}\\
|
||||
\helpref{wxArchiveOutputStream}{wxarchiveoutputstream}\\
|
||||
\helpref{wxArchiveNotifier}{wxarchivenotifier}
|
||||
|
||||
\wxheading{Non-seekable streams}
|
||||
|
||||
This information applies only when reading archives from non-seekable
|
||||
streams. When the stream is
|
||||
seekable \helpref{GetNextEntry()}{wxarchiveinputstreamgetnextentry}
|
||||
returns a fully populated \helpref{wxArchiveEntry}{wxarchiveentry}.
|
||||
See '\helpref{Archives on non-seekable streams}{wxarcnoseek}' for
|
||||
more information.
|
||||
|
||||
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:
|
||||
|
||||
\begin{twocollist}\twocolwidtha{3cm}
|
||||
\twocolitem{\helpref{GetSize()}{wxarchiveentrysize}}{Guaranteed to be
|
||||
available after the entry has been read to \helpref{Eof()}{wxinputstreameof},
|
||||
or \helpref{CloseEntry()}{wxarchiveinputstreamcloseentry} has been called}
|
||||
\twocolitem{\helpref{IsReadOnly()}{wxarchiveentryisreadonly}}{Guaranteed to
|
||||
be available after the end of the archive has been reached, i.e. after
|
||||
GetNextEntry() returns NULL and Eof() is true}
|
||||
\end{twocollist}
|
||||
|
||||
|
||||
\latexignore{\rtfignore{\wxheading{Members}}}
|
||||
|
||||
|
||||
\membersection{wxArchiveEntry::Clone}\label{wxarchiveentryclone}
|
||||
|
||||
\constfunc{wxArchiveEntry*}{Clone}{\void}
|
||||
|
||||
Returns a copy of this entry object.
|
||||
|
||||
|
||||
\membersection{wxArchiveEntry::Get/SetDateTime}\label{wxarchiveentrydatetime}
|
||||
|
||||
\constfunc{wxDateTime}{GetDateTime}{\void}
|
||||
|
||||
\func{void}{SetDateTime}{\param{const wxDateTime\& }{dt}}
|
||||
|
||||
The entry's timestamp.
|
||||
|
||||
|
||||
\membersection{wxArchiveEntry::GetInternalFormat}\label{wxarchiveentrygetinternalformat}
|
||||
|
||||
\constfunc{wxPathFormat}{GetInternalFormat}{\void}
|
||||
|
||||
Returns the path format used internally within the archive to store
|
||||
filenames.
|
||||
|
||||
|
||||
\membersection{wxArchiveEntry::GetInternalName}\label{wxarchiveentrygetinternalname}
|
||||
|
||||
\constfunc{wxString}{GetInternalName}{\void}
|
||||
|
||||
Returns the entry's filename in the internal format used within the
|
||||
archive. The name can include directory components, i.e. it can be a
|
||||
full path.
|
||||
|
||||
The names of directory entries are returned without any trailing path
|
||||
separator. This gives a canonical name that can be used in comparisons.
|
||||
|
||||
\wxheading{See also}
|
||||
|
||||
\helpref{Looking up an archive entry by name}{wxarcbyname}
|
||||
|
||||
|
||||
\membersection{wxArchiveEntry::Get/SetName}\label{wxarchiveentryname}
|
||||
|
||||
\constfunc{wxString}{GetName}{\param{wxPathFormat }{format = wxPATH\_NATIVE}}
|
||||
|
||||
\func{void}{SetName}{\param{const wxString\& }{name}, \param{wxPathFormat }{format = wxPATH\_NATIVE}}
|
||||
|
||||
The entry's name, by default in the native format. The name can include
|
||||
directory components, i.e. it can be a full path.
|
||||
|
||||
If this is a directory entry, (i.e. if \helpref{IsDir()}{wxarchiveentryisdir}
|
||||
is true) then GetName() returns the name with a trailing path separator.
|
||||
|
||||
Similarly, setting a name with a trailing path separator sets IsDir().
|
||||
|
||||
|
||||
\membersection{wxArchiveEntry::GetOffset}\label{wxarchiveentrygetoffset}
|
||||
|
||||
\constfunc{off\_t}{GetOffset}{\void}
|
||||
|
||||
Returns a numeric value unique to the entry within the archive.
|
||||
|
||||
|
||||
\membersection{wxArchiveEntry::Get/SetSize}\label{wxarchiveentrysize}
|
||||
|
||||
\constfunc{off\_t}{GetSize}{\void}
|
||||
|
||||
\func{void}{SetSize}{\param{off\_t }{size}}
|
||||
|
||||
The size of the entry's data in bytes.
|
||||
|
||||
|
||||
\membersection{wxArchiveEntry::IsDir/SetIsDir}\label{wxarchiveentryisdir}
|
||||
|
||||
\constfunc{bool}{IsDir}{\void}
|
||||
|
||||
\func{void}{SetIsDir}{\param{bool }{isDir = true}}
|
||||
|
||||
True if this is a directory entry.
|
||||
|
||||
Directory entries are entries with no data, which are used to store
|
||||
the meta-data of directories. They also make it possible for completely
|
||||
empty directories to be stored.
|
||||
|
||||
The names of entries within an archive can be complete paths, and
|
||||
unarchivers typically create whatever directories are necessary as they
|
||||
restore files, even if the archive contains no explicit directory entries.
|
||||
|
||||
|
||||
\membersection{wxArchiveEntry::IsReadOnly/SetIsReadOnly}\label{wxarchiveentryisreadonly}
|
||||
|
||||
\constfunc{bool}{IsReadOnly}{\void}
|
||||
|
||||
\func{void}{SetIsReadOnly}{\param{bool }{isReadOnly = true}}
|
||||
|
||||
True if the entry is a read-only file.
|
||||
|
||||
|
||||
\membersection{wxArchiveEntry::Set/UnsetNotifier}\label{wxarchiveentrynotifier}
|
||||
|
||||
\func{void}{SetNotifier}{\param{wxArchiveNotifier\& }{notifier}}
|
||||
|
||||
\func{void}{UnsetNotifier}{\void}
|
||||
|
||||
Sets the \helpref{notifier}{wxarchivenotifier} for this entry.
|
||||
Whenever the \helpref{wxArchiveInputStream}{wxarchiveinputstream} updates
|
||||
this entry, it will then invoke the associated
|
||||
notifier's \helpref{OnEntryUpdated}{wxarchivenotifieronentryupdated}
|
||||
method.
|
||||
|
||||
Setting a notifier is not usually necessary. It is used to handle
|
||||
certain cases when modifying an archive in a pipeline (i.e. between
|
||||
non-seekable streams).
|
||||
|
||||
\wxheading{See also}
|
||||
|
||||
\helpref{Archives on non-seekable streams}{wxarcnoseek}\\
|
||||
\helpref{wxArchiveNotifier}{wxarchivenotifier}
|
||||
|
||||
|
||||
%
|
||||
% automatically generated by HelpGen $Revision$ from
|
||||
% wx/archive.h at 16/Sep/04 12:19:29
|
||||
%
|
||||
|
||||
\section{\class{wxArchiveInputStream}}\label{wxarchiveinputstream}
|
||||
|
||||
An abstract base class which serves as a common interface to
|
||||
archive input streams such as \helpref{wxZipInputStream}{wxzipinputstream}.
|
||||
|
||||
\helpref{GetNextEntry()}{wxarchiveinputstreamgetnextentry} returns an
|
||||
\helpref{wxArchiveEntry}{wxarchiveentry} object containing the meta-data
|
||||
for the next entry in the archive (and gives away ownership). Reading from
|
||||
the wxArchiveInputStream then returns the entry's data. Eof() becomes true
|
||||
after an attempt has been made to read past the end of the entry's data.
|
||||
When there are no more entries, GetNextEntry() returns NULL and sets Eof().
|
||||
|
||||
\wxheading{Derived from}
|
||||
|
||||
\helpref{wxFilterInputStream}{wxfilterinputstream}
|
||||
|
||||
\wxheading{Include files}
|
||||
|
||||
<wx/archive.h>
|
||||
|
||||
\wxheading{Data structures}
|
||||
{\small \begin{verbatim}
|
||||
typedef wxArchiveEntry entry\_type
|
||||
\end{verbatim}}
|
||||
|
||||
\wxheading{See also}
|
||||
|
||||
\helpref{Archive formats such as zip}{wxarc}\\
|
||||
\helpref{wxArchiveEntry}{wxarchiveentry}\\
|
||||
\helpref{wxArchiveOutputStream}{wxarchiveoutputstream}
|
||||
|
||||
\latexignore{\rtfignore{\wxheading{Members}}}
|
||||
|
||||
|
||||
\membersection{wxArchiveInputStream::CloseEntry}\label{wxarchiveinputstreamcloseentry}
|
||||
|
||||
\func{bool}{CloseEntry}{\void}
|
||||
|
||||
Closes the current entry. On a non-seekable stream reads to the end of
|
||||
the current entry first.
|
||||
|
||||
|
||||
\membersection{wxArchiveInputStream::GetNextEntry}\label{wxarchiveinputstreamgetnextentry}
|
||||
|
||||
\func{wxArchiveEntry*}{GetNextEntry}{\void}
|
||||
|
||||
Closes the current entry if one is open, then reads the meta-data for
|
||||
the next entry and returns it in a \helpref{wxArchiveEntry}{wxarchiveentry}
|
||||
object, giving away ownership. Reading this wxArchiveInputStream then
|
||||
returns the entry's data.
|
||||
|
||||
|
||||
\membersection{wxArchiveInputStream::OpenEntry}\label{wxarchiveinputstreamopenentry}
|
||||
|
||||
\func{bool}{OpenEntry}{\param{wxArchiveEntry\& }{entry}}
|
||||
|
||||
Closes the current entry if one is open, then opens the entry specified
|
||||
by the \helpref{wxArchiveEntry}{wxarchiveentry} object.
|
||||
|
||||
{\it entry} must be from the same archive file that this
|
||||
wxArchiveInputStream is reading, and it must be reading it from a
|
||||
seekable stream.
|
||||
|
||||
\wxheading{See also}
|
||||
|
||||
\helpref{Looking up an archive entry by name}{wxarcbyname}
|
||||
|
||||
|
||||
%
|
||||
% automatically generated by HelpGen $Revision$ from
|
||||
% wx/archive.h at 16/Sep/04 12:19:29
|
||||
%
|
||||
|
||||
\section{\class{wxArchiveIterator}}\label{wxarchiveiterator}
|
||||
|
||||
An input iterator template class that can be used to transfer an archive's
|
||||
catalogue to a container. It is only available if wxUSE\_STL is set to 1
|
||||
in setup.h, and the uses for it outlined below require a compiler which
|
||||
supports member templates.
|
||||
|
||||
\begin{verbatim}
|
||||
template <class Arc, class T = typename Arc::entry_type*>
|
||||
class wxArchiveIterator
|
||||
{
|
||||
// this constructor creates an 'end of sequence' object
|
||||
wxArchiveIterator();
|
||||
|
||||
// template parameter 'Arc' should be the type of an archive input stream
|
||||
wxArchiveIterator(Arc& arc) {
|
||||
|
||||
/* ... */
|
||||
};
|
||||
|
||||
\end{verbatim}
|
||||
|
||||
The first template parameter should be the type of archive input stream
|
||||
(e.g. \helpref{wxArchiveInputStream}{wxarchiveinputstream}) and the
|
||||
second can either be a pointer to an entry
|
||||
(e.g. \helpref{wxArchiveEntry}{wxarchiveentry}*), or a string/pointer pair
|
||||
(e.g. std::pair<wxString, wxArchiveEntry*>).
|
||||
|
||||
The {\tt <wx/archive.h>} header defines the following typedefs:
|
||||
|
||||
\begin{verbatim}
|
||||
typedef wxArchiveIterator<wxArchiveInputStream> wxArchiveIter;
|
||||
|
||||
typedef wxArchiveIterator<wxArchiveInputStream,
|
||||
std::pair<wxString, wxArchiveEntry*> > wxArchivePairIter;
|
||||
|
||||
\end{verbatim}
|
||||
|
||||
The header for any implementation of this interface should define similar
|
||||
typedefs for its types, for example in {\tt <wx/zipstrm.h>} there is:
|
||||
|
||||
\begin{verbatim}
|
||||
typedef wxArchiveIterator<wxZipInputStream> wxZipIter;
|
||||
|
||||
typedef wxArchiveIterator<wxZipInputStream,
|
||||
std::pair<wxString, wxZipEntry*> > wxZipPairIter;
|
||||
|
||||
\end{verbatim}
|
||||
|
||||
Transferring the catalogue of an archive {\it arc} to a vector {\it cat},
|
||||
can then be done something like this:
|
||||
|
||||
\begin{verbatim}
|
||||
std::vector<wxArchiveEntry*> cat((wxArchiveIter)arc, wxArchiveIter());
|
||||
|
||||
\end{verbatim}
|
||||
|
||||
When the iterator is dereferenced, it gives away ownership of an entry
|
||||
object. So in the above example, when you have finished with {\it cat}
|
||||
you must delete the pointers it contains.
|
||||
|
||||
If you have smart pointers with normal copy semantics (i.e. not auto\_ptr
|
||||
or \helpref{wxScopedPtr}{wxscopedptr}), then you can create an iterator
|
||||
which uses them instead. For example, with a smart pointer class for
|
||||
zip entries {\it ZipEntryPtr}:
|
||||
|
||||
\begin{verbatim}
|
||||
typedef std::vector<ZipEntryPtr> ZipCatalog;
|
||||
typedef wxArchiveIterator<wxZipInputStream, ZipEntryPtr> ZipIter;
|
||||
ZipCatalog cat((ZipIter)zip, ZipIter());
|
||||
|
||||
\end{verbatim}
|
||||
|
||||
Iterators that return std::pair objects can be used to
|
||||
populate a std::multimap, to allow entries to be looked
|
||||
up by name. The string is initialised using the wxArchiveEntry object's
|
||||
\helpref{GetInternalName()}{wxarchiveentrygetinternalname} function.
|
||||
|
||||
\begin{verbatim}
|
||||
typedef std::multimap<wxString, wxZipEntry*> ZipCatalog;
|
||||
ZipCatalog cat((wxZipPairIter)zip, wxZipPairIter());
|
||||
|
||||
\end{verbatim}
|
||||
|
||||
Note that this iterator also gives away ownership of an entry
|
||||
object each time it is dereferenced. So in the above example, when
|
||||
you have finished with {\it cat} you must delete the pointers it contains.
|
||||
|
||||
Or if you have them, a pair containing a smart pointer can be used
|
||||
(again {\it ZipEntryPtr}), no worries about ownership:
|
||||
|
||||
\begin{verbatim}
|
||||
typedef std::multimap<wxString, ZipEntryPtr> ZipCatalog;
|
||||
typedef wxArchiveIterator<wxZipInputStream,
|
||||
std::pair<wxString, ZipEntryPtr> > ZipPairIter;
|
||||
ZipCatalog cat((ZipPairIter)zip, ZipPairIter());
|
||||
|
||||
\end{verbatim}
|
||||
|
||||
\wxheading{Derived from}
|
||||
|
||||
No base class
|
||||
|
||||
\wxheading{Include files}
|
||||
|
||||
<wx/archive.h>
|
||||
|
||||
\wxheading{See also}
|
||||
|
||||
\helpref{wxArchiveEntry}{wxarchiveentry}\\
|
||||
\helpref{wxArchiveInputStream}{wxarchiveinputstream}\\
|
||||
\helpref{wxArchiveOutputStream}{wxarchiveoutputstream}
|
||||
|
||||
\wxheading{Data structures}
|
||||
{\small \begin{verbatim}
|
||||
typedef std::input\_iterator\_tag iterator\_category
|
||||
typedef T value\_type
|
||||
typedef ptrdiff\_t difference\_type
|
||||
typedef T* pointer
|
||||
typedef T\& reference
|
||||
\end{verbatim}}
|
||||
|
||||
\latexignore{\rtfignore{\wxheading{Members}}}
|
||||
|
||||
|
||||
\membersection{wxArchiveIterator::wxArchiveIterator}\label{wxarchiveiteratorwxarchiveiterator}
|
||||
|
||||
\func{}{wxArchiveIterator}{\void}
|
||||
|
||||
Construct an 'end of sequence' instance.
|
||||
|
||||
\func{}{wxArchiveIterator}{\param{Arc\& }{arc}}
|
||||
|
||||
Construct iterator that returns all the entries in the archive input
|
||||
stream {\it arc}.
|
||||
|
||||
|
||||
\membersection{wxArchiveIterator::operator*}\label{wxarchiveiteratoroperatorunknown}
|
||||
|
||||
\constfunc{const T\&}{operator*}{\void}
|
||||
|
||||
Returns an entry object from the archive input stream, giving away
|
||||
ownership.
|
||||
|
||||
|
||||
\membersection{wxArchiveIterator::operator++}\label{wxarchiveiteratoroperatorunknown}
|
||||
|
||||
\func{wxArchiveIterator\&}{operator++}{\void}
|
||||
|
||||
\func{wxArchiveIterator\&}{operator++}{\param{int}{}}
|
||||
|
||||
Position the input iterator at the next entry in the archive input stream.
|
||||
|
||||
|
||||
%
|
||||
% automatically generated by HelpGen $Revision$ from
|
||||
% wx/archive.h at 16/Sep/04 12:19:29
|
||||
%
|
||||
|
||||
\section{\class{wxArchiveNotifier}}\label{wxarchivenotifier}
|
||||
|
||||
If you need to know when a
|
||||
\helpref{wxArchiveInputStream}{wxarchiveinputstream} updates a
|
||||
\helpref{wxArchiveEntry}{wxarchiveentry} object, you can create
|
||||
a notifier by deriving from this abstract base class, overriding
|
||||
\helpref{OnEntryUpdated()}{wxarchivenotifieronentryupdated}. An instance
|
||||
of your notifier class can then be assigned to the wxArchiveEntry object
|
||||
using \helpref{wxArchiveEntry::SetNotifier()}{wxarchiveentrynotifier}.
|
||||
Your OnEntryUpdated() method will then be invoked whenever the input
|
||||
stream updates the entry.
|
||||
|
||||
Setting a notifier is not usually necessary. It is used to handle
|
||||
certain cases when modifying an archive in a pipeline (i.e. between
|
||||
non-seekable streams).
|
||||
See \helpref{Archives on non-seekable streams}{wxarcnoseek}.
|
||||
|
||||
\wxheading{Derived from}
|
||||
|
||||
No base class
|
||||
|
||||
\wxheading{Include files}
|
||||
|
||||
<wx/archive.h>
|
||||
|
||||
\wxheading{See also}
|
||||
|
||||
\helpref{Archives on non-seekable streams}{wxarcnoseek}\\
|
||||
\helpref{wxArchiveEntry}{wxarchiveentry}\\
|
||||
\helpref{wxArchiveInputStream}{wxarchiveinputstream}\\
|
||||
\helpref{wxArchiveOutputStream}{wxarchiveoutputstream}
|
||||
|
||||
\latexignore{\rtfignore{\wxheading{Members}}}
|
||||
|
||||
|
||||
\membersection{wxArchiveNotifier::OnEntryUpdated}\label{wxarchivenotifieronentryupdated}
|
||||
|
||||
\func{void}{OnEntryUpdated}{\param{class wxArchiveEntry\& }{entry}}
|
||||
|
||||
This method must be overridden in your derived class.
|
||||
|
||||
|
||||
%
|
||||
% automatically generated by HelpGen $Revision$ from
|
||||
% wx/archive.h at 16/Sep/04 12:19:29
|
||||
%
|
||||
|
||||
\section{\class{wxArchiveOutputStream}}\label{wxarchiveoutputstream}
|
||||
|
||||
An abstract base class which serves as a common interface to
|
||||
archive output streams such as \helpref{wxZipOutputStream}{wxzipoutputstream}.
|
||||
|
||||
\helpref{PutNextEntry()}{wxarchiveoutputstreamputnextentry} is used
|
||||
to create a new entry in the output archive, then the entry's data is
|
||||
written to the wxArchiveOutputStream. Another call to PutNextEntry()
|
||||
closes the current entry and begins the next.
|
||||
|
||||
\wxheading{Derived from}
|
||||
|
||||
\helpref{wxFilterOutputStream}{wxfilteroutputstream}
|
||||
|
||||
\wxheading{Include files}
|
||||
|
||||
<wx/archive.h>
|
||||
|
||||
\wxheading{See also}
|
||||
|
||||
\helpref{Archive formats such as zip}{wxarc}\\
|
||||
\helpref{wxArchiveEntry}{wxarchiveentry}\\
|
||||
\helpref{wxArchiveInputStream}{wxarchiveinputstream}
|
||||
|
||||
\latexignore{\rtfignore{\wxheading{Members}}}
|
||||
|
||||
|
||||
\membersection{wxArchiveOutputStream::\destruct{wxArchiveOutputStream}}\label{wxarchiveoutputstreamdtor}
|
||||
|
||||
\func{}{\destruct{wxArchiveOutputStream}}{\void}
|
||||
|
||||
Calls \helpref{Close()}{wxarchiveoutputstreamclose} if it has not already
|
||||
been called.
|
||||
|
||||
|
||||
\membersection{wxArchiveOutputStream::Close}\label{wxarchiveoutputstreamclose}
|
||||
|
||||
\func{bool}{Close}{\void}
|
||||
|
||||
Closes the archive, returning true if it was successfully written.
|
||||
Called by the destructor if not called explicitly.
|
||||
|
||||
|
||||
\membersection{wxArchiveOutputStream::CloseEntry}\label{wxarchiveoutputstreamcloseentry}
|
||||
|
||||
\func{bool}{CloseEntry}{\void}
|
||||
|
||||
Close the current entry. It is called implicitly whenever another new
|
||||
entry is created with \helpref{CopyEntry()}{wxarchiveoutputstreamcopyentry}
|
||||
or \helpref{PutNextEntry()}{wxarchiveoutputstreamputnextentry}, or
|
||||
when the archive is closed.
|
||||
|
||||
|
||||
\membersection{wxArchiveOutputStream::CopyArchiveMetaData}\label{wxarchiveoutputstreamcopyarchivemetadata}
|
||||
|
||||
\func{bool}{CopyArchiveMetaData}{\param{wxArchiveInputStream\& }{stream}}
|
||||
|
||||
Some archive formats have additional meta-data that applies to the archive
|
||||
as a whole. For example in the case of zip there is a comment, which
|
||||
is stored at the end of the zip file. CopyArchiveMetaData() can be used
|
||||
to transfer such information when writing a modified copy of an archive.
|
||||
|
||||
Since the position of the meta-data can vary between the various archive
|
||||
formats, it is best to call CopyArchiveMetaData() before transferring
|
||||
the entries. The \helpref{wxArchiveOutputStream}{wxarchiveoutputstream}
|
||||
will then hold on to the meta-data and write it at the correct point in
|
||||
the output file.
|
||||
|
||||
When the input archive is being read from a non-seekable stream, the
|
||||
meta-data may not be available when CopyArchiveMetaData() is called,
|
||||
in which case the two streams set up a link and transfer the data
|
||||
when it becomes available.
|
||||
|
||||
|
||||
\membersection{wxArchiveOutputStream::CopyEntry}\label{wxarchiveoutputstreamcopyentry}
|
||||
|
||||
\func{bool}{CopyEntry}{\param{wxArchiveEntry* }{entry}, \param{wxArchiveInputStream\& }{stream}}
|
||||
|
||||
Takes ownership of {\it entry} and uses it to create a new entry in the
|
||||
archive. {\it entry} is then opened in the input stream {\it stream}
|
||||
and its contents copied to this stream.
|
||||
|
||||
For archive types which compress entry data, CopyEntry() is likely to be
|
||||
much more efficient than transferring the data using Read() and Write()
|
||||
since it will copy them without decompressing and recompressing them.
|
||||
|
||||
{\it entry} must be from the same archive file that {\it stream} is
|
||||
accessing. For non-seekable streams, {\it entry} must also be the last
|
||||
thing read from {\it stream}.
|
||||
|
||||
|
||||
\membersection{wxArchiveOutputStream::PutNextDirEntry}\label{wxarchiveoutputstreamputnextdirentry}
|
||||
|
||||
\func{bool}{PutNextDirEntry}{\param{const wxString\& }{name}, \param{const wxDateTime\& }{dt = wxDateTime::Now()}}
|
||||
|
||||
Create a new directory entry
|
||||
(see \helpref{wxArchiveEntry::IsDir()}{wxarchiveentryisdir})
|
||||
with the given name and timestamp.
|
||||
|
||||
\helpref{PutNextEntry()}{wxarchiveoutputstreamputnextentry} can
|
||||
also be used to create directory entries, by supplying a name with
|
||||
a trailing path separator.
|
||||
|
||||
|
||||
\membersection{wxArchiveOutputStream::PutNextEntry}\label{wxarchiveoutputstreamputnextentry}
|
||||
|
||||
\func{bool}{PutNextEntry}{\param{wxArchiveEntry* }{entry}}
|
||||
|
||||
Takes ownership of {\it entry} and uses it to create a new entry in
|
||||
the archive. The entry's data can then be written by writing to this
|
||||
wxArchiveOutputStream.
|
||||
|
||||
\func{bool}{PutNextEntry}{\param{const wxString\& }{name}, \param{const wxDateTime\& }{dt = wxDateTime::Now()}, \param{off\_t }{size = wxInvalidOffset}}
|
||||
|
||||
Create a new entry with the given name, timestamp and size. The entry's
|
||||
data can then be written by writing to this wxArchiveOutputStream.
|
||||
|
||||
|
@@ -9,6 +9,7 @@
|
||||
\input accessible.tex
|
||||
\input activevt.tex
|
||||
\input app.tex
|
||||
\input archive.tex
|
||||
\input array.tex
|
||||
\input arrstrng.tex
|
||||
\input artprov.tex
|
||||
|
@@ -59,4 +59,5 @@ This chapter contains a selection of topic overviews, first things first:
|
||||
\input tenvvars.tex
|
||||
\input wxPython.tex
|
||||
\input re_syntax.tex
|
||||
\input arc.tex
|
||||
|
||||
|
@@ -1,40 +1,706 @@
|
||||
%
|
||||
% automatically generated by HelpGen from
|
||||
% zipstream.h at 02/May/99 19:54:25
|
||||
% automatically generated by HelpGen $Revision$ from
|
||||
% wx/zipstrm.h at 16/Sep/04 12:19:29
|
||||
%
|
||||
|
||||
\section{\class{wxZipInputStream}}\label{wxzipinputstream}
|
||||
|
||||
This class is input stream from ZIP archive. The archive
|
||||
must be local file (accessible via FILE*).
|
||||
It has all features including GetSize and seeking.
|
||||
|
||||
\wxheading{Note}
|
||||
|
||||
If you need to enumerate files in ZIP archive, you can use
|
||||
\helpref{wxFileSystem}{wxfilesystem} together with wxZipFSHandler (see
|
||||
\helpref{the overview}{fs}).
|
||||
\section{\class{wxZipClassFactory}}\label{wxzipclassfactory}
|
||||
|
||||
Class factory for the zip archive format. See the base class
|
||||
for details.
|
||||
|
||||
\wxheading{Derived from}
|
||||
|
||||
\helpref{wxInputStream}{wxinputstream}
|
||||
\helpref{wxArchiveClassFactory}{wxarchiveclassfactory}
|
||||
|
||||
\wxheading{Include files}
|
||||
|
||||
<wx/zipstrm.h>
|
||||
|
||||
\wxheading{See also}
|
||||
|
||||
\helpref{Archive formats such as zip}{wxarc}\\
|
||||
\helpref{Generic archive programming}{wxarcgeneric}
|
||||
\helpref{wxZipEntry}{wxzipentry}\\
|
||||
\helpref{wxZipInputStream}{wxzipinputstream}\\
|
||||
\helpref{wxZipOutputStream}{wxzipoutputstream}
|
||||
|
||||
|
||||
%
|
||||
% automatically generated by HelpGen $Revision$ from
|
||||
% wx/zipstrm.h at 16/Sep/04 12:19:29
|
||||
%
|
||||
|
||||
\section{\class{wxZipEntry}}\label{wxzipentry}
|
||||
|
||||
Holds the meta-data for an entry in a zip.
|
||||
|
||||
\wxheading{Derived from}
|
||||
|
||||
\helpref{wxArchiveEntry}{wxarchiveentry}
|
||||
|
||||
\wxheading{Include files}
|
||||
|
||||
<wx/zipstrm.h>
|
||||
|
||||
\wxheading{Data structures}
|
||||
|
||||
Constants for \helpref{Get/SetMethod}{wxzipentrymethod}:
|
||||
|
||||
\begin{verbatim}
|
||||
// Compression Method, only 0 (store) and 8 (deflate) are supported here
|
||||
//
|
||||
enum wxZipMethod
|
||||
{
|
||||
wxZIP_METHOD_STORE,
|
||||
wxZIP_METHOD_SHRINK,
|
||||
wxZIP_METHOD_REDUCE1,
|
||||
wxZIP_METHOD_REDUCE2,
|
||||
wxZIP_METHOD_REDUCE3,
|
||||
wxZIP_METHOD_REDUCE4,
|
||||
wxZIP_METHOD_IMPLODE,
|
||||
wxZIP_METHOD_TOKENIZE,
|
||||
wxZIP_METHOD_DEFLATE,
|
||||
wxZIP_METHOD_DEFLATE64,
|
||||
wxZIP_METHOD_BZIP2 = 12,
|
||||
wxZIP_METHOD_DEFAULT = 0xffff
|
||||
};
|
||||
|
||||
\end{verbatim}
|
||||
|
||||
Constants for \helpref{Get/SetSystemMadeBy}{wxzipentrysystemmadeby}:
|
||||
|
||||
\begin{verbatim}
|
||||
// Originating File-System.
|
||||
//
|
||||
// These are Pkware's values. Note that Info-zip disagree on some of them,
|
||||
// most notably NTFS.
|
||||
//
|
||||
enum wxZipSystem
|
||||
{
|
||||
wxZIP_SYSTEM_MSDOS,
|
||||
wxZIP_SYSTEM_AMIGA,
|
||||
wxZIP_SYSTEM_OPENVMS,
|
||||
wxZIP_SYSTEM_UNIX,
|
||||
wxZIP_SYSTEM_VM_CMS,
|
||||
wxZIP_SYSTEM_ATARI_ST,
|
||||
wxZIP_SYSTEM_OS2_HPFS,
|
||||
wxZIP_SYSTEM_MACINTOSH,
|
||||
wxZIP_SYSTEM_Z_SYSTEM,
|
||||
wxZIP_SYSTEM_CPM,
|
||||
wxZIP_SYSTEM_WINDOWS_NTFS,
|
||||
wxZIP_SYSTEM_MVS,
|
||||
wxZIP_SYSTEM_VSE,
|
||||
wxZIP_SYSTEM_ACORN_RISC,
|
||||
wxZIP_SYSTEM_VFAT,
|
||||
wxZIP_SYSTEM_ALTERNATE_MVS,
|
||||
wxZIP_SYSTEM_BEOS,
|
||||
wxZIP_SYSTEM_TANDEM,
|
||||
wxZIP_SYSTEM_OS_400
|
||||
};
|
||||
|
||||
\end{verbatim}
|
||||
|
||||
Constants for \helpref{Get/SetExternalAttributes}{wxzipentryexternalattributes}:
|
||||
|
||||
\begin{verbatim}
|
||||
// Dos/Win file attributes
|
||||
//
|
||||
enum wxZipAttributes
|
||||
{
|
||||
wxZIP_A_RDONLY = 0x01,
|
||||
wxZIP_A_HIDDEN = 0x02,
|
||||
wxZIP_A_SYSTEM = 0x04,
|
||||
wxZIP_A_SUBDIR = 0x10,
|
||||
wxZIP_A_ARCH = 0x20,
|
||||
|
||||
wxZIP_A_MASK = 0x37
|
||||
};
|
||||
|
||||
\end{verbatim}
|
||||
|
||||
Constants for \helpref{Get/SetFlags}{wxzipentrygetflags}:
|
||||
|
||||
\begin{verbatim}
|
||||
// Values for the flags field in the zip headers
|
||||
//
|
||||
enum wxZipFlags
|
||||
{
|
||||
wxZIP_ENCRYPTED = 0x0001,
|
||||
wxZIP_DEFLATE_NORMAL = 0x0000, // normal compression
|
||||
wxZIP_DEFLATE_EXTRA = 0x0002, // extra compression
|
||||
wxZIP_DEFLATE_FAST = 0x0004, // fast compression
|
||||
wxZIP_DEFLATE_SUPERFAST = 0x0006, // superfast compression
|
||||
wxZIP_DEFLATE_MASK = 0x0006,
|
||||
wxZIP_SUMS_FOLLOW = 0x0008, // crc and sizes come after the data
|
||||
wxZIP_ENHANCED = 0x0010,
|
||||
wxZIP_PATCH = 0x0020,
|
||||
wxZIP_STRONG_ENC = 0x0040,
|
||||
wxZIP_UNUSED = 0x0F80,
|
||||
wxZIP_RESERVED = 0xF000
|
||||
};
|
||||
|
||||
\end{verbatim}
|
||||
|
||||
\wxheading{See also}
|
||||
|
||||
\helpref{Archive formats such as zip}{wxarc}\\
|
||||
\helpref{wxZipInputStream}{wxzipinputstream}\\
|
||||
\helpref{wxZipOutputStream}{wxzipoutputstream}\\
|
||||
\helpref{wxZipNotifier}{wxzipnotifier}
|
||||
|
||||
\wxheading{Field availability}
|
||||
|
||||
When reading a zip from a stream that is seekable,
|
||||
\helpref{GetNextEntry()}{wxzipinputstreamgetnextentry} returns
|
||||
a fully populated wxZipEntry object except for
|
||||
\helpref{wxZipEntry::GetLocalExtra()}{wxzipentrylocalextra}. GetLocalExtra()
|
||||
becomes available when the entry is opened, either by calling
|
||||
\helpref{wxZipInputStream::OpenEntry}{wxzipinputstreamopenentry} or by
|
||||
making an attempt to read the entry's data.
|
||||
|
||||
For zips on \helpref{non-seekable}{wxarcnoseek} streams, the following
|
||||
fields are always available when GetNextEntry() returns:
|
||||
|
||||
\helpref{GetDateTime}{wxarchiveentrydatetime}\\
|
||||
\helpref{GetInternalFormat}{wxarchiveentrygetinternalformat}\\
|
||||
\helpref{GetInternalName}{wxzipentrygetinternalname}\\
|
||||
\helpref{GetFlags}{wxzipentrygetflags}\\
|
||||
\helpref{GetLocalExtra}{wxzipentrylocalextra}\\
|
||||
\helpref{GetMethod}{wxzipentrymethod}\\
|
||||
\helpref{GetName}{wxarchiveentryname}\\
|
||||
\helpref{GetOffset}{wxarchiveentrygetoffset}\\
|
||||
\helpref{IsDir}{wxarchiveentryisdir}
|
||||
|
||||
The following fields are also usually available when GetNextEntry()
|
||||
returns, however, if the zip was also written to a non-seekable stream
|
||||
the zipper is permitted to store them after the entry's data. In that
|
||||
case they become available when the entry's data has been read to Eof(),
|
||||
or \helpref{CloseEntry()}{wxarchiveinputstreamcloseentry} has been called.
|
||||
{\tt (GetFlags() \& wxZIP\_SUMS\_FOLLOW) != 0} indicates that one or
|
||||
more of these come after the data:
|
||||
|
||||
\helpref{GetCompressedSize}{wxzipentrygetcompressedsize}\\
|
||||
\helpref{GetCrc}{wxzipentrygetcrc}\\
|
||||
\helpref{GetSize}{wxarchiveentrysize}
|
||||
|
||||
The following are stored at the end of the zip, and become available
|
||||
when the end of the zip has been reached, i.e. after GetNextEntry()
|
||||
returns NULL and Eof() is true:
|
||||
|
||||
\helpref{GetComment}{wxzipentrycomment}\\
|
||||
\helpref{GetExternalAttributes}{wxzipentryexternalattributes}\\
|
||||
\helpref{GetExtra}{wxzipentryextra}\\
|
||||
\helpref{GetMode}{wxzipentrymode}\\
|
||||
\helpref{GetSystemMadeBy}{wxzipentrysystemmadeby}\\
|
||||
\helpref{IsReadOnly}{wxarchiveentryisreadonly}\\
|
||||
\helpref{IsMadeByUnix}{wxzipentryismadebyunix}\\
|
||||
\helpref{IsText}{wxzipentryistext}
|
||||
|
||||
|
||||
\latexignore{\rtfignore{\wxheading{Members}}}
|
||||
|
||||
\membersection{wxZipInputStream::wxZipInputStream}\label{wxzipinputstreamwxzipinputstream}
|
||||
|
||||
\func{}{wxZipInputStream}{\param{const wxString\& }{archive}, \param{const wxString\& }{file}}
|
||||
\membersection{wxZipEntry::wxZipEntry}\label{wxzipentrywxzipentry}
|
||||
|
||||
\func{}{wxZipEntry}{\param{const wxString\& }{name = wxEmptyString}, \param{const wxDateTime\& }{dt = wxDateTime::Now()}, \param{off\_t }{size = wxInvalidOffset}}
|
||||
|
||||
Constructor.
|
||||
|
||||
\wxheading{Parameters}
|
||||
\func{}{wxZipEntry}{\param{const wxZipEntry\& }{entry}}
|
||||
|
||||
\docparam{archive}{name of ZIP file}
|
||||
Copy constructor.
|
||||
|
||||
\docparam{file}{name of file stored in the archive}
|
||||
|
||||
\membersection{wxZipEntry::Clone}\label{wxzipentryclone}
|
||||
|
||||
\constfunc{wxZipEntry*}{Clone}{\void}
|
||||
|
||||
Make a copy of this entry.
|
||||
|
||||
|
||||
\membersection{wxZipEntry::Get/SetComment}\label{wxzipentrycomment}
|
||||
|
||||
\constfunc{wxString}{GetComment}{\void}
|
||||
|
||||
\func{void}{SetComment}{\param{const wxString\& }{comment}}
|
||||
|
||||
A short comment for this entry.
|
||||
|
||||
|
||||
\membersection{wxZipEntry::GetCompressedSize}\label{wxzipentrygetcompressedsize}
|
||||
|
||||
\constfunc{off\_t}{GetCompressedSize}{\void}
|
||||
|
||||
The compressed size of this entry in bytes.
|
||||
|
||||
|
||||
\membersection{wxZipEntry::GetCrc}\label{wxzipentrygetcrc}
|
||||
|
||||
\constfunc{wxUint32}{GetCrc}{\void}
|
||||
|
||||
CRC32 for this entry's data.
|
||||
|
||||
|
||||
\membersection{wxZipEntry::Get/SetExternalAttributes}\label{wxzipentryexternalattributes}
|
||||
|
||||
\constfunc{wxUint32}{GetExternalAttributes}{\void}
|
||||
|
||||
\func{void}{SetExternalAttributes}{\param{wxUint32 }{attr}}
|
||||
|
||||
The low 8 bits are always the DOS/Windows file attributes for this entry.
|
||||
The values of these attributes are given in the
|
||||
enumeration {\tt wxZipAttributes}.
|
||||
|
||||
The remaining bits can store platform specific permission bits or
|
||||
attributes, and their meaning depends on the value
|
||||
of \helpref{SetSystemMadeBy()}{wxzipentrysystemmadeby}.
|
||||
If \helpref{IsMadeByUnix()}{wxzipentryismadebyunix} is true then the
|
||||
high 16 bits are unix mode bits.
|
||||
|
||||
The following other accessors access these bits:
|
||||
|
||||
\helpref{IsReadOnly/SetIsReadOnly}{wxarchiveentryisreadonly}\\
|
||||
\helpref{IsDir/SetIsDir}{wxarchiveentryisdir}\\
|
||||
\helpref{Get/SetMode}{wxzipentrymode}
|
||||
|
||||
|
||||
\membersection{wxZipEntry::Get/SetExtra}\label{wxzipentryextra}
|
||||
|
||||
\constfunc{const char*}{GetExtra}{\void}
|
||||
|
||||
\constfunc{size\_t}{GetExtraLen}{\void}
|
||||
|
||||
\func{void}{SetExtra}{\param{const char* }{extra}, \param{size\_t }{len}}
|
||||
|
||||
The extra field from the entry's central directory record.
|
||||
|
||||
The extra field is used to store platform or application specific
|
||||
data. See Pkware's document 'appnote.txt' for information on its format.
|
||||
|
||||
|
||||
\membersection{wxZipEntry::GetFlags}\label{wxzipentrygetflags}
|
||||
|
||||
\constfunc{int}{GetFlags}{\void}
|
||||
|
||||
Returns a combination of the bits flags in the enumeration {\tt wxZipFlags}.
|
||||
|
||||
|
||||
\membersection{wxZipEntry::GetInternalName}\label{wxzipentrygetinternalname}
|
||||
|
||||
\constfunc{wxString}{GetInternalName}{\void}
|
||||
|
||||
Returns the entry's filename in the internal format used within the
|
||||
archive. The name can include directory components, i.e. it can be a
|
||||
full path.
|
||||
|
||||
The names of directory entries are returned without any trailing path
|
||||
separator. This gives a canonical name that can be used in comparisons.
|
||||
|
||||
\func{wxString}{GetInternalName}{\param{const wxString\& }{name}, \param{wxPathFormat }{format = wxPATH\_NATIVE}, \param{bool* }{pIsDir = NULL}}
|
||||
|
||||
A static member that translates a filename into the internal format used
|
||||
within the archive. If the third parameter is provided, the bool pointed
|
||||
to is set to indicate whether the name looks like a directory name
|
||||
(i.e. has a trailing path separator).
|
||||
|
||||
\wxheading{See also}
|
||||
|
||||
\helpref{Looking up an archive entry by name}{wxarcbyname}
|
||||
|
||||
|
||||
\membersection{wxZipEntry::Get/SetLocalExtra}\label{wxzipentrylocalextra}
|
||||
|
||||
\constfunc{const char*}{GetLocalExtra}{\void}
|
||||
|
||||
\constfunc{size\_t}{GetLocalExtraLen}{\void}
|
||||
|
||||
\func{void}{SetLocalExtra}{\param{const char* }{extra}, \param{size\_t }{len}}
|
||||
|
||||
The extra field from the entry's local record.
|
||||
|
||||
The extra field is used to store platform or application specific
|
||||
data. See Pkware's document 'appnote.txt' for information on its format.
|
||||
|
||||
|
||||
\membersection{wxZipEntry::Get/SetMethod}\label{wxzipentrymethod}
|
||||
|
||||
\constfunc{int}{GetMethod}{\void}
|
||||
|
||||
\func{void}{SetMethod}{\param{int }{method}}
|
||||
|
||||
The compression method. The enumeration {\tt wxZipMethod} lists the
|
||||
possible values.
|
||||
|
||||
The default constructor sets this to wxZIP\_METHOD\_DEFAULT,
|
||||
which allows \helpref{wxZipOutputStream}{wxzipoutputstream} to
|
||||
choose the method when writing the entry.
|
||||
|
||||
|
||||
\membersection{wxZipEntry::Get/SetMode}\label{wxzipentrymode}
|
||||
|
||||
\constfunc{int}{GetMode}{\void}
|
||||
|
||||
If \helpref{IsMadeByUnix()}{wxzipentryismadebyunix} is true then
|
||||
returns the unix permission bits stored in
|
||||
\helpref{GetExternalAttributes()}{wxzipentryexternalattributes}.
|
||||
Otherwise synthesises them from the DOS attributes.
|
||||
|
||||
\func{void}{SetMode}{\param{int }{mode}}
|
||||
|
||||
Sets the DOS attributes
|
||||
in \helpref{GetExternalAttributes()}{wxzipentryexternalattributes}
|
||||
to be consistent with the {\tt mode} given.
|
||||
|
||||
If \helpref{IsMadeByUnix()}{wxzipentryismadebyunix} is true then also
|
||||
stores {\tt mode} in GetExternalAttributes().
|
||||
|
||||
Note that the default constructor
|
||||
sets \helpref{GetSystemMadeBy()}{wxzipentrysystemmadeby} to
|
||||
wxZIP\_SYSTEM\_MSDOS by default. So to be able to store unix
|
||||
permissions when creating zips, call SetSystemMadeBy(wxZIP\_SYSTEM\_UNIX).
|
||||
|
||||
|
||||
\membersection{wxZipEntry::SetNotifier}\label{wxzipentrynotifier}
|
||||
|
||||
\func{void}{SetNotifier}{\param{wxZipNotifier\& }{notifier}}
|
||||
|
||||
\func{void}{UnsetNotifier}{\void}
|
||||
|
||||
Sets the \helpref{notifier}{wxzipnotifier} for this entry.
|
||||
Whenever the \helpref{wxZipInputStream}{wxzipinputstream} updates
|
||||
this entry, it will then invoke the associated
|
||||
notifier's \helpref{OnEntryUpdated}{wxzipnotifieronentryupdated}
|
||||
method.
|
||||
|
||||
Setting a notifier is not usually necessary. It is used to handle
|
||||
certain cases when modifying an zip in a pipeline (i.e. between
|
||||
non-seekable streams).
|
||||
|
||||
\wxheading{See also}
|
||||
|
||||
\helpref{Archives on non-seekable streams}{wxarcnoseek}\\
|
||||
\helpref{wxZipNotifier}{wxzipnotifier}
|
||||
|
||||
|
||||
\membersection{wxZipEntry::Get/SetSystemMadeBy}\label{wxzipentrysystemmadeby}
|
||||
|
||||
\constfunc{int}{GetSystemMadeBy}{\void}
|
||||
|
||||
\func{void}{SetSystemMadeBy}{\param{int }{system}}
|
||||
|
||||
The originating file-system. The default constructor sets this to
|
||||
wxZIP\_SYSTEM\_MSDOS. Set it to wxZIP\_SYSTEM\_UNIX in order to be
|
||||
able to store unix permissions using \helpref{SetMode()}{wxzipentrymode}.
|
||||
|
||||
|
||||
\membersection{wxZipEntry::IsMadeByUnix}\label{wxzipentryismadebyunix}
|
||||
|
||||
\constfunc{bool}{IsMadeByUnix}{\void}
|
||||
|
||||
Returns true if \helpref{GetSystemMadeBy()}{wxzipentrysystemmadeby}
|
||||
is a flavour of unix.
|
||||
|
||||
|
||||
\membersection{wxZipEntry::IsText/SetIsText}\label{wxzipentryistext}
|
||||
|
||||
\constfunc{bool}{IsText}{\void}
|
||||
|
||||
\func{void}{SetIsText}{\param{bool }{isText = true}}
|
||||
|
||||
Indicates that this entry's data is text in an 8-bit encoding.
|
||||
|
||||
|
||||
\membersection{wxZipEntry::operator=}\label{wxzipentryoperatorassign}
|
||||
|
||||
\func{wxZipEntry\& operator}{operator=}{\param{const wxZipEntry\& }{entry}}
|
||||
|
||||
Assignment operator.
|
||||
|
||||
|
||||
%
|
||||
% automatically generated by HelpGen $Revision$ from
|
||||
% wx/zipstrm.h at 16/Sep/04 12:19:29
|
||||
%
|
||||
|
||||
\section{\class{wxZipInputStream}}\label{wxzipinputstream}
|
||||
|
||||
Input stream for reading zip files.
|
||||
|
||||
\helpref{GetNextEntry()}{wxzipinputstreamgetnextentry} returns an
|
||||
\helpref{wxZipEntry}{wxzipentry} object containing the meta-data
|
||||
for the next entry in the zip (and gives away ownership). Reading from
|
||||
the wxZipInputStream then returns the entry's data. Eof() becomes true
|
||||
after an attempt has been made to read past the end of the entry's data.
|
||||
When there are no more entries, GetNextEntry() returns NULL and sets Eof().
|
||||
|
||||
\wxheading{Derived from}
|
||||
|
||||
\helpref{wxArchiveInputStream}{wxarchiveinputstream}
|
||||
|
||||
\wxheading{Include files}
|
||||
|
||||
<wx/zipstrm.h>
|
||||
|
||||
\wxheading{Data structures}
|
||||
{\small \begin{verbatim}
|
||||
typedef wxZipEntry entry\_type
|
||||
\end{verbatim}}
|
||||
|
||||
\wxheading{See also}
|
||||
|
||||
\helpref{Archive formats such as zip}{wxarc}\\
|
||||
\helpref{wxZipEntry}{wxzipentry}\\
|
||||
\helpref{wxZipOutputStream}{wxzipoutputstream}
|
||||
|
||||
\latexignore{\rtfignore{\wxheading{Members}}}
|
||||
|
||||
|
||||
\membersection{wxZipInputStream::wxZipInputStream}\label{wxzipinputstreamwxzipinputstream}
|
||||
|
||||
\func{}{wxZipInputStream}{\param{wxInputStream\& }{stream}, \param{wxMBConv\& }{conv = wxConvLocal}}
|
||||
|
||||
Constructor. In a Unicode build the second parameter {\tt conv} is
|
||||
used to translate the filename and comment fields into Unicode. It has
|
||||
no effect on the stream's data.
|
||||
|
||||
\func{}{wxZipInputStream}{\param{const wxString\& }{archive}, \param{const wxString\& }{file}}
|
||||
|
||||
Compatibility constructor.
|
||||
|
||||
|
||||
\membersection{wxZipInputStream::CloseEntry}\label{wxzipinputstreamcloseentry}
|
||||
|
||||
\func{bool}{CloseEntry}{\void}
|
||||
|
||||
Closes the current entry. On a non-seekable stream reads to the end of
|
||||
the current entry first.
|
||||
|
||||
|
||||
\membersection{wxZipInputStream::GetComment}\label{wxzipinputstreamgetcomment}
|
||||
|
||||
\func{wxString}{GetComment}{\void}
|
||||
|
||||
Returns the zip comment.
|
||||
|
||||
This is stored a the end of the zip, therefore when reading a zip
|
||||
from a non-seekable stream, it returns the empty string until the
|
||||
end of the zip has been reached, i.e. when GetNextEntry() returns
|
||||
NULL.
|
||||
|
||||
|
||||
\membersection{wxZipInputStream::GetNextEntry}\label{wxzipinputstreamgetnextentry}
|
||||
|
||||
\func{wxZipEntry*}{GetNextEntry}{\void}
|
||||
|
||||
Closes the current entry if one is open, then reads the meta-data for
|
||||
the next entry and returns it in a \helpref{wxZipEntry}{wxzipentry}
|
||||
object, giving away ownership. The stream is then open and can be read.
|
||||
|
||||
|
||||
\membersection{wxZipInputStream::GetTotalEntries}\label{wxzipinputstreamgettotalentries}
|
||||
|
||||
\func{int}{GetTotalEntries}{\void}
|
||||
|
||||
For a zip on a seekable stream returns the total number of entries in
|
||||
the zip. For zips on non-seekable streams returns the number of entries
|
||||
returned so far by \helpref{GetNextEntry()}{wxzipinputstreamgetnextentry}.
|
||||
|
||||
|
||||
\membersection{wxZipInputStream::OpenEntry}\label{wxzipinputstreamopenentry}
|
||||
|
||||
\func{bool}{OpenEntry}{\param{wxZipEntry\& }{entry}}
|
||||
|
||||
Closes the current entry if one is open, then opens the entry specified
|
||||
by the {\it entry} object.
|
||||
|
||||
{\it entry} should be from the same zip file, and the zip should
|
||||
be on a seekable stream.
|
||||
|
||||
\wxheading{See also}
|
||||
|
||||
\helpref{Looking up an archive entry by name}{wxarcbyname}
|
||||
|
||||
|
||||
%
|
||||
% automatically generated by HelpGen $Revision$ from
|
||||
% wx/zipstrm.h at 16/Sep/04 12:19:29
|
||||
%
|
||||
|
||||
\section{\class{wxZipNotifier}}\label{wxzipnotifier}
|
||||
|
||||
If you need to know when a \helpref{wxZipInputStream}{wxzipinputstream}
|
||||
updates a \helpref{wxZipEntry}{wxzipentry},
|
||||
you can create a notifier by deriving from this abstract base class,
|
||||
overriding \helpref{OnEntryUpdated()}{wxzipnotifieronentryupdated}.
|
||||
An instance of your notifier class can then be assigned to wxZipEntry
|
||||
objects, using \helpref{wxZipEntry::SetNotifier()}{wxzipentrynotifier}.
|
||||
|
||||
Setting a notifier is not usually necessary. It is used to handle
|
||||
certain cases when modifying an zip in a pipeline (i.e. between
|
||||
non-seekable streams).
|
||||
See '\helpref{Archives on non-seekable streams}{wxarcnoseek}'.
|
||||
|
||||
\wxheading{Derived from}
|
||||
|
||||
No base class
|
||||
|
||||
\wxheading{Include files}
|
||||
|
||||
<wx/zipstrm.h>
|
||||
|
||||
\wxheading{See also}
|
||||
|
||||
\helpref{Archives on non-seekable streams}{wxarcnoseek}\\
|
||||
\helpref{wxZipEntry}{wxzipentry}\\
|
||||
\helpref{wxZipInputStream}{wxzipinputstream}\\
|
||||
\helpref{wxZipOutputStream}{wxzipoutputstream}
|
||||
|
||||
\latexignore{\rtfignore{\wxheading{Members}}}
|
||||
|
||||
|
||||
\membersection{wxZipNotifier::OnEntryUpdated}\label{wxzipnotifieronentryupdated}
|
||||
|
||||
\func{void}{OnEntryUpdated}{\param{wxZipEntry\& }{entry}}
|
||||
|
||||
Override this to receive notifications when
|
||||
an \helpref{wxZipEntry}{wxzipentry} object changes.
|
||||
|
||||
|
||||
%
|
||||
% automatically generated by HelpGen $Revision$ from
|
||||
% wx/zipstrm.h at 16/Sep/04 12:19:29
|
||||
%
|
||||
|
||||
\section{\class{wxZipOutputStream}}\label{wxzipoutputstream}
|
||||
|
||||
Output stream for writing zip files.
|
||||
|
||||
\helpref{PutNextEntry()}{wxzipoutputstreamputnextentry} is used to create
|
||||
a new entry in the output zip, then the entry's data is written to the
|
||||
wxZipOutputStream. Another call to PutNextEntry() closes the current
|
||||
entry and begins the next.
|
||||
|
||||
\wxheading{Derived from}
|
||||
|
||||
\helpref{wxArchiveOutputStream}{wxarchiveoutputstream}
|
||||
|
||||
\wxheading{Include files}
|
||||
|
||||
<wx/zipstrm.h>
|
||||
|
||||
\wxheading{See also}
|
||||
|
||||
\helpref{Archive formats such as zip}{wxarc}\\
|
||||
\helpref{wxZipEntry}{wxzipentry}\\
|
||||
\helpref{wxZipInputStream}{wxzipinputstream}
|
||||
|
||||
\latexignore{\rtfignore{\wxheading{Members}}}
|
||||
|
||||
|
||||
\membersection{wxZipOutputStream::wxZipOutputStream}\label{wxzipoutputstreamwxzipoutputstream}
|
||||
|
||||
\func{}{wxZipOutputStream}{\param{wxOutputStream\& }{stream}, \param{int }{level = -1}, \param{wxMBConv\& }{conv = wxConvLocal}}
|
||||
|
||||
Constructor. {\tt level} is the compression level to use.
|
||||
It can be a value between 0 and 9 or -1 to use the default value
|
||||
which currently is equivalent to 6.
|
||||
|
||||
In a Unicode build the third parameter {\tt conv} is used to translate
|
||||
the filename and comment fields to Unicode. It has no effect on the
|
||||
stream's data.
|
||||
|
||||
|
||||
\membersection{wxZipOutputStream::\destruct{wxZipOutputStream}}\label{wxzipoutputstreamdtor}
|
||||
|
||||
\func{}{\destruct{wxZipOutputStream}}{\void}
|
||||
|
||||
The destructor calls \helpref{Close()}{wxzipoutputstreamclose} to finish
|
||||
writing the zip if it has not been called already.
|
||||
|
||||
|
||||
\membersection{wxZipOutputStream::Close}\label{wxzipoutputstreamclose}
|
||||
|
||||
\func{bool}{Close}{\void}
|
||||
|
||||
Finishes writing the zip, returning true if successfully.
|
||||
Called by the destructor if not called explicitly.
|
||||
|
||||
|
||||
\membersection{wxZipOutputStream::CloseEntry}\label{wxzipoutputstreamcloseentry}
|
||||
|
||||
\func{bool}{CloseEntry}{\void}
|
||||
|
||||
Close the current entry. It is called implicitly whenever another new
|
||||
entry is created with \helpref{CopyEntry()}{wxzipoutputstreamcopyentry}
|
||||
or \helpref{PutNextEntry()}{wxzipoutputstreamputnextentry}, or
|
||||
when the zip is closed.
|
||||
|
||||
|
||||
\membersection{wxZipOutputStream::CopyArchiveMetaData}\label{wxzipoutputstreamcopyarchivemetadata}
|
||||
|
||||
\func{bool}{CopyArchiveMetaData}{\param{wxZipInputStream\& }{inputStream}}
|
||||
|
||||
Transfers the zip comment from the \helpref{wxZipInputStream}{wxzipinputstream}
|
||||
to this output stream.
|
||||
|
||||
|
||||
\membersection{wxZipOutputStream::CopyEntry}\label{wxzipoutputstreamcopyentry}
|
||||
|
||||
\func{bool}{CopyEntry}{\param{wxZipEntry* }{entry}, \param{wxZipInputStream\& }{inputStream}}
|
||||
|
||||
Takes ownership of {\tt entry} and uses it to create a new entry
|
||||
in the zip. {\tt entry} is then opened in {\tt inputStream} and its contents
|
||||
copied to this stream.
|
||||
|
||||
CopyEntry() is much more efficient than transferring the data using
|
||||
Read() and Write() since it will copy them without decompressing and
|
||||
recompressing them.
|
||||
|
||||
For zips on seekable streams, {\tt entry} must be from the same zip file
|
||||
as {\tt stream}. For non-seekable streams, {\tt entry} must also be the
|
||||
last thing read from {\tt inputStream}.
|
||||
|
||||
|
||||
\membersection{wxZipOutputStream::Get/SetLevel}\label{wxzipoutputstreamlevel}
|
||||
|
||||
\constfunc{int}{GetLevel}{\void}
|
||||
|
||||
\func{void}{SetLevel}{\param{int }{level}}
|
||||
|
||||
Set the compression level that will be used the next time an entry is
|
||||
created. It can be a value between 0 and 9 or -1 to use the default value
|
||||
which currently is equivalent to 6.
|
||||
|
||||
|
||||
\membersection{wxZipOutputStream::PutNextDirEntry}\label{wxzipoutputstreamputnextdirentry}
|
||||
|
||||
\func{bool}{PutNextDirEntry}{\param{const wxString\& }{name}, \param{const wxDateTime\& }{dt = wxDateTime::Now()}}
|
||||
|
||||
Create a new directory entry
|
||||
(see \helpref{wxArchiveEntry::IsDir()}{wxarchiveentryisdir})
|
||||
with the given name and timestamp.
|
||||
|
||||
\helpref{PutNextEntry()}{wxzipoutputstreamputnextentry} can
|
||||
also be used to create directory entries, by supplying a name with
|
||||
a trailing path separator.
|
||||
|
||||
|
||||
\membersection{wxZipOutputStream::PutNextEntry}\label{wxzipoutputstreamputnextentry}
|
||||
|
||||
\func{bool}{PutNextEntry}{\param{wxZipEntry* }{entry}}
|
||||
|
||||
Takes ownership of {\tt entry} and uses it to create a new entry
|
||||
in the zip.
|
||||
|
||||
\func{bool}{PutNextEntry}{\param{const wxString\& }{name}, \param{const wxDateTime\& }{dt = wxDateTime::Now()}, \param{off\_t }{size = wxInvalidOffset}}
|
||||
|
||||
Create a new entry with the given name, timestamp and size.
|
||||
|
||||
|
||||
\membersection{wxZipOutputStream::SetComment}\label{wxzipoutputstreamsetcomment}
|
||||
|
||||
\func{void}{SetComment}{\param{const wxString\& }{comment}}
|
||||
|
||||
Sets a comment for the zip as a whole. It is written at the end of the
|
||||
zip.
|
||||
|
||||
|
Reference in New Issue
Block a user