Virtual File System (VFS). More...
#include <file_system.h>
Public Member Functions | |
FileSystem () | |
Constructs a file system. | |
FileSystem (const std::string &path, bool is_zip_file=false) | |
Constructs a FileSystem. | |
FileSystem (FileSystemProvider *provider) | |
Constructs a FileSystem. | |
~FileSystem () | |
DirectoryListing | get_directory_listing (const std::string &path_rel) |
Return directory listing for path. | |
std::string | get_identifier () const |
Get the identifier of this file source. | |
std::string | get_path () const |
Returns a path to the file source for this file system. | |
FileSystemProvider * | get_provider () |
Returns the file source for this file system. | |
bool | has_directory (const std::string &directory) |
Return true if the root of the filesystem contains the specified directory. | |
bool | has_file (const std::string &filename) |
Return true if the root of the filesystem contains the specified file. | |
bool | is_mount (const std::string &mount_point) |
Returns true if a path is a mount point. | |
bool | is_null () const |
Returns true if the file system is null. | |
void | mount (const std::string &mount_point, const std::string &path, bool is_zip_file) |
Mounts a file system at mount point. | |
void | mount (const std::string &mount_point, FileSystem fs) |
Mounts a file system at mount point. | |
IODevice | open_file (const std::string &filename, File::OpenMode mode=File::open_existing, unsigned int access=File::access_read, unsigned int share=File::share_all, unsigned int flags=0) const |
Opens a file. | |
void | unmount (const std::string &mount_point) |
Unmount a file system. | |
clan::FileSystem::FileSystem | ( | ) |
Constructs a file system.
Referenced by mount().
clan::FileSystem::FileSystem | ( | FileSystemProvider * | provider | ) |
Constructs a FileSystem.
provider | = Virtual File Source |
clan::FileSystem::FileSystem | ( | const std::string & | path, |
bool | is_zip_file = false ) |
clan::FileSystem::~FileSystem | ( | ) |
DirectoryListing clan::FileSystem::get_directory_listing | ( | const std::string & | path_rel | ) |
Return directory listing for path.
std::string clan::FileSystem::get_identifier | ( | ) | const |
Get the identifier of this file source.
The exact format of this identifier depends on the implementation of the underlying filesystem and mounts
std::string clan::FileSystem::get_path | ( | ) | const |
Returns a path to the file source for this file system.
FileSystemProvider * clan::FileSystem::get_provider | ( | ) |
Returns the file source for this file system.
bool clan::FileSystem::has_directory | ( | const std::string & | directory | ) |
Return true if the root of the filesystem contains the specified directory.
bool clan::FileSystem::has_file | ( | const std::string & | filename | ) |
Return true if the root of the filesystem contains the specified file.
bool clan::FileSystem::is_mount | ( | const std::string & | mount_point | ) |
Returns true if a path is a mount point.
|
inline |
Returns true if the file system is null.
void clan::FileSystem::mount | ( | const std::string & | mount_point, |
const std::string & | path, | ||
bool | is_zip_file ) |
Mounts a file system at mount point.
Filenames starting with "mount_point" at the start will be replaced by the path specified by "path" (ie the the base_path is ignored) param: mount_point = Mount alias name to use param: path = Path which "mount_point" should point to param: is_zip_file = false, create as a FileSystemProvider_File, else create as a FileSystemProvider_Zip
References clan::path.
void clan::FileSystem::mount | ( | const std::string & | mount_point, |
FileSystem | fs ) |
Mounts a file system at mount point.
This is only available if FileSystem was set Filenames starting with "mount_point" at the start will be replaced by the filesystem specified by "fs" (ie the the base_path is ignored) For example: FileSystem new_vfs(new MyFileSource("Hello")); vfs.mount("ABC", new_vfs); param: mount_point = Mount alias name to use param: fs = Filesystem to use
References FileSystem().
IODevice clan::FileSystem::open_file | ( | const std::string & | filename, |
File::OpenMode | mode = File::open_existing, | ||
unsigned int | access = File::access_read, | ||
unsigned int | share = File::share_all, | ||
unsigned int | flags = 0 ) const |
Opens a file.
param: mode = File::OpenMode modes param: access = File::AccessFlags flags param: share = File::ShareFlags flags param: flags = File::Flags flags
References clan::File::access_read, clan::File::open_existing, and clan::File::share_all.
void clan::FileSystem::unmount | ( | const std::string & | mount_point | ) |
Unmount a file system.
param: mount_point = The mount point to unmount