gatb.core-API-0.0.0
|
interface for some operations at file system level. More...
#include <IFileSystem.hpp>
Public Types | |
typedef std::string | Path |
Public Member Functions | |
virtual size_t | getMaxFilesNumber ()=0 |
virtual u_int64_t | getAvailableSpace (const Path &path)=0 |
virtual Path | getCurrentDirectory ()=0 |
virtual Path | getDirectory (const Path &path)=0 |
virtual Path | getTemporaryDirectory ()=0 |
virtual Path | getBaseName (const Path &path, bool cutToFirstDot=false)=0 |
virtual Path | getRealPath (const Path &file)=0 |
virtual std::string | getExtension (const Path &file)=0 |
virtual std::string | getTemporaryFilename (const std::string &filename="")=0 |
virtual bool | doesExist (const Path &path)=0 |
virtual bool | doesExistDirectory (const Path &path)=0 |
virtual bool | isFolderEndingWith (const Path &path, const std::string &ending)=0 |
virtual u_int64_t | getSize (const Path &path)=0 |
virtual int | clearCache ()=0 |
virtual int | mkdir (const Path &path, u_int64_t mode)=0 |
virtual int | rmdir (const Path &path)=0 |
virtual int | remove (const Path &path)=0 |
virtual int | rename (const Path &from, const Path &to)=0 |
virtual void | iterate (const Path &path, void(*callback)(const Path &entry, void *data), void *data)=0 |
virtual std::vector< Path > | listdir (const Path &path)=0 |
virtual IFile * | newFile (const Path &path, const char *mode)=0 |
virtual IFile * | newFile (const Path &dirpath, const Path &filename, const char *mode)=0 |
virtual ssize_t | getAttribute (const Path &filename, const char *key, std::string &value)=0 |
virtual ssize_t | setAttribute (const Path &filename, const char *key, const char *fmt,...)=0 |
virtual | ~IFileSystem () |
interface for some operations at file system level.
This interface define a few operations like creating/deleting directories.
It can provide information like the max number of files that can be used at the same time, or the available space at some location in the FFS.
It also acts as a factory that creates IFile instances.
typedef std::string Path |
Alias type for a file system path.
|
inlinevirtual |
Destructor.
|
pure virtual |
Clear the file system cache.
Implemented in FileSystemLinux, and FileSystemMacos.
|
pure virtual |
Tells whether a file exists or not.
Implemented in FileSystemCommon.
|
pure virtual |
Tells whether a folder exists or not.
Implemented in FileSystemCommon.
|
pure virtual |
Get metadata associated with the file for a given key.
[in] | filename | : name of the file. |
[in] | key | : key for which we want the value |
[in] | value | : value associated to the key |
Implemented in FileSystemCommon, FileSystemLinux, and FileSystemMacos.
|
pure virtual |
Return the available space at the location given by the provided path.
[in] | path | : the location from where the space size is computed. |
Implemented in FileSystemCommon.
Return the base of the URI
[in] | path | : uri from which we want to extract the base name. |
[in] | cutToFirstDot | : by default, getBaseName("a.b.c.fq") = "a.b.c". If cutToFirstDot is true, will return just "a" |
Implemented in FileSystemCommon.
|
pure virtual |
Retrieve the current directory absolute path.
Implemented in FileSystemCommon.
|
pure virtual |
Return the extension to the given file,
[in] | file | : file |
Implemented in FileSystemCommon.
|
pure virtual |
Return the maximum number of files that can be used at the same time.
Implemented in FileSystemLinux, and FileSystemMacos.
Return the canonical path to the given file, ie replace symbolic links or relative path.
[in] | file | : the file we want the canonical path. |
Implemented in FileSystemCommon.
|
pure virtual |
Return the size of the file given by the provided path.
[in] | path | : the location from where the space size is computed. |
Implemented in FileSystemCommon.
|
pure virtual |
Retrieve the default temporary directory absolute path.
Implemented in FileSystemCommon.
|
pure virtual |
Get a temporary file name. One may provide an argument; in such a case some prefix/suffix will be appended to this name in order to make it unique.
[in] | filename | : file name (may be empty) |
Implemented in FileSystemCommon.
|
pure virtual |
Tells whether path is a folder that ends with a certain string
Implemented in FileSystemCommon.
|
pure virtual |
Iterates entries of a directory.
[in] | path | : path of the directory to be iterated |
[in] | callback | : callback called for each found entry |
[in] | data | : private data given to the callback. |
Implemented in FileSystemCommon.
Get entries of a directory.
[in] | path | : path of the explored directory |
Implemented in FileSystemCommon.
|
pure virtual |
Create a directory for the provided path and mode.
[in] | path | : path of the directory to be created. |
[in] | mode | : mode of creation (see 'mkdir' system function documentation). |
Implemented in FileSystemCommon.
Creates a new IFile instance (equivalent to 'fopen' function)
[in] | path | : uri of the file to be opened. |
[in] | mode | : mode of the file (like fopen) |
Implemented in FileSystemLinux, and FileSystemMacos.
|
pure virtual |
Creates a new IFile instance (equivalent to 'fopen' function)
[in] | dirpath | : uri of the directory where the file is meant to be. |
[in] | filename | : name of the file |
[in] | mode | : mode of the file (like fopen) |
Implemented in FileSystemLinux, and FileSystemMacos.
|
pure virtual |
Delete the file given its path.
[in] | path | : path of the file to be removed from the file system. |
Implemented in FileSystemCommon.
Rename the provided uri
[in] | from | : initial name. |
[in] | to | : final name. |
Implemented in FileSystemCommon.
|
pure virtual |
Delete the entry given its path.
[in] | path | : path of the entry to be removed from the file system. |
Implemented in FileSystemCommon.
|
pure virtual |
Set metadata associated with the file for a given key.
[in] | filename | : name of the file. |
[in] | key | : key for which we want the value |
[in] | fmt | : format of the string (in the 'printf' way) |
[in] | ... | : paramters for the format parameter |
Implemented in FileSystemCommon, FileSystemLinux, and FileSystemMacos.