📄 archive.tex
字号:
%% automatically generated by HelpGen $Revision: 1.4 $ from% wx/archive.h at 16/Sep/04 12:19:29%\section{\class{wxArchiveClassFactory}}\label{wxarchiveclassfactory}Allows the creation of streams to handle archive formats suchas zip and tar.For example, given a filename you can search for a factory that willhandle it and create a stream to read it:\begin{verbatim} factory = wxArchiveClassFactory::Find(filename, wxSTREAM_FILEEXT); if (factory) stream = factory->NewStream(new wxFFileInputStream(filename));\end{verbatim}\helpref{Find()}{wxarchiveclassfactoryfind} can also searchfor a factory by MIME type or wxFileSystem protocol.The available factories can be enumeratedusing \helpref{GetFirst() and GetNext()}{wxarchiveclassfactorygetfirst}.\wxheading{Derived from}\helpref{wxObject}{wxobject}\wxheading{Include files}<wx/archive.h>\wxheading{Data structures}\begin{verbatim}enum wxStreamProtocolType{ wxSTREAM_PROTOCOL, // wxFileSystem protocol (should be only one) wxSTREAM_MIMETYPE, // MIME types the stream handles wxSTREAM_ENCODING, // Not used for archives wxSTREAM_FILEEXT // File extensions the stream handles};\end{verbatim}\wxheading{See also}\helpref{Archive formats such as zip}{wxarc}\\\helpref{Generic archive programming}{wxarcgeneric}\\\helpref{wxArchiveEntry}{wxarchiveentry}\\\helpref{wxArchiveInputStream}{wxarchiveinputstream}\\\helpref{wxArchiveOutputStream}{wxarchiveoutputstream}\\\helpref{wxFilterClassFactory}{wxfilterclassfactory}\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 streamswill use when translating meta-data. The initial default, set by theconstructor, is wxConvLocal.\membersection{wxArchiveClassFactory::CanHandle}\label{wxarchiveclassfactorycanhandle}\constfunc{bool}{CanHandle}{\param{const wxChar* }{protocol}, \param{wxStreamProtocolType }{type = wxSTREAM\_PROTOCOL}}Returns true if this factory can handle the given protocol, MIME typeor file extension.When using wxSTREAM\_FILEEXT for the second parameter, the first parametercan be a complete filename rather than just an extension.\membersection{wxArchiveClassFactory::Find}\label{wxarchiveclassfactoryfind}\func{static const wxArchiveClassFactory*}{Find}{\param{const wxChar* }{protocol}, \param{wxStreamProtocolType }{type = wxSTREAM\_PROTOCOL}}A static member that finds a factory that can handle a given protocol, MIMEtype or file extension. Returns a pointer to the class factory if found, orNULL otherwise. It does not give away ownership of the factory.When using wxSTREAM\_FILEEXT for the second parameter, the first parametercan be a complete filename rather than just an extension.\membersection{wxArchiveClassFactory::GetFirst/GetNext}\label{wxarchiveclassfactorygetfirst}\func{static const wxArchiveClassFactory*}{GetFirst}{\void}\constfunc{const wxArchiveClassFactory*}{GetNext}{\void}GetFirst and GetNext can be used to enumerate the available factories.For example, to list them:\begin{verbatim} wxString list; const wxArchiveClassFactory *factory = wxArchiveClassFactory::GetFirst(); while (factory) { list << factory->GetProtocol() << _T("\n"); factory = factory->GetNext(); }\end{verbatim}GetFirst()/GetNext() return a pointer to a factory or NULL if no moreare available. They do not give away ownership of the factory.\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::GetProtocol}\label{wxarchiveclassfactorygetprotocol}\constfunc{wxString}{GetProtocol}{\void}Returns the wxFileSystem protocol supported by this factory. Equivalentto wxString(*GetProtcols()).\membersection{wxArchiveClassFactory::GetProtocols}\label{wxarchiveclassfactorygetprotocols}\constfunc{const wxChar * const*}{GetProtocols}{\param{wxStreamProtocolType }{type = wxSTREAM\_PROTOCOL}}Returns the protocols, MIME types or file extensions supported by thisfactory, as an array of null terminated strings. It does not give awayownership of the array or strings.For example, to list the file extensions a factory supports:\begin{verbatim} wxString list; const wxChar *const *p; for (p = factory->GetProtocols(wxSTREAM_FILEEXT); *p; p++) list << *p << _T("\n");\end{verbatim}\membersection{wxArchiveClassFactory::NewEntry}\label{wxarchiveclassfactorynewentry}\constfunc{wxArchiveEntry*}{NewEntry}{\void}Create a new \helpref{wxArchiveEntry}{wxarchiveentry} object of theappropriate type.\membersection{wxArchiveClassFactory::NewStream}\label{wxarchiveclassfactorynewstream}\constfunc{wxArchiveInputStream*}{NewStream}{\param{wxInputStream\& }{stream}}\constfunc{wxArchiveOutputStream*}{NewStream}{\param{wxOutputStream\& }{stream}}\constfunc{wxArchiveInputStream*}{NewStream}{\param{wxInputStream* }{stream}}\constfunc{wxArchiveOutputStream*}{NewStream}{\param{wxOutputStream* }{stream}}Create a new input or output stream to read or write an archive.If the parent stream is passed as a pointer then the new archive streamtakes ownership of it. If it is passed by reference then it does not.\membersection{wxArchiveClassFactory::PushFront}\label{wxarchiveclassfactorypushfront}\func{void}{PushFront}{\void}Adds this class factory to the list returnedby \helpref{GetFirst()/GetNext()}{wxarchiveclassfactorygetfirst}.It is not necessary to do this to use the archive streams. It is usuallyused when implementing streams, typically the implementation will add a static instance of its factory class.It can also be used to change the order of a factory already in the list,bringing it to the front. This isn't a thread safe operationso can't be done when other threads are running that will be using the list.The list does not take ownership of the factory.\membersection{wxArchiveClassFactory::Remove}\label{wxarchiveclassfactoryremove}\func{void}{Remove}{\void}Removes this class factory from the list returnedby \helpref{GetFirst()/GetNext()}{wxarchiveclassfactorygetfirst}.Removing from the list isn't a thread safe operationso can't be done when other threads are running that will be using the list.The list does not own the factories, so removing a factory does not delete it.%% automatically generated by HelpGen $Revision: 1.4 $ 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 toarchive entry classes such as \helpref{wxZipEntry}{wxzipentry}.These hold the meta-data (filename, timestamp, etc.), for entriesin 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-seekablestreams. When the stream isseekable \helpref{GetNextEntry()}{wxarchiveinputstreamgetnextentry}returns a fully populated \helpref{wxArchiveEntry}{wxarchiveentry}.See '\helpref{Archives on non-seekable streams}{wxarcnoseek}' formore information.For generic programming, when the worst case must be assumed, you canrely on all the fields of wxArchiveEntry being fully populated whenGetNextEntry() returns, with the the following exceptions:\begin{twocollist}\twocolwidtha{3cm}\twocolitem{\helpref{GetSize()}{wxarchiveentrysize}}{Guaranteed to beavailable after the entry has been read to \helpref{Eof()}{wxinputstreameof},or \helpref{CloseEntry()}{wxarchiveinputstreamcloseentry} has been called}\twocolitem{\helpref{IsReadOnly()}{wxarchiveentryisreadonly}}{Guaranteed tobe available after the end of the archive has been reached, i.e. afterGetNextEntry() 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 storefilenames.\membersection{wxArchiveEntry::GetInternalName}\label{wxarchiveentrygetinternalname}\constfunc{wxString}{GetInternalName}{\void}Returns the entry's filename in the internal format used within thearchive. The name can include directory components, i.e. it can be afull path.The names of directory entries are returned without any trailing pathseparator. 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 includedirectory 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 storethe meta-data of directories. They also make it possible for completelyempty directories to be stored.The names of entries within an archive can be complete paths, andunarchivers typically create whatever directories are necessary as theyrestore 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} updatesthis entry, it will then invoke the associatednotifier's \helpref{OnEntryUpdated}{wxarchivenotifieronentryupdated}method.Setting a notifier is not usually necessary. It is used to handlecertain cases when modifying an archive in a pipeline (i.e. betweennon-seekable streams).\wxheading{See also}\helpref{Archives on non-seekable streams}{wxarcnoseek}\\\helpref{wxArchiveNotifier}{wxarchivenotifier}%% automatically generated by HelpGen $Revision: 1.4 $ 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 toarchive input streams such as \helpref{wxZipInputStream}{wxzipinputstream}.\helpref{GetNextEntry()}{wxarchiveinputstreamgetnextentry} returns an
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -