Virtual File System (VFS). More...

#include <file_system.h>

Public Member Functions

 FileSystem ()
 Constructs a file system. More...
 
 FileSystem (FileSystemProvider *provider)
 Constructs a FileSystem. More...
 
 FileSystem (const std::string &path, bool is_zip_file=false)
 Constructs a FileSystem. More...
 
 ~FileSystem ()
 
DirectoryListing get_directory_listing (const std::string &path_rel)
 Return directory listing for path. More...
 
std::string get_identifier () const
 Get the identifier of this file source. More...
 
std::string get_path () const
 Returns a path to the file source for this file system. More...
 
FileSystemProviderget_provider ()
 Returns the file source for this file system. More...
 
bool has_directory (const std::string &directory)
 Return true if the root of the filesystem contains the specified directory. More...
 
bool has_file (const std::string &filename)
 Return true if the root of the filesystem contains the specified file. More...
 
bool is_mount (const std::string &mount_point)
 Returns true if a path is a mount point. More...
 
bool is_null () const
 Returns true if the file system is null. More...
 
void mount (const std::string &mount_point, FileSystem fs)
 Mounts a file system at mount point. More...
 
void mount (const std::string &mount_point, const std::string &path, bool is_zip_file)
 Mounts a file system at mount point. More...
 
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. More...
 
void unmount (const std::string &mount_point)
 Unmount a file system. More...
 

Detailed Description

Virtual File System (VFS).

Constructor & Destructor Documentation

clan::FileSystem::FileSystem ( )

Constructs a file system.

clan::FileSystem::FileSystem ( FileSystemProvider provider)

Constructs a FileSystem.

Parameters
provider= Virtual File Source
clan::FileSystem::FileSystem ( const std::string path,
bool  is_zip_file = false 
)

Constructs a FileSystem.

Parameters
path= String
is_zip_file= bool
clan::FileSystem::~FileSystem ( )

Member Function Documentation

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

Returns
the identifier
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.

bool clan::FileSystem::is_null ( ) const
inline

Returns true if the file system is null.

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

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

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

Returns
The IODevice
void clan::FileSystem::unmount ( const std::string mount_point)

Unmount a file system.

param: mount_point = The mount point to unmount


The documentation for this class was generated from the following file: