#include <FileSystem.hpp>
Public Types | |
typedef std::list < DirectoryEntry > | DirectoryEntryList |
List of directory entries. | |
typedef std::list < DirectoryEntry > ::iterator | DirectoryEntryListIterator |
Iterator for lists of directory entries. | |
typedef std::list < DirectoryEntry > ::const_iterator | DirectoryEntryListConstIterator |
Constant iterator for lists of directory entries. | |
Public Member Functions | |
FileSystem (Logger *pLogger) | |
Constructor. | |
~FileSystem () | |
Destructor. | |
bool | mount (const std::string &location, const bool recursive) |
Mount a directory or an archive. | |
void | unmount (const std::string &location) |
Unmount a directory or an archive. | |
const DirectoryEntryList & | getLocation (const std::string &location) const |
Get the content of a location. | |
const bool | find (const std::string &location, const std::string &name, const bool searchRelativePath, const bool matchWithoutExtension, DirectoryEntry &entry) const |
Find a directory entry in a mounted location. | |
const bool | find (const std::string &name, const bool searchRelativePath, const bool matchWithoutExtension, DirectoryEntry &entry) const |
Find a directory entry in all the mounted locations. | |
Static Public Member Functions | |
static const char * | getDynamicLibraryExtension () |
Get the extension of a dynamic library on this platform. | |
static const unsigned int | getDynamicLibraryExtensionLength () |
Get the length of the extension of a dynamic library on this platform. | |
Private Member Functions | |
bool | readDirectoryContent (const std::string &location, const std::string &relativeLocation, const bool recursive, DirectoryEntryList &content) |
Get the content of a directory. | |
Private Attributes | |
Logger * | m_pLogger |
Pointer to the logger to be used. | |
std::map < std::string, DirectoryEntryList > | m_mapMountedDirectories |
Content of the mounted directories. | |
Static Private Attributes | |
static const char | sm_dynamicLibraryExtension [] |
Extension of a dynamic library on this platform. | |
static const unsigned int | sm_dynamicLibraryExtensionLength |
Length of the extension of a dynamic library on this platform. | |
Classes | |
struct | DirectoryEntry |
Directory entry i.e. a file or a sub-directory. More... |
typedef std::list<DirectoryEntry> syBR::Core::FileSystem::DirectoryEntryList |
List of directory entries.
typedef std::list<DirectoryEntry>::iterator syBR::Core::FileSystem::DirectoryEntryListIterator |
Iterator for lists of directory entries.
typedef std::list<DirectoryEntry>::const_iterator syBR::Core::FileSystem::DirectoryEntryListConstIterator |
Constant iterator for lists of directory entries.
syBR::Core::FileSystem::FileSystem | ( | Logger * | pLogger | ) |
Constructor.
pLogger | Pointer to the instance of the logger to use |
syBR::Core::FileSystem::~FileSystem | ( | ) |
Destructor.
bool syBR::Core::FileSystem::mount | ( | const std::string & | location, | |
const bool | recursive | |||
) |
Mount a directory or an archive.
Mount and read the structure of a location. The following location types are currently supported:
location | Location to be mounted (directories must end by "/") | |
recursive | One of these:
|
void syBR::Core::FileSystem::unmount | ( | const std::string & | location | ) |
Unmount a directory or an archive.
Unmount a location which has been previously mounted by mount()
location | Location to be unmounted |
const FileSystem::DirectoryEntryList & syBR::Core::FileSystem::getLocation | ( | const std::string & | location | ) | const |
Get the content of a location.
location | Location to be retrieved |
const bool syBR::Core::FileSystem::find | ( | const std::string & | location, | |
const std::string & | name, | |||
const bool | searchRelativePath, | |||
const bool | matchWithoutExtension, | |||
DirectoryEntry & | entry | |||
) | const |
Find a directory entry in a mounted location.
location | Location to be searched | |
name | Name of the file to search | |
searchRelativePath | One of these:
| |
matchWithoutExtension | One of these:
| |
entry | Resulting directory entry |
const bool syBR::Core::FileSystem::find | ( | const std::string & | name, | |
const bool | searchRelativePath, | |||
const bool | matchWithoutExtension, | |||
DirectoryEntry & | entry | |||
) | const |
Find a directory entry in all the mounted locations.
name | Name of the file to search | |
searchRelativePath | One of these:
| |
matchWithoutExtension | One of these:
| |
entry | Resulting directory entry |
const char * syBR::Core::FileSystem::getDynamicLibraryExtension | ( | ) | [static] |
Get the extension of a dynamic library on this platform.
const unsigned int syBR::Core::FileSystem::getDynamicLibraryExtensionLength | ( | ) | [static] |
Get the length of the extension of a dynamic library on this platform.
bool syBR::Core::FileSystem::readDirectoryContent | ( | const std::string & | location, | |
const std::string & | relativeLocation, | |||
const bool | recursive, | |||
DirectoryEntryList & | content | |||
) | [private] |
Get the content of a directory.
location | Location of the directory which content must be retrieved | |
relativeLocation | Location of the directory which content must be retrieved, relative to the mount directory | |
content | List to be filled with the files and subdirectories of the location | |
recursive | One of these:
|
const char syBR::Core::FileSystem::sm_dynamicLibraryExtension[] [static, private] |
Extension of a dynamic library on this platform.
const unsigned int syBR::Core::FileSystem::sm_dynamicLibraryExtensionLength [static, private] |
Length of the extension of a dynamic library on this platform.
Logger* syBR::Core::FileSystem::m_pLogger [private] |
Pointer to the logger to be used.
std::map<std::string, DirectoryEntryList> syBR::Core::FileSystem::m_mapMountedDirectories [private] |
Content of the mounted directories.
Copyright © 2008 by Sebastien Frippiat
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 License.
Last modified Tue Dec 30 17:57:33 2008