2008-03-08 08:52:38 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: filesys.h
|
2008-05-10 05:44:43 -04:00
|
|
|
// Purpose: interface of wxFileSystem, wxFileSystemHandler, wxFSFile
|
2008-03-08 08:52:38 -05:00
|
|
|
// Author: wxWidgets team
|
|
|
|
// RCS-ID: $Id$
|
|
|
|
// Licence: wxWindows license
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2008-05-10 05:44:43 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
Open Bit Flags
|
|
|
|
*/
|
|
|
|
enum wxFileSystemOpenFlags
|
|
|
|
{
|
|
|
|
wxFS_READ = 1, /**< Open for reading */
|
|
|
|
wxFS_SEEKABLE = 4 /**< Returned stream will be seekable */
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
/**
|
|
|
|
@class wxFileSystem
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-05-10 05:44:43 -04:00
|
|
|
This class provides an interface for opening files on different file systems.
|
|
|
|
It can handle absolute and/or local filenames.
|
|
|
|
|
|
|
|
It uses a system of handlers (see wxFileSystemHandler) to provide access to
|
|
|
|
user-defined virtual file systems.
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@library{wxbase}
|
|
|
|
@category{vfs}
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-05-10 05:44:43 -04:00
|
|
|
@see wxFileSystemHandler, wxFSFile, @ref overview_fs
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
class wxFileSystem : public wxObject
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
Constructor.
|
2009-01-10 13:59:37 -05:00
|
|
|
|
|
|
|
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).
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
wxFileSystem();
|
|
|
|
|
|
|
|
/**
|
2008-05-10 05:44:43 -04:00
|
|
|
This static function adds new handler into the list of handlers
|
|
|
|
(see wxFileSystemHandler) which provide access to virtual FS.
|
|
|
|
|
|
|
|
Note that if two handlers for the same protocol are added, the last
|
|
|
|
added one takes precedence.
|
|
|
|
|
|
|
|
@note You can call:
|
|
|
|
@code
|
|
|
|
wxFileSystem::AddHandler(new My_FS_Handler);
|
|
|
|
@endcode
|
|
|
|
This is because (a) AddHandler is a static method, and (b) the
|
|
|
|
handlers are deleted in wxFileSystem's destructor so that you
|
|
|
|
don't have to care about it.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2009-01-10 17:42:09 -05:00
|
|
|
static void AddHandler(wxFileSystemHandler* handler);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-05-10 05:44:43 -04:00
|
|
|
Sets the current location. @a location parameter passed to OpenFile() is
|
|
|
|
relative to this path.
|
|
|
|
|
|
|
|
@remarks Unless @a is_dir is @true the @a location parameter is not the
|
|
|
|
directory name but the name of the file in this directory.
|
|
|
|
|
|
|
|
All these commands change the path to "dir/subdir/":
|
|
|
|
|
|
|
|
@code
|
|
|
|
ChangePathTo("dir/subdir/xh.htm");
|
|
|
|
ChangePathTo("dir/subdir", true);
|
|
|
|
ChangePathTo("dir/subdir/", true);
|
|
|
|
@endcode
|
|
|
|
|
|
|
|
Example:
|
|
|
|
@code
|
|
|
|
f = fs->OpenFile("hello.htm"); // opens file 'hello.htm'
|
|
|
|
fs->ChangePathTo("subdir/folder", true);
|
|
|
|
f = fs->OpenFile("hello.htm"); // opens file 'subdir/folder/hello.htm' !!
|
|
|
|
@endcode
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-08 09:43:31 -05:00
|
|
|
@param location
|
2008-03-09 08:33:59 -04:00
|
|
|
the new location. Its meaning depends on the value of is_dir
|
2008-03-08 09:43:31 -05:00
|
|
|
@param is_dir
|
2008-05-10 05:44:43 -04:00
|
|
|
if @true location is new directory.
|
|
|
|
If @false (the default) location is file in the new directory.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-03-09 08:33:59 -04:00
|
|
|
void ChangePathTo(const wxString& location, bool is_dir = false);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-05-10 05:44:43 -04:00
|
|
|
Converts a wxFileName into an URL.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see URLToFileName(), wxFileName
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-05-10 05:44:43 -04:00
|
|
|
static wxString FileNameToURL(const wxFileName& filename);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-03-09 08:33:59 -04:00
|
|
|
Looks for the file with the given name @a file in a colon or semi-colon
|
2008-05-10 05:44:43 -04:00
|
|
|
(depending on the current platform) separated list of directories in @a path.
|
|
|
|
|
|
|
|
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.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-11-03 06:57:07 -05:00
|
|
|
@param pStr
|
2008-03-09 08:33:59 -04:00
|
|
|
Receives the full path of the file, must not be @NULL
|
2008-03-08 09:43:31 -05:00
|
|
|
@param path
|
2008-03-09 08:33:59 -04:00
|
|
|
wxPATH_SEP-separated list of directories
|
2008-03-08 09:43:31 -05:00
|
|
|
@param file
|
2008-03-09 08:33:59 -04:00
|
|
|
the name of the file to look for
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-10-28 11:36:26 -04:00
|
|
|
bool FindFileInPath(wxString* pStr, const wxString& path,
|
2008-03-08 08:52:38 -05:00
|
|
|
const wxString& file);
|
|
|
|
|
|
|
|
/**
|
2008-05-10 05:44:43 -04:00
|
|
|
Works like ::wxFindFirstFile().
|
|
|
|
|
|
|
|
Returns the name of the first filename (within filesystem's current path)
|
|
|
|
that matches @a wildcard.
|
|
|
|
|
|
|
|
@param wildcard
|
|
|
|
The wildcard that the filename must match
|
|
|
|
@param flags
|
|
|
|
One of wxFILE (only files), wxDIR (only directories) or 0 (both).
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
wxString FindFirst(const wxString& wildcard, int flags = 0);
|
|
|
|
|
|
|
|
/**
|
2008-05-10 05:44:43 -04:00
|
|
|
Returns the next filename that matches the parameters passed to FindFirst().
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
wxString FindNext();
|
|
|
|
|
|
|
|
/**
|
2008-05-10 05:44:43 -04:00
|
|
|
Returns the actual path (set by wxFileSystem::ChangePathTo).
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
wxString GetPath() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
This static function returns @true if there is a registered handler which can
|
2008-05-10 05:44:43 -04:00
|
|
|
open the given location.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-03-09 08:33:59 -04:00
|
|
|
static bool HasHandlerForPath(const wxString& location);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-05-10 05:44:43 -04:00
|
|
|
Opens the file and returns a pointer to a wxFSFile object or @NULL if failed.
|
|
|
|
|
|
|
|
It first tries to open the file in relative scope (based on value passed to
|
|
|
|
ChangePathTo() method) and then as an absolute path.
|
|
|
|
|
|
|
|
Note that the user is responsible for deleting the returned wxFSFile.
|
|
|
|
@a flags can be one or more of the ::wxFileSystemOpenFlags values
|
|
|
|
combined together.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
A stream opened with just the default @e wxFS_READ flag may
|
|
|
|
or may not be seekable depending on the underlying source.
|
2008-05-10 05:44:43 -04:00
|
|
|
|
|
|
|
Passing @e "wxFS_READ | wxFS_SEEKABLE" for @a flags will back
|
|
|
|
a stream that is not natively seekable with memory or a file
|
2008-03-08 08:52:38 -05:00
|
|
|
and return a stream that is always seekable.
|
|
|
|
*/
|
|
|
|
wxFSFile* OpenFile(const wxString& location,
|
|
|
|
int flags = wxFS_READ);
|
|
|
|
|
|
|
|
/**
|
2008-05-10 05:44:43 -04:00
|
|
|
Converts URL into a well-formed filename.
|
|
|
|
The URL must use the @c file protocol.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
static wxFileName URLToFileName(const wxString& url);
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2008-03-10 11:24:38 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
/**
|
|
|
|
@class wxFSFile
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
This class represents a single file opened by wxFileSystem.
|
2009-01-10 13:59:37 -05:00
|
|
|
It provides more informations than wxWidgets' input streams
|
2008-03-08 08:52:38 -05:00
|
|
|
(stream, filename, mime type, anchor).
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-05-10 05:44:43 -04:00
|
|
|
@note Any pointer returned by a method of wxFSFile is valid only as long as
|
|
|
|
the wxFSFile object exists. For example a call to GetStream()
|
|
|
|
doesn't @e create the stream but only returns the pointer to it.
|
|
|
|
In other words after 10 calls to GetStream() you will have obtained
|
|
|
|
ten identical pointers.
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@library{wxbase}
|
2009-01-10 13:59:37 -05:00
|
|
|
@category{vfs,file}
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-05-10 05:44:43 -04:00
|
|
|
@see wxFileSystemHandler, wxFileSystem, @ref overview_fs
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
class wxFSFile : public wxObject
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
/**
|
2008-05-10 05:44:43 -04:00
|
|
|
Constructor. You probably won't use it. See the Note for details.
|
|
|
|
|
|
|
|
It is seldom used by the application programmer but you will need it if
|
|
|
|
you are writing your own virtual FS. For example you may need something
|
|
|
|
similar to wxMemoryInputStream, but because wxMemoryInputStream doesn't
|
|
|
|
free the memory when destroyed and thus passing a memory stream pointer
|
|
|
|
into wxFSFile constructor would lead to memory leaks, you can write your
|
|
|
|
own class derived from wxFSFile:
|
|
|
|
|
|
|
|
@code
|
|
|
|
class wxMyFSFile : public wxFSFile
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
void *m_Mem;
|
|
|
|
public:
|
|
|
|
wxMyFSFile(.....)
|
|
|
|
~wxMyFSFile() {free(m_Mem);}
|
|
|
|
// of course dtor is virtual ;-)
|
|
|
|
};
|
|
|
|
@endcode
|
|
|
|
|
|
|
|
If you are not sure of the meaning of these params, see the description
|
|
|
|
of the GetXXXX() functions.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-08 09:43:31 -05:00
|
|
|
@param stream
|
2008-03-09 08:33:59 -04:00
|
|
|
The input stream that will be used to access data
|
2008-03-08 09:43:31 -05:00
|
|
|
@param location
|
2008-03-09 08:33:59 -04:00
|
|
|
The full location (aka filename) of the file
|
2008-03-08 09:43:31 -05:00
|
|
|
@param mimetype
|
2008-03-09 08:33:59 -04:00
|
|
|
MIME type of this file. It may be left empty, in which
|
|
|
|
case the type will be determined from file's extension (location must
|
|
|
|
not be empty in this case).
|
2008-03-08 09:43:31 -05:00
|
|
|
@param anchor
|
2008-03-09 08:33:59 -04:00
|
|
|
Anchor. See GetAnchor() for details.
|
2008-10-04 16:49:51 -04:00
|
|
|
@param modif
|
|
|
|
Modification date and time for this file.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-10-13 09:46:42 -04:00
|
|
|
wxFSFile(wxInputStream* stream, const wxString& location,
|
|
|
|
const wxString& mimetype, const wxString& anchor,
|
2008-10-04 16:49:51 -04:00
|
|
|
wxDateTime modif);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Detaches the stream from the wxFSFile object. That is, the
|
2008-05-10 05:44:43 -04:00
|
|
|
stream obtained with GetStream() will continue its existance
|
|
|
|
after the wxFSFile object is deleted.
|
|
|
|
|
|
|
|
You will have to delete the stream yourself.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-10-28 11:36:26 -04:00
|
|
|
wxInputStream* DetachStream();
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns anchor (if present). The term of @b anchor can be easily
|
|
|
|
explained using few examples:
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-05-10 05:44:43 -04:00
|
|
|
@verbatim
|
|
|
|
index.htm#anchor // 'anchor' is anchor
|
|
|
|
index/wx001.htm // NO anchor here!
|
|
|
|
archive/main.zip#zip:index.htm#global // 'global'
|
|
|
|
archive/main.zip#zip:index.htm // NO anchor here!
|
|
|
|
@endverbatim
|
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
Usually an anchor is presented only if the MIME type is 'text/html'.
|
2008-05-10 05:44:43 -04:00
|
|
|
But it may have some meaning with other files; for example myanim.avi#200
|
|
|
|
may refer to position in animation or reality.wrl#MyView may refer
|
|
|
|
to a predefined view in VRML.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-05-10 05:44:43 -04:00
|
|
|
const wxString& GetAnchor() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-03-08 09:43:31 -05:00
|
|
|
Returns full location of the file, including path and protocol.
|
2008-05-10 05:44:43 -04:00
|
|
|
|
|
|
|
Examples:
|
|
|
|
@verbatim
|
|
|
|
http://www.wxwidgets.org
|
|
|
|
http://www.ms.mff.cuni.cz/~vsla8348/wxhtml/archive.zip#zip:info.txt
|
|
|
|
file:/home/vasek/index.htm
|
|
|
|
relative-file.htm
|
|
|
|
@endverbatim
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-05-10 05:44:43 -04:00
|
|
|
const wxString& GetLocation() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-05-10 05:44:43 -04:00
|
|
|
Returns the MIME type of the content of this file.
|
|
|
|
|
|
|
|
It is either extension-based (see wxMimeTypesManager) or extracted from
|
2008-03-08 08:52:38 -05:00
|
|
|
HTTP protocol Content-Type header.
|
|
|
|
*/
|
2008-05-10 05:44:43 -04:00
|
|
|
const wxString& GetMimeType() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns time when this file was modified.
|
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
wxDateTime GetModificationTime() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-05-10 05:44:43 -04:00
|
|
|
Returns pointer to the stream.
|
|
|
|
|
|
|
|
You can use the returned stream to directly access data.
|
|
|
|
You may suppose that the stream provide Seek and GetSize functionality
|
2008-03-08 08:52:38 -05:00
|
|
|
(even in the case of the HTTP protocol which doesn't provide
|
|
|
|
this by default. wxHtml uses local cache to work around
|
|
|
|
this and to speed up the connection).
|
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
wxInputStream* GetStream() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2008-03-10 11:24:38 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
/**
|
|
|
|
@class wxFileSystemHandler
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-05-10 05:44:43 -04:00
|
|
|
Classes derived from wxFileSystemHandler are used to access virtual file systems.
|
|
|
|
|
|
|
|
Its public interface consists of two methods: wxFileSystemHandler::CanOpen
|
2008-03-08 09:43:31 -05:00
|
|
|
and wxFileSystemHandler::OpenFile.
|
2008-05-10 05:44:43 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
It provides additional protected methods to simplify the process
|
2008-05-10 05:44:43 -04:00
|
|
|
of opening the file: GetProtocol(), GetLeftLocation(), GetRightLocation(),
|
|
|
|
GetAnchor(), GetMimeTypeFromExt().
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-05-10 05:44:43 -04:00
|
|
|
Please have a look at overview (see wxFileSystem) if you don't know how locations
|
2008-03-08 08:52:38 -05:00
|
|
|
are constructed.
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-05-10 05:44:43 -04:00
|
|
|
Also consult the @ref overview_fs_wxhtmlfs "list of available handlers".
|
|
|
|
|
|
|
|
Note that the handlers are shared by all instances of wxFileSystem.
|
|
|
|
|
|
|
|
@remarks
|
|
|
|
wxHTML library provides handlers for local files and HTTP or FTP protocol.
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-05-10 05:44:43 -04:00
|
|
|
@note
|
|
|
|
The location parameter passed to OpenFile() or CanOpen() methods is always an
|
|
|
|
absolute path. You don't need to check the FS's current path.
|
|
|
|
|
|
|
|
@beginWxPerlOnly
|
|
|
|
In wxPerl, you need to derive your file system handler class
|
2008-03-08 08:52:38 -05:00
|
|
|
from Wx::PlFileSystemHandler.
|
2008-05-10 05:44:43 -04:00
|
|
|
@endWxPerlOnly
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@library{wxbase}
|
|
|
|
@category{vfs}
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-05-10 05:44:43 -04:00
|
|
|
@see wxFileSystem, wxFSFile, @ref overview_fs
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
class wxFileSystemHandler : public wxObject
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
Constructor.
|
|
|
|
*/
|
|
|
|
wxFileSystemHandler();
|
|
|
|
|
|
|
|
/**
|
|
|
|
Returns @true if the handler is able to open this file. This function doesn't
|
|
|
|
check whether the file exists or not, it only checks if it knows the protocol.
|
|
|
|
Example:
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-05-10 05:44:43 -04:00
|
|
|
@code
|
|
|
|
bool MyHand::CanOpen(const wxString& location)
|
|
|
|
{
|
|
|
|
return (GetProtocol(location) == "http");
|
|
|
|
}
|
|
|
|
@endcode
|
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
Must be overridden in derived handlers.
|
|
|
|
*/
|
2008-10-13 09:24:43 -04:00
|
|
|
virtual bool CanOpen(const wxString& location) = 0;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-05-10 05:44:43 -04:00
|
|
|
Works like ::wxFindFirstFile().
|
|
|
|
|
|
|
|
Returns the name of the first filename (within filesystem's current path)
|
|
|
|
that matches @e wildcard. @a flags may be one of wxFILE (only files),
|
|
|
|
wxDIR (only directories) or 0 (both).
|
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
This method is only called if CanOpen() returns @true.
|
|
|
|
*/
|
|
|
|
virtual wxString FindFirst(const wxString& wildcard,
|
|
|
|
int flags = 0);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Returns next filename that matches parameters passed to wxFileSystem::FindFirst.
|
2008-05-10 05:44:43 -04:00
|
|
|
|
|
|
|
This method is only called if CanOpen() returns @true and FindFirst()
|
2008-03-08 08:52:38 -05:00
|
|
|
returned a non-empty string.
|
|
|
|
*/
|
|
|
|
virtual wxString FindNext();
|
|
|
|
|
2009-01-10 18:44:44 -05:00
|
|
|
/**
|
|
|
|
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
|
|
|
|
GetMimeTypeFromExt("index.htm") == "text/html"
|
|
|
|
@endcode
|
|
|
|
*/
|
|
|
|
static wxString GetMimeTypeFromExt(const wxString& 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.
|
|
|
|
*/
|
|
|
|
virtual wxFSFile* OpenFile(wxFileSystem& fs, const wxString& location) = 0;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
/**
|
|
|
|
Returns the anchor if present in the location.
|
2008-05-10 05:44:43 -04:00
|
|
|
See wxFSFile::GetAnchor for details.
|
|
|
|
|
|
|
|
Example:
|
|
|
|
@code
|
|
|
|
GetAnchor("index.htm#chapter2") == "chapter2"
|
|
|
|
@endcode
|
|
|
|
|
2008-04-01 09:59:28 -04:00
|
|
|
@note the anchor is NOT part of the left location.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-10-13 07:09:56 -04:00
|
|
|
static wxString GetAnchor(const wxString& location);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-03-08 09:43:31 -05:00
|
|
|
Returns the left location string extracted from @e location.
|
2008-05-10 05:44:43 -04:00
|
|
|
|
|
|
|
Example:
|
|
|
|
@code
|
|
|
|
GetLeftLocation("file:myzipfile.zip#zip:index.htm") == "file:myzipfile.zip"
|
|
|
|
@endcode
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-10-13 07:09:56 -04:00
|
|
|
static wxString GetLeftLocation(const wxString& location);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-05-10 05:44:43 -04:00
|
|
|
Returns the protocol string extracted from @a location.
|
|
|
|
|
|
|
|
Example:
|
|
|
|
@code
|
|
|
|
GetProtocol("file:myzipfile.zip#zip:index.htm") == "zip"
|
|
|
|
@endcode
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-10-13 07:09:56 -04:00
|
|
|
static wxString GetProtocol(const wxString& location);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-05-10 05:44:43 -04:00
|
|
|
Returns the right location string extracted from @a location.
|
|
|
|
|
|
|
|
Example:
|
|
|
|
@code
|
|
|
|
GetRightLocation("file:myzipfile.zip#zip:index.htm") == "index.htm"
|
|
|
|
@endcode
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-10-13 07:09:56 -04:00
|
|
|
static wxString GetRightLocation(const wxString& location);
|
2008-03-08 08:52:38 -05:00
|
|
|
};
|
2008-03-10 11:24:38 -04:00
|
|
|
|