winss
|
An interface for interacting with the file system. More...
#include <filesystem_interface.hpp>
Public Member Functions | |
FilesystemInterface () | |
Creates the file system interface. More... | |
FilesystemInterface (const FilesystemInterface &)=delete | |
No copy. More... | |
FilesystemInterface (FilesystemInterface &&)=delete | |
No move. More... | |
virtual std::string | Read (const fs::path &path) const |
Reads the contents of the file at the given path. More... | |
virtual bool | Write (const fs::path &path, const std::string &content) const |
Writes the given content to a file. More... | |
virtual bool | ChangeDirectory (const fs::path &dir) const |
Change the current directory to the one given. More... | |
virtual bool | DirectoryExists (const fs::path &dir) const |
Checks if the directory exists. More... | |
virtual bool | CreateDirectory (const fs::path &dir) const |
Creates a directory. More... | |
virtual bool | Rename (const fs::path &from, const fs::path &to) const |
Renames a file/directory. More... | |
virtual bool | Remove (const fs::path &path) const |
Remove a file or empty directory. More... | |
virtual bool | FileExists (const fs::path &path) const |
Checks if a file exists. More... | |
virtual fs::path | Absolute (const fs::path &path) const |
Gets the absolute path. More... | |
virtual fs::path | CanonicalUncPath (const fs::path &path) const |
Gets the canonical UNC path. More... | |
virtual std::vector< fs::path > | GetDirectories (const fs::path &path) const |
Gets a list of directories at the given path. More... | |
virtual std::vector< fs::path > | GetFiles (const fs::path &path) const |
Gets a list of files at the given path. More... | |
FilesystemInterface & | operator= (const FilesystemInterface &)=delete |
No copy. More... | |
FilesystemInterface & | operator= (FilesystemInterface &&)=delete |
No move. More... | |
Static Public Member Functions | |
static const FilesystemInterface & | GetInstance () |
Gets the singleton instance. More... | |
Static Protected Attributes | |
static std::shared_ptr< FilesystemInterface > | instance |
A singleton instance. More... | |
An interface for interacting with the file system.
|
inline |
Creates the file system interface.
References Absolute(), CanonicalUncPath(), ChangeDirectory(), CreateDirectory(), DirectoryExists(), FileExists(), GetDirectories(), GetFiles(), GetInstance(), operator=(), Read(), Remove(), Rename(), and Write().
|
delete |
No copy.
|
delete |
No move.
|
virtual |
Gets the absolute path.
[in] | path | The path to convert. |
Referenced by CanonicalUncPath(), and FilesystemInterface().
|
virtual |
Gets the canonical UNC path.
[in] | path | The path to convert. |
References Absolute().
Referenced by FilesystemInterface().
|
virtual |
Change the current directory to the one given.
[in] | dir | The directory. |
Referenced by FilesystemInterface().
|
virtual |
Creates a directory.
[in] | dir | The directory. |
References DirectoryExists().
Referenced by FilesystemInterface().
|
virtual |
Checks if the directory exists.
[in] | dir | The directory. |
Referenced by CreateDirectory(), and FilesystemInterface().
|
virtual |
Checks if a file exists.
[in] | path | The file to check. |
Referenced by FilesystemInterface().
|
virtual |
Gets a list of directories at the given path.
[in] | path | The path to list directories. |
Referenced by FilesystemInterface().
|
virtual |
Gets a list of files at the given path.
[in] | path | The path to list files. |
Referenced by FilesystemInterface().
|
static |
Gets the singleton instance.
References instance.
Referenced by FilesystemInterface().
|
delete |
No copy.
Referenced by FilesystemInterface().
|
delete |
No move.
|
virtual |
Reads the contents of the file at the given path.
[in] | path | The file path. |
Referenced by FilesystemInterface().
|
virtual |
Remove a file or empty directory.
[in] | path | The file/directory to remove. |
Referenced by FilesystemInterface().
|
virtual |
Renames a file/directory.
[in] | from | Existing file/directory. |
[in] | to | New file/directory. |
Referenced by FilesystemInterface(), and Write().
|
virtual |
Writes the given content to a file.
[in] | path | The file path. |
[in] | content | The content of the file. |
References Rename().
Referenced by FilesystemInterface().
|
staticprotected |
A singleton instance.
Referenced by GetInstance().