![]() |
Max OS 0.3
|
Handles a group of files (directory) More...
#include <filesystem.h>
Public Member Functions | |
| virtual | ~Directory () |
| Destructor for Directory, frees all files and subdirectories. | |
| virtual void | read_from_disk () |
| read the directory from the disk | |
| common::Vector< File * > | files () |
| Get the files in the directory. | |
| common::Vector< Directory * > | subdirectories () |
| Get the subdirectories in the directory. | |
| File * | open_file (const string &name) |
| Open a file in the directory. | |
| Directory * | open_subdirectory (const string &name) |
| Open a directory in the directory. | |
| virtual File * | create_file (const string &name) |
| Create a file in the directory. | |
| virtual void | remove_file (const string &name) |
| Delete a file in the directory. | |
| void | rename_file (File *file, const string &new_name) |
| Rename a file in the directory. | |
| virtual void | rename_file (const string &old_name, const string &new_name) |
| Rename a file in the directory. | |
| void | rename_subdirectory (Directory *directory, const string &new_name) |
| Rename a subdirectory in the directory. | |
| virtual void | rename_subdirectory (const string &old_name, const string &new_name) |
| Rename a subdirectory in the directory. | |
| virtual Directory * | create_subdirectory (const string &name) |
| Create a directory in the directory. | |
| virtual void | remove_subdirectory (const string &name) |
| Try to remove a directory in the directory. | |
| string | name () |
| Get the name of the directory. | |
| size_t | size () |
| Get the size of the directory. | |
Protected Attributes | |
| common::Vector< File * > | m_files |
| The files in this directory. | |
| common::Vector< Directory * > | m_subdirectories |
| The subdirectories in this directory. | |
| string | m_name |
| The name of this directory. | |
Handles a group of files (directory)
Definition at line 57 of file filesystem.h.
|
virtual |
Destructor for Directory, frees all files and subdirectories.
Definition at line 100 of file filesystem.cpp.
References m_files, and m_subdirectories.
Create a file in the directory.
| name | The name of the file to create |
Reimplemented in MaxOS::filesystem::format::ext2::Ext2Directory, and MaxOS::filesystem::format::Fat32Directory.
Definition at line 151 of file filesystem.cpp.
Referenced by MaxOS::filesystem::DirectoryResource::write().
Create a directory in the directory.
| name | The name of the directory to create |
Reimplemented in MaxOS::filesystem::format::ext2::Ext2Directory, and MaxOS::filesystem::format::Fat32Directory.
Definition at line 197 of file filesystem.cpp.
Referenced by MaxOS::filesystem::DirectoryResource::write().
| common::Vector< File * > Directory::files | ( | ) |
Get the files in the directory.
Definition at line 124 of file filesystem.cpp.
References m_files.
| string Directory::name | ( | ) |
Get the name of the directory.
Definition at line 214 of file filesystem.cpp.
References m_name.
Referenced by MaxOS::filesystem::format::ext2::Ext2Directory::create_file(), MaxOS::filesystem::format::Fat32Directory::create_file(), MaxOS::filesystem::format::ext2::Ext2Directory::create_subdirectory(), MaxOS::filesystem::format::Fat32Directory::create_subdirectory(), MaxOS::filesystem::format::ext2::Ext2Directory::Ext2Directory(), MaxOS::filesystem::format::Fat32Directory::Fat32Directory(), open_file(), open_subdirectory(), MaxOS::filesystem::format::Fat32Directory::read_from_disk(), MaxOS::filesystem::format::ext2::Ext2Directory::remove_file(), MaxOS::filesystem::format::Fat32Directory::remove_file(), MaxOS::filesystem::format::ext2::Ext2Directory::remove_subdirectory(), MaxOS::filesystem::format::Fat32Directory::remove_subdirectory(), and rename_subdirectory().
Open a file in the directory.
| name | The name of the file to open |
Definition at line 134 of file filesystem.cpp.
References m_files, and name().
Referenced by MaxOS::filesystem::FileSystem::exists().
Open a directory in the directory.
| name | The name of the directory to open |
Definition at line 178 of file filesystem.cpp.
References m_subdirectories, and name().
Referenced by MaxOS::filesystem::FileSystem::get_directory().
|
virtual |
read the directory from the disk
Reimplemented in MaxOS::filesystem::format::ext2::Ext2Directory, and MaxOS::filesystem::format::Fat32Directory.
Definition at line 115 of file filesystem.cpp.
Referenced by MaxOS::filesystem::VirtualFileSystem::create_directory(), MaxOS::filesystem::format::ext2::Ext2FileSystem::Ext2FileSystem(), MaxOS::filesystem::format::Fat32FileSystem::Fat32FileSystem(), and MaxOS::filesystem::VirtualFileSystem::open_directory().
Delete a file in the directory.
| name | The name of the file to remove |
Reimplemented in MaxOS::filesystem::format::ext2::Ext2Directory, and MaxOS::filesystem::format::Fat32Directory.
Definition at line 160 of file filesystem.cpp.
Referenced by MaxOS::filesystem::DirectoryResource::write().
Try to remove a directory in the directory.
| name | The name of the directory to remove |
Reimplemented in MaxOS::filesystem::format::ext2::Ext2Directory, and MaxOS::filesystem::format::Fat32Directory.
Definition at line 205 of file filesystem.cpp.
Referenced by MaxOS::filesystem::DirectoryResource::write().
Rename a file in the directory.
| old_name | The file to rename |
| new_name | The new name of the file |
Reimplemented in MaxOS::filesystem::format::ext2::Ext2Directory.
Definition at line 252 of file filesystem.cpp.
References ASSERT.
Rename a file in the directory.
| file | The file to rename |
| new_name | The new name of the file |
Definition at line 240 of file filesystem.cpp.
References MaxOS::filesystem::File::name(), and rename_file().
Referenced by rename_file().
Rename a subdirectory in the directory.
| old_name | The directory to rename |
| new_name | The new name of the directory |
Reimplemented in MaxOS::filesystem::format::ext2::Ext2Directory.
Definition at line 276 of file filesystem.cpp.
References ASSERT.
Rename a subdirectory in the directory.
| directory | The directory to rename |
| new_name | The new name of the directory |
Definition at line 264 of file filesystem.cpp.
References name(), and rename_subdirectory().
Referenced by rename_subdirectory().
| size_t Directory::size | ( | ) |
Get the size of the directory.
Definition at line 223 of file filesystem.cpp.
References m_files, and size().
Referenced by size().
| common::Vector< Directory * > Directory::subdirectories | ( | ) |
Get the subdirectories in the directory.
Definition at line 168 of file filesystem.cpp.
References m_subdirectories.
|
protected |
The files in this directory.
Definition at line 59 of file filesystem.h.
Referenced by MaxOS::filesystem::format::ext2::Ext2Directory::create_file(), MaxOS::filesystem::format::Fat32Directory::create_file(), files(), open_file(), MaxOS::filesystem::format::ext2::Ext2Directory::read_from_disk(), MaxOS::filesystem::format::Fat32Directory::read_from_disk(), MaxOS::filesystem::format::Fat32Directory::remove_file(), size(), and ~Directory().
|
protected |
The name of this directory.
Definition at line 62 of file filesystem.h.
Referenced by MaxOS::filesystem::format::ext2::Ext2Directory::Ext2Directory(), MaxOS::filesystem::format::Fat32Directory::Fat32Directory(), and name().
|
protected |
The subdirectories in this directory.
Definition at line 60 of file filesystem.h.
Referenced by MaxOS::filesystem::format::ext2::Ext2Directory::create_subdirectory(), MaxOS::filesystem::format::Fat32Directory::create_subdirectory(), open_subdirectory(), MaxOS::filesystem::format::ext2::Ext2Directory::read_from_disk(), MaxOS::filesystem::format::Fat32Directory::read_from_disk(), MaxOS::filesystem::format::Fat32Directory::remove_subdirectory(), subdirectories(), and ~Directory().