OpenEnroth 73e68f7
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Private Attributes | List of all members
DirectoryFileSystem Class Reference

#include <DirectoryFileSystem.h>

Inheritance diagram for DirectoryFileSystem:
FileSystem

Public Member Functions

 DirectoryFileSystem (std::string_view root)
 
virtual ~DirectoryFileSystem ()
 
- Public Member Functions inherited from FileSystem
 FileSystem ()=default
 
virtual ~FileSystem ()=default
 
bool exists (std::string_view path) const
 
bool exists (FileSystemPathView path) const
 
FileStat stat (std::string_view path) const
 
FileStat stat (FileSystemPathView path) const
 
std::vector< DirectoryEntryls (std::string_view path) const
 
std::vector< DirectoryEntryls (FileSystemPathView path) const
 
void ls (std::string_view path, std::vector< DirectoryEntry > *entries) const
 
void ls (FileSystemPathView path, std::vector< DirectoryEntry > *entries) const
 
Blob read (std::string_view path) const
 
Blob read (FileSystemPathView path) const
 
void write (std::string_view path, const Blob &data)
 
void write (FileSystemPathView path, const Blob &data)
 
std::unique_ptr< InputStreamopenForReading (std::string_view path) const
 
std::unique_ptr< InputStreamopenForReading (FileSystemPathView path) const
 
std::unique_ptr< OutputStreamopenForWriting (std::string_view path)
 
std::unique_ptr< OutputStreamopenForWriting (FileSystemPathView path)
 
void rename (std::string_view srcPath, std::string_view dstPath)
 
void rename (FileSystemPathView srcPath, FileSystemPathView dstPath)
 
bool remove (std::string_view path)
 
bool remove (FileSystemPathView path)
 
std::string displayPath (std::string_view path) const
 
std::string displayPath (FileSystemPathView path) const
 

Private Member Functions

virtual bool _exists (FileSystemPathView path) const override
 
virtual FileStat _stat (FileSystemPathView path) const override
 
virtual void _ls (FileSystemPathView path, std::vector< DirectoryEntry > *entries) const override
 
virtual Blob _read (FileSystemPathView path) const override
 
virtual void _write (FileSystemPathView path, const Blob &data) override
 
virtual std::unique_ptr< InputStream_openForReading (FileSystemPathView path) const override
 
virtual std::unique_ptr< OutputStream_openForWriting (FileSystemPathView path) override
 
virtual void _rename (FileSystemPathView srcPath, FileSystemPathView dstPath) override
 
virtual bool _remove (FileSystemPathView path) override
 
virtual std::string _displayPath (FileSystemPathView path) const override
 
std::filesystem::path makeBasePath (FileSystemPathView path) const
 

Private Attributes

std::string _originalRoot
 
std::filesystem::path _root
 

Additional Inherited Members

- Protected Types inherited from FileSystem
template<class T >
using FileSystemTrieNode = detail::FileSystemTrieNode< T >
 
template<class T >
using FileSystemTrie = detail::FileSystemTrie< T >
 
virtual bool _exists (FileSystemPathView path) const =0
 
virtual FileStat _stat (FileSystemPathView path) const =0
 
virtual void _ls (FileSystemPathView path, std::vector< DirectoryEntry > *entries) const =0
 
virtual Blob _read (FileSystemPathView path) const =0
 
virtual void _write (FileSystemPathView path, const Blob &data)=0
 
virtual std::unique_ptr< InputStream_openForReading (FileSystemPathView path) const =0
 
virtual std::unique_ptr< OutputStream_openForWriting (FileSystemPathView path)=0
 
virtual void _rename (FileSystemPathView srcPath, FileSystemPathView dstPath)
 
virtual bool _remove (FileSystemPathView path)=0
 
virtual std::string _displayPath (FileSystemPathView path) const =0
 

Detailed Description

View over a directory on a file system.

All methods will work as if the root directory of this FileSystem exists, even if it doesn't exist on the underlying file system.

Files outside of the root directory are not observable through this FileSystem - the methods will behave as if these files don't exist.

When it comes to permissions, this filesystem tries its best to provide a simple guarantee that ls for an existing folder never throws, and is in sync with what stat / exists return. This means that some files or folders that are observable through ls in bash won't be observable through this filesystem.

Constructor & Destructor Documentation

◆ DirectoryFileSystem()

DirectoryFileSystem::DirectoryFileSystem ( std::string_view  root)
explicit

◆ ~DirectoryFileSystem()

DirectoryFileSystem::~DirectoryFileSystem ( )
virtualdefault

Member Function Documentation

◆ _displayPath()

std::string DirectoryFileSystem::_displayPath ( FileSystemPathView  path) const
overrideprivatevirtual

Implements FileSystem.

◆ _exists()

bool DirectoryFileSystem::_exists ( FileSystemPathView  path) const
overrideprivatevirtual

Implements FileSystem.

◆ _ls()

void DirectoryFileSystem::_ls ( FileSystemPathView  path,
std::vector< DirectoryEntry > *  entries 
) const
overrideprivatevirtual

Implements FileSystem.

◆ _openForReading()

std::unique_ptr< InputStream > DirectoryFileSystem::_openForReading ( FileSystemPathView  path) const
overrideprivatevirtual

Implements FileSystem.

◆ _openForWriting()

std::unique_ptr< OutputStream > DirectoryFileSystem::_openForWriting ( FileSystemPathView  path)
overrideprivatevirtual

Implements FileSystem.

◆ _read()

Blob DirectoryFileSystem::_read ( FileSystemPathView  path) const
overrideprivatevirtual

Implements FileSystem.

◆ _remove()

bool DirectoryFileSystem::_remove ( FileSystemPathView  path)
overrideprivatevirtual

Implements FileSystem.

◆ _rename()

void DirectoryFileSystem::_rename ( FileSystemPathView  srcPath,
FileSystemPathView  dstPath 
)
overrideprivatevirtual

Reimplemented from FileSystem.

◆ _stat()

FileStat DirectoryFileSystem::_stat ( FileSystemPathView  path) const
overrideprivatevirtual

Implements FileSystem.

◆ _write()

void DirectoryFileSystem::_write ( FileSystemPathView  path,
const Blob data 
)
overrideprivatevirtual

Implements FileSystem.

◆ makeBasePath()

std::filesystem::path DirectoryFileSystem::makeBasePath ( FileSystemPathView  path) const
private

Member Data Documentation

◆ _originalRoot

std::string DirectoryFileSystem::_originalRoot
private

◆ _root

std::filesystem::path DirectoryFileSystem::_root
private

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