Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

mortic::IFileManager Class Reference

Manages and opens files. More...

Inheritance diagram for mortic::IFileManager:

mortic::IObject List of all members.

Public Member Functions

 IFileManager (IRoot *root)
 Constructor.
virtual ~IFileManager ()
 Destructor.
virtual void mount (IMount *mnt, std::string path)=0
 Mounts a mountable.
virtual void unmount (std::string path)=0
 Unmounts a mountable.
virtual void mountReal (std::string real, std::string path)=0
 Mounts a real path.
virtual void mountMirror (std::string from, std::string to)=0
 Mirrors one path to another.
virtual IFileopen (std::string filename, bool write=false, bool append=false)=0
 Opens a file.
virtual bool exists (std::string filename)=0
 Checks if a file / directory exists.
virtual bool isDirectory (std::string filename)=0
 Checks to see if the path given is a directory.
virtual std::vector< std::string > listDir (std::string path)=0
 Returns a list of files/directories in the directory.
virtual unsigned int size (std::string filename)=0
 Returns the size of a file.

Detailed Description

Manages and opens files.

This class lets you open and close files. It also will include a virtual file system, much like linux, that will let you mount directories and websites, memory, etc. on paths inside mortic. For example, "/config/config.xml" could map to "~/.example_game/config.xml", and "/update/updates.txt" could map to "http://www.example_game.net/updater/updates.txt". This allows for a lot of flexibility.

See also:
IFile

IMount

Definition at line 107 of file IFileManager.h.


Constructor & Destructor Documentation

mortic::IFileManager::IFileManager IRoot root  )  [inline]
 

Constructor.

Definition at line 111 of file IFileManager.h.

virtual mortic::IFileManager::~IFileManager  )  [inline, virtual]
 

Destructor.

Definition at line 114 of file IFileManager.h.


Member Function Documentation

virtual bool mortic::IFileManager::exists std::string  filename  )  [pure virtual]
 

Checks if a file / directory exists.

Checks to see if the given VFS path exists.

  • filename - the file to check.
    Returns:
    True if the file exists

virtual bool mortic::IFileManager::isDirectory std::string  filename  )  [pure virtual]
 

Checks to see if the path given is a directory.

This is for checking the directoryness of a file. Kinda useful!

  • filename - the file to check.
    Returns:
    True if the file is a directory

virtual std::vector<std::string> mortic::IFileManager::listDir std::string  path  )  [pure virtual]
 

Returns a list of files/directories in the directory.

This is to check what files there are in the directory given.

  • path - the directory to list
    Returns:
    a vector of filenames/dirnames in the path

virtual void mortic::IFileManager::mount IMount mnt,
std::string  path
[pure virtual]
 

Mounts a mountable.

This mounts an IMount class at the given path. This class must be made with new, as it will be deleted upon unmount.

virtual void mortic::IFileManager::mountMirror std::string  from,
std::string  to
[pure virtual]
 

Mirrors one path to another.

This function mounts one place in the VFS on another.

  • from - the path to mount
  • to - the path to mount on

virtual void mortic::IFileManager::mountReal std::string  real,
std::string  path
[pure virtual]
 

Mounts a real path.

This function maps a real harddisk path to a VFS path.

  • real - the real path to mount
  • path - the path to mount it on
    See also:
    mount()

virtual IFile* mortic::IFileManager::open std::string  filename,
bool  write = false,
bool  append = false
[pure virtual]
 

Opens a file.

Opens the file at the VFS path given.

  • filename - the VFS path
  • write - open the file in write mode?
  • append - open the file at the end?
    Returns:
    the opened IFile
    See also:
    IFile

virtual unsigned int mortic::IFileManager::size std::string  filename  )  [pure virtual]
 

Returns the size of a file.

Directories return 0.

  • filename - the file to get the size of
    Returns:
    the file size in bytes/charecters

virtual void mortic::IFileManager::unmount std::string  path  )  [pure virtual]
 

Unmounts a mountable.

This unmounts the mountable at path, and then deletes it.


Generated on Sat Dec 30 21:21:59 2006 for mortic by  doxygen 1.4.4