A generic unix-style file-system which maps paths to files and directories. Provides average O(log n) find and insert methods. More...
#include <fs_filesystem.h>
Data Structures | |
class | Entry |
class | Path |
Public Types | |
typedef Entries::iterator | iterator |
typedef Entries::value_type | value_type |
typedef Entry | entry_type |
Public Member Functions | |
iterator | begin () |
iterator | end () |
entry_type & | operator[] (const Path &path) |
Returns the file at path . Creates all directories below path if they do not exist. O(log n) on average. | |
iterator | find (const Path &path) |
Returns the file at path or end() if not found. | |
iterator | begin (const std::string &root) |
template<typename visitor_type > | |
void | traverse (visitor_type visitor, const std::string &root) |
Performs a depth-first traversal of the file-system subtree rooted at root . Traverses the entire tree if root is "". Calls visitor.file() with the path to each file relative to the filesystem root. Calls visitor.directory() with the path to each directory relative to the filesystem root. | |
Private Types | |
typedef std::map< Path, Entry > | Entries |
Private Attributes | |
Entries | m_entries |
A generic unix-style file-system which maps paths to files and directories. Provides average O(log n) find and insert methods.
file_type | The data type which represents a file. |
Definition at line 60 of file fs_filesystem.h.
typedef std::map<Path, Entry> GenericFileSystem< file_type >::Entries [private] |
Definition at line 115 of file fs_filesystem.h.
typedef Entry GenericFileSystem< file_type >::entry_type |
Definition at line 121 of file fs_filesystem.h.
typedef Entries::iterator GenericFileSystem< file_type >::iterator |
Definition at line 119 of file fs_filesystem.h.
typedef Entries::value_type GenericFileSystem< file_type >::value_type |
Definition at line 120 of file fs_filesystem.h.
iterator GenericFileSystem< file_type >::begin | ( | const std::string & | root | ) | [inline] |
Definition at line 159 of file fs_filesystem.h.
iterator GenericFileSystem< file_type >::begin | ( | ) | [inline] |
Definition at line 123 of file fs_filesystem.h.
Referenced by GenericFileSystem< ZipRecord >::traverse().
iterator GenericFileSystem< file_type >::end | ( | ) | [inline] |
Definition at line 127 of file fs_filesystem.h.
Referenced by GenericFileSystem< ZipRecord >::operator[](), and GenericFileSystem< ZipRecord >::traverse().
iterator GenericFileSystem< file_type >::find | ( | const Path & | path | ) | [inline] |
Returns the file at path
or end() if not found.
Definition at line 154 of file fs_filesystem.h.
entry_type& GenericFileSystem< file_type >::operator[] | ( | const Path & | path | ) | [inline] |
Returns the file at path
. Creates all directories below path
if they do not exist. O(log n) on average.
Definition at line 135 of file fs_filesystem.h.
void GenericFileSystem< file_type >::traverse | ( | visitor_type | visitor, | |
const std::string & | root | |||
) | [inline] |
Performs a depth-first traversal of the file-system subtree rooted at root
. Traverses the entire tree if root
is "". Calls visitor.file()
with the path to each file relative to the filesystem root. Calls visitor.directory()
with the path to each directory relative to the filesystem root.
Definition at line 176 of file fs_filesystem.h.
Entries GenericFileSystem< file_type >::m_entries [private] |
Definition at line 116 of file fs_filesystem.h.
Referenced by GenericFileSystem< ZipRecord >::begin(), GenericFileSystem< ZipRecord >::end(), GenericFileSystem< ZipRecord >::find(), and GenericFileSystem< ZipRecord >::operator[]().