ClanLib  2.3.7
List of all members
CL_VirtualDirectory Class Reference

Virtual File System (VFS) directory. More...

#include <virtual_directory.h>

Public Member Functions

Construction
 CL_VirtualDirectory ()
 Constructs a virtual directory. More...
 
 CL_VirtualDirectory (const CL_VirtualFileSystem &file_system, const CL_String &base_path)
 Constructs a virtual directory. More...
 
 ~CL_VirtualDirectory ()
 
Attributes
CL_VirtualFileSystem get_file_system ()
 Returns the file system the directory belongs to. More...
 
const CL_Stringget_path () const
 Returns the absolute path of the virtual directory. More...
 
CL_VirtualDirectoryListing get_directory_listing ()
 List contents of directory. More...
 
CL_String get_identifier () const
 Get the identifier of this directory. More...
 
Operations
CL_VirtualDirectory open_directory (const CL_String &path)
 Open a directory relatively to this one. More...
 
CL_IODevice open_file (const CL_String &filename, CL_File::OpenMode mode=CL_File::open_existing, unsigned int access=CL_File::access_read|CL_File::access_write, unsigned int share=CL_File::share_all, unsigned int flags=0)
 Open a file relatively to this directory. More...
 
CL_IODevice open_file_read (const CL_String &filename) const
 Open a file read only, avoiding potential "const" problems. More...
 
CL_String make_path_absolute (const CL_String &relative_path) const
 Convert a relative path to an absolute one. More...
 
CL_String make_path_relative (const CL_String &absolute_path) const
 Convert an absolute path to a relative one. More...
 
void mount (const CL_String &mount_point, CL_VirtualFileSystem &fs)
 Mount a file system. More...
 
void mount (const CL_String &mount_point, const CL_String &path)
 Mount a file system. More...
 
void unmount (const CL_String &mount_point)
 Unmount a file system. More...
 

Detailed Description

Virtual File System (VFS) directory.

Constructor & Destructor Documentation

CL_VirtualDirectory::CL_VirtualDirectory ( )

Constructs a virtual directory.

File system is treated as CL_File The base path is set the current working directory

CL_VirtualDirectory::CL_VirtualDirectory ( const CL_VirtualFileSystem file_system,
const CL_String base_path 
)

Constructs a virtual directory.

param: file_system = File system to use param: base_path = Base path of the directory

CL_VirtualDirectory::~CL_VirtualDirectory ( )

Member Function Documentation

CL_VirtualDirectoryListing CL_VirtualDirectory::get_directory_listing ( )

List contents of directory.

This is only available if CL_VirtualFileSystem was set. If not, use CL_DirectoryScanner() instead.

CL_VirtualFileSystem CL_VirtualDirectory::get_file_system ( )

Returns the file system the directory belongs to.

Returns
The Virtual File System. (use is_null() to check if it contains a file system)
CL_String CL_VirtualDirectory::get_identifier ( ) const

Get the identifier of this directory.

The exact format of this identifier depends on the implementation of the underlying filesystem and mounts

Returns
the identifier
const CL_String& CL_VirtualDirectory::get_path ( ) const

Returns the absolute path of the virtual directory.

If CL_VirtualFileSystem was not set, it is is a full path. Else, it is the path specified to the constructor

Returns
The path
CL_String CL_VirtualDirectory::make_path_absolute ( const CL_String relative_path) const

Convert a relative path to an absolute one.

If CL_VirtualFileSystem was not set, this function uses CL_PathHelp::path_type_file If CL_VirtualFileSystem is set, this function uses CL_PathHelp::path_type_virtual param: relative_path = The relative path

Returns
The absolute string
CL_String CL_VirtualDirectory::make_path_relative ( const CL_String absolute_path) const

Convert an absolute path to a relative one.

If CL_VirtualFileSystem was not set, this function uses CL_PathHelp::path_type_file If CL_VirtualFileSystem is set, this function uses CL_PathHelp::path_type_virtual param: absolute_path = The absolute path

Returns
The relative string
void CL_VirtualDirectory::mount ( const CL_String mount_point,
CL_VirtualFileSystem fs 
)

Mount a file system.

This is only available if CL_VirtualFileSystem 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: CL_VirtualFileSystem new_vfs(new MyFileSource("Hello")); dir.mount("ABC", new_vfs); param: mount_point = Mount alias name to use param: fs = Filesystem to use

void CL_VirtualDirectory::mount ( const CL_String mount_point,
const CL_String path 
)

Mount a file system.

This is only available if CL_VirtualFileSystem was set 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

CL_VirtualDirectory CL_VirtualDirectory::open_directory ( const CL_String path)

Open a directory relatively to this one.

This function uses make_path_absolute() path: Relative path to use

CL_IODevice CL_VirtualDirectory::open_file ( const CL_String filename,
CL_File::OpenMode  mode = CL_File::open_existing,
unsigned int  access = CL_File::access_read|CL_File::access_write,
unsigned int  share = CL_File::share_all,
unsigned int  flags = 0 
)

Open a file relatively to this directory.

This function uses make_path_absolute() A CL_Exception is thrown if the file could not be opened param: filename = File to open (may be a path) param: mode = CL_File::OpenMode modes param: access = CL_File::AccessFlags flags param: share = CL_File::ShareFlags flags param: flags = CL_File::Flags flags

Returns
The file
CL_IODevice CL_VirtualDirectory::open_file_read ( const CL_String filename) const

Open a file read only, avoiding potential "const" problems.

void CL_VirtualDirectory::unmount ( const CL_String mount_point)

Unmount a file system.

This is only available if CL_VirtualFileSystem was set param: mount_point = The mount point to unmount


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