Add wxFSInputStream providing stream interface to wxFileSystem.

This class allows using virtual wxFSFiles with any wx functions taking
streams. E.g. it makes it possible to load images and animations from
wxFileSystem.

Closes #14185.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@71206 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2012-04-16 13:53:49 +00:00
parent f5ef4d69b7
commit b7775a521f
4 changed files with 76 additions and 0 deletions

View File

@@ -463,3 +463,41 @@ protected:
static wxString GetRightLocation(const wxString& location);
};
/**
Input stream for virtual file stream files.
The stream reads data from wxFSFile obtained from wxFileSystem. It is
especially useful to allow using virtual files with other wxWidgets
functions and classes working with streams, e.g. for loading images or
animations from virtual files and not only physical ones.
@library{wxbase}
@category{streams}
@see wxWrapperInputStream, wxFSFile
@since 2.9.4
*/
class wxFSInputStream : public wxWrapperInputStream
{
public:
/**
Create a stream associated with the data of the given virtual file
system file.
@param filename
The name of the input file passed to wxFileSystem::OpenFile().
@param flags
Combination of flags from wxFileSystemOpenFlags. ::wxFS_READ is
implied, i.e. it is always added to the flags value.
Use wxStreamBase::IsOk() to verify if the constructor succeeded.
*/
wxFileInputStream(const wxString& filename, int flags = 0);
/**
Returns @true if the stream is initialized and ready.
*/
bool IsOk() const;
};