Add wxLZMAClassFactory for run-time LZMA stream creation

This should allow handling .xz files in wxFileSystem, for example.
This commit is contained in:
Vadim Zeitlin
2018-03-30 22:11:07 +02:00
parent 7c34ca65a0
commit 1cdb384d7b
2 changed files with 58 additions and 0 deletions

View File

@@ -117,6 +117,31 @@ private:
bool DoFlush(bool finish);
};
// ----------------------------------------------------------------------------
// Support for creating LZMA streams from extension/MIME type
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_BASE wxLZMAClassFactory: public wxFilterClassFactory
{
public:
wxLZMAClassFactory();
wxFilterInputStream *NewStream(wxInputStream& stream) const wxOVERRIDE
{ return new wxLZMAInputStream(stream); }
wxFilterOutputStream *NewStream(wxOutputStream& stream) const wxOVERRIDE
{ return new wxLZMAOutputStream(stream, -1); }
wxFilterInputStream *NewStream(wxInputStream *stream) const wxOVERRIDE
{ return new wxLZMAInputStream(stream); }
wxFilterOutputStream *NewStream(wxOutputStream *stream) const wxOVERRIDE
{ return new wxLZMAOutputStream(stream, -1); }
const wxChar * const *GetProtocols(wxStreamProtocolType type
= wxSTREAM_PROTOCOL) const wxOVERRIDE;
private:
wxDECLARE_DYNAMIC_CLASS(wxLZMAClassFactory);
};
WXDLLIMPEXP_BASE wxVersionInfo wxGetLibLZMAVersionInfo();
#endif // wxUSE_LIBLZMA && wxUSE_STREAMS