X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/12f5e1e78fe906050ff2fee9529476db332633f0..e1db4c1290af151b0d85c4dcad7cbb2414e0d474:/interface/wx/filesys.h diff --git a/interface/wx/filesys.h b/interface/wx/filesys.h index a9b1aa99c4..01e5fd12fe 100644 --- a/interface/wx/filesys.h +++ b/interface/wx/filesys.h @@ -3,7 +3,7 @@ // Purpose: interface of wxFileSystem, wxFileSystemHandler, wxFSFile // Author: wxWidgets team // RCS-ID: $Id$ -// Licence: wxWindows license +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -36,6 +36,11 @@ class wxFileSystem : public wxObject public: /** Constructor. + + The initial current path of this object will be empty + (i.e. GetPath() == wxEmptyString) which means that e.g. OpenFile() + or FindFirst() functions will use current working directory as + current path (see also wxGetCwd). */ wxFileSystem(); @@ -54,7 +59,7 @@ public: handlers are deleted in wxFileSystem's destructor so that you don't have to care about it. */ - static void AddHandler(wxFileSystemHandler handler); + static void AddHandler(wxFileSystemHandler* handler); /** Sets the current location. @a location parameter passed to OpenFile() is @@ -100,14 +105,14 @@ public: If the file is found in any directory, returns @true and the full path of the file in @a str, otherwise returns @false and doesn't modify @a str. - @param str + @param pStr Receives the full path of the file, must not be @NULL @param path wxPATH_SEP-separated list of directories @param file the name of the file to look for */ - bool FindFileInPath(wxString str, const wxString& path, + bool FindFileInPath(wxString* pStr, const wxString& path, const wxString& file); /** @@ -131,7 +136,7 @@ public: /** Returns the actual path (set by wxFileSystem::ChangePathTo). */ - wxString GetPath(); + wxString GetPath() const; /** This static function returns @true if there is a registered handler which can @@ -155,6 +160,11 @@ public: Passing @e "wxFS_READ | wxFS_SEEKABLE" for @a flags will back a stream that is not natively seekable with memory or a file and return a stream that is always seekable. + + @note + The @a location argument is, despite this method's name @em not + a filename. It is a "location", aka wxFileSystem URL (see + @ref overview_fs). */ wxFSFile* OpenFile(const wxString& location, int flags = wxFS_READ); @@ -172,7 +182,7 @@ public: @class wxFSFile This class represents a single file opened by wxFileSystem. - It provides more information than wxWindow's input stream + It provides more informations than wxWidgets' input streams (stream, filename, mime type, anchor). @note Any pointer returned by a method of wxFSFile is valid only as long as @@ -182,7 +192,7 @@ public: ten identical pointers. @library{wxbase} - @category{vfs} + @category{vfs,file} @see wxFileSystemHandler, wxFileSystem, @ref overview_fs */ @@ -224,10 +234,12 @@ public: not be empty in this case). @param anchor Anchor. See GetAnchor() for details. + @param modif + Modification date and time for this file. */ - wxFSFile(wxInputStream stream, const wxString& loc, - const wxString& mimetype, - const wxString& anchor, wxDateTime modif); + wxFSFile(wxInputStream* stream, const wxString& location, + const wxString& mimetype, const wxString& anchor, + wxDateTime modif); /** Detaches the stream from the wxFSFile object. That is, the @@ -236,7 +248,7 @@ public: You will have to delete the stream yourself. */ - void DetachStream(); + wxInputStream* DetachStream(); /** Returns anchor (if present). The term of @b anchor can be easily @@ -324,7 +336,7 @@ public: @beginWxPerlOnly In wxPerl, you need to derive your file system handler class - from Wx::PlFileSystemHandler. + from @c Wx::PlFileSystemHandler. @endWxPerlOnly @library{wxbase} @@ -354,7 +366,7 @@ public: Must be overridden in derived handlers. */ - virtual bool CanOpen(const wxString& location); + virtual bool CanOpen(const wxString& location) = 0; /** Works like ::wxFindFirstFile(). @@ -377,39 +389,53 @@ public: virtual wxString FindNext(); /** - Returns the anchor if present in the location. - See wxFSFile::GetAnchor for details. + Returns the MIME type based on @b extension of @a location. + (While wxFSFile::GetMimeType() returns real MIME type - either + extension-based or queried from HTTP.) Example: @code - GetAnchor("index.htm#chapter2") == "chapter2" + GetMimeTypeFromExt("index.htm") == "text/html" @endcode + */ + static wxString GetMimeTypeFromExt(const wxString& location); - @note the anchor is NOT part of the left location. + /** + Opens the file and returns wxFSFile pointer or @NULL if failed. + Must be overridden in derived handlers. + + @param fs + Parent FS (the FS from that OpenFile was called). + See the ZIP handler for details of how to use it. + @param location + The absolute location of file. */ - wxString GetAnchor(const wxString& location) const; + virtual wxFSFile* OpenFile(wxFileSystem& fs, const wxString& location) = 0; + +protected: /** - Returns the left location string extracted from @e location. + Returns the anchor if present in the location. + See wxFSFile::GetAnchor for details. Example: @code - GetLeftLocation("file:myzipfile.zip#zip:index.htm") == "file:myzipfile.zip" + GetAnchor("index.htm#chapter2") == "chapter2" @endcode + + @note the anchor is NOT part of the left location. */ - wxString GetLeftLocation(const wxString& location) const; + static wxString GetAnchor(const wxString& location); /** - Returns the MIME type based on @b extension of @a location. - (While wxFSFile::GetMimeType() returns real MIME type - either - extension-based or queried from HTTP.) + Returns the left location string extracted from @e location. Example: @code - GetMimeTypeFromExt("index.htm") == "text/html" + GetLeftLocation("file:myzipfile.zip#zip:index.htm") == "file:myzipfile.zip" @endcode */ - wxString GetMimeTypeFromExt(const wxString& location); + static wxString GetLeftLocation(const wxString& location); /** Returns the protocol string extracted from @a location. @@ -419,7 +445,7 @@ public: GetProtocol("file:myzipfile.zip#zip:index.htm") == "zip" @endcode */ - wxString GetProtocol(const wxString& location) const; + static wxString GetProtocol(const wxString& location); /** Returns the right location string extracted from @a location. @@ -429,19 +455,6 @@ public: GetRightLocation("file:myzipfile.zip#zip:index.htm") == "index.htm" @endcode */ - wxString GetRightLocation(const wxString& location) const; - - /** - Opens the file and returns wxFSFile pointer or @NULL if failed. - Must be overridden in derived handlers. - - @param fs - Parent FS (the FS from that OpenFile was called). - See the ZIP handler for details of how to use it. - @param location - The absolute location of file. - */ - virtual wxFSFile* OpenFile(wxFileSystem& fs, - const wxString& location); + static wxString GetRightLocation(const wxString& location); };