Public Types | |
typedef std::vector< FileInfo > | FileInfoList |
Vector containing file info information. | |
typedef SharedPtr< FileInfoList > | FileInfoListPtr |
Public Member Functions | |
IFileSystem () | |
Initalize the file system. | |
virtual | ~IFileSystem () |
Release used memory and force all files to close. | |
virtual bool | exists (const std::string &fileName)=0 |
virtual bool | isCaseSensitive () const=0 |
virtual FileInfoListPtr | listFiles (bool recursive=true)=0 |
virtual FileInfoListPtr | findFiles (const std::string &pattern, bool recursive=true)=0 |
virtual Result | initialize ()=0 |
virtual Result | deinitialize ()=0 |
virtual SharedPtr< FileStream > | open (const std::string &filename, PropertyList *params=NULL)=0 |
virtual const std::string & | getType () |
virtual Result | set (uint32 param, const std::string &value) |
virtual Result | set (const std::string &name, const std::string &value) |
Protected Attributes | |
std::string | mType |
Unique type name for this file system. | |
PropertyList | mParameter |
Map containing the parameters and their values. | |
Data Structures | |
struct | FileInfo |
Each file system has it's own handling routines and access controls. So this class provide an interface for abstract using of such file systems. Modules derived from this interface can be registered by the file system manager so they are used to access files.
Each file system does have a type. A type is unique for each kind of fs. The name of the type is used to allow user to specify directly the fs he want to use to access the files. So calling "file:/.." force a local file system to be used and "http:/..." will access the files through htpp-interface. Accessing the files without any fs specified force the manager to look for the file under each registered file system.
User can also specify parameters to the file system by accessing the files. The parameters are separated through ':' and are given in the file name. You can also specify parameters by setting them directly. The parameters are always states. i.e. if parameter 1 is set to the value A, so this value will be used until it is changed. Parameters specified in the filename are local parameters used only for the current access and they overload the global parameters of the file system.
Definition at line 51 of file IFileSystem.h.
virtual bool nrEngine::IFileSystem::exists | ( | const std::string & | fileName | ) | [pure virtual] |
Check whenever such a file exists in that file system.
fileName |
virtual bool nrEngine::IFileSystem::isCaseSensitive | ( | ) | const [pure virtual] |
Returns true if this filesystem is case sensitive by matching the filenames
virtual FileInfoListPtr nrEngine::IFileSystem::listFiles | ( | bool | recursive = true |
) | [pure virtual] |
List all files in the archive. You get the file info list containing information about each file in the archive
recursive | if true so search for the files recursively |
virtual FileInfoListPtr nrEngine::IFileSystem::findFiles | ( | const std::string & | pattern, | |
bool | recursive = true | |||
) | [pure virtual] |
Find a file by the given pattern. Wildcard '*' is allowed.
pattern | filename pattern including wildcards | |
recursive | if true so search recursively |
virtual Result nrEngine::IFileSystem::initialize | ( | ) | [pure virtual] |
Initialize the file system.
virtual Result nrEngine::IFileSystem::deinitialize | ( | ) | [pure virtual] |
Release the file system and close all opened files.
virtual SharedPtr<FileStream> nrEngine::IFileSystem::open | ( | const std::string & | filename, | |
PropertyList * | params = NULL | |||
) | [pure virtual] |
Open a file by the given filename. The method returns a smart pointer on the file stream. So as soon as the pointer is not used anymore the file will be closed automaticaly behaving to the file stream.
filename | Name of the file (without parameters) | |
params | Local parameters for this access |
virtual const std::string& nrEngine::IFileSystem::getType | ( | ) | [virtual] |
File system type. This type is used to allow users to access directly to the files on this filesystem.
Definition at line 138 of file IFileSystem.h.
Set global parameters for this file system
param | Parameter number | |
value | Value of the parameter |
Definition at line 34 of file IFileSystem.cpp.
References mParameter, nrEngine::OK, and nrEngine::VFS_NO_PARAMETER.
Result nrEngine::IFileSystem::set | ( | const std::string & | name, | |
const std::string & | value | |||
) | [virtual] |
This method allows to setup the parameters by their names. The file system modules should specifiy somehow the parameter names which can be used to setup them
name | Name of the paramter (i.e. by ftp access "username") | |
value | Value of the parameter |
Definition at line 46 of file IFileSystem.cpp.
References nrEngine::OK.