clan::FileSystem Class Reference - ClanLib SDK
Description: clan::FileSystem Class Reference

Public Member Functions | List of all members
clan::FileSystem Class Reference
clanCore I/O Data

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.

## Detailed Description

Virtual File System (VFS).

## Constructor & Destructor Documentation

## ◆ FileSystem() [1/3]

clan::FileSystem::FileSystem | ( |  | ) |

Constructs a file system.

## ◆ FileSystem() [2/3]

clan::FileSystem::FileSystem | ( | FileSystemProvider * | provider | ) |

Constructs a FileSystem.

Parameters

  provider | = Virtual File Source

## ◆ FileSystem() [3/3]

clan::FileSystem::FileSystem | ( | const std::string & | path,
|  | bool | is_zip_file = false )

Constructs a FileSystem.

Parameters

  path | = String
  is_zip_file | = bool

## ◆ ~FileSystem()

clan::FileSystem::~FileSystem | ( |  | ) |

## Member Function Documentation

## ◆ get_directory_listing()

DirectoryListing clan::FileSystem::get_directory_listing | ( | const std::string & | path_rel | ) |

Return directory listing for path.

## ◆ get_identifier()

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

## ◆ get_path()

std::string clan::FileSystem::get_path | ( |  | ) | const

Returns a path to the file source for this file system.

## ◆ get_provider()

FileSystemProvider * clan::FileSystem::get_provider | ( |  | ) |

Returns the file source for this file system.

## ◆ has_directory()

bool clan::FileSystem::has_directory | ( | const std::string & | directory | ) |

Return true if the root of the filesystem contains the specified directory.

## ◆ has_file()

bool clan::FileSystem::has_file | ( | const std::string & | filename | ) |

Return true if the root of the filesystem contains the specified file.

## ◆ is_mount()

bool clan::FileSystem::is_mount | ( | const std::string & | mount_point | ) |

Returns true if a path is a mount point.

## ◆ is_null()

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

Returns true if the file system is null.

## ◆ mount() [1/2]

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

## ◆ mount() [2/2]

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

## ◆ open_file()

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

## ◆ unmount()

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:

- file_system.h