default implementation
More...
#include <FileSystemCommon.hpp>
|
u_int64_t | getAvailableSpace (const Path &path) |
|
Path | getCurrentDirectory () |
|
Path | getDirectory (const Path &path) |
|
Path | getTemporaryDirectory () |
|
Path | getBaseName (const Path &path, bool cutToFirstDot=false) |
|
Path | getRealPath (const Path &file) |
|
std::string | getExtension (const Path &path) |
|
std::string | getTemporaryFilename (const std::string &filename="") |
|
bool | doesExist (const Path &path) |
|
bool | doesExistDirectory (const Path &path) |
|
bool | isFolderEndingWith (const Path &path, const std::string &ending) |
|
u_int64_t | getSize (const Path &path) |
|
int | mkdir (const Path &path, u_int64_t mode) |
|
int | rmdir (const Path &path) |
|
int | remove (const Path &path) |
|
int | rename (const Path &from, const Path &to) |
|
void | iterate (const Path &path, void(*callback)(const Path &entry, void *data), void *data) |
|
std::vector< std::string > | listdir (const Path &path) |
|
ssize_t | getAttribute (const Path &filename, const char *key, std::string &value) |
|
ssize_t | setAttribute (const Path &filename, const char *key, const char *fmt,...) |
|
virtual size_t | getMaxFilesNumber ()=0 |
|
virtual int | clearCache ()=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 | ~IFileSystem () |
|
bool doesExist |
( |
const Path & |
path | ) |
|
|
virtual |
Tells whether a file exists or not.
- Returns
- true if file exists, false otherwise
Implements IFileSystem.
bool doesExistDirectory |
( |
const Path & |
path | ) |
|
|
virtual |
Tells whether a folder exists or not.
- Returns
- true if folder exists, false otherwise
Implements IFileSystem.
ssize_t getAttribute |
( |
const Path & |
filename, |
|
|
const char * |
key, |
|
|
std::string & |
value |
|
) |
| |
|
inlinevirtual |
Get metadata associated with the file for a given key.
- Parameters
-
[in] | filename | : name of the file. |
[in] | key | : key for which we want the value |
[in] | value | : value associated to the key |
- Returns
- -1 if KO, 0 otherwise, otherwise length of the retrieved value.
Implements IFileSystem.
Reimplemented in FileSystemLinux, and FileSystemMacos.
u_int64_t getAvailableSpace |
( |
const Path & |
path | ) |
|
|
virtual |
Return the available space at the location given by the provided path.
- Parameters
-
[in] | path | : the location from where the space size is computed. |
- Returns
- the available size (in KBytes).
Implements IFileSystem.
Return the base of the URI
- Parameters
-
[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" |
- Returns
- the base name of the uri
Implements IFileSystem.
Retrieve the current directory absolute path.
- Returns
- the current directory to be retrieved.
Implements IFileSystem.
Retrieve the directory of the provided name.
- Returns
- the directory
Implements IFileSystem.
std::string getExtension |
( |
const Path & |
path | ) |
|
|
virtual |
Return the extension to the given file,
- Parameters
-
- Returns
- extension
Implements IFileSystem.
Return the canonical path to the given file, ie replace symbolic links or relative path.
- Parameters
-
[in] | file | : the file we want the canonical path. |
- Returns
- the real path.
Implements IFileSystem.
u_int64_t getSize |
( |
const Path & |
path | ) |
|
|
virtual |
Return the size of the file given by the provided path.
- Parameters
-
[in] | path | : the location from where the space size is computed. |
- Returns
- the available size (in Bytes).
Implements IFileSystem.
Retrieve the default temporary directory absolute path.
- Returns
- the temporary directory to be retrieved.
Implements IFileSystem.
string getTemporaryFilename |
( |
const std::string & |
filename = "" | ) |
|
|
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.
- Parameters
-
[in] | filename | : file name (may be empty) |
- Returns
- a unique file name.
Implements IFileSystem.
bool isFolderEndingWith |
( |
const Path & |
path, |
|
|
const std::string & |
ending |
|
) |
| |
|
virtual |
Tells whether path is a folder that ends with a certain string
- Returns
- true if folder ends with string, false otherwise
Implements IFileSystem.
void iterate |
( |
const Path & |
path, |
|
|
void(*)(const Path &entry, void *data) |
callback, |
|
|
void * |
data |
|
) |
| |
|
virtual |
Iterates entries of a directory.
- Parameters
-
[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. |
Implements IFileSystem.
std::vector< std::string > listdir |
( |
const Path & |
path | ) |
|
|
virtual |
int mkdir |
( |
const Path & |
path, |
|
|
u_int64_t |
mode |
|
) |
| |
|
inlinevirtual |
Create a directory for the provided path and mode.
- Parameters
-
[in] | path | : path of the directory to be created. |
[in] | mode | : mode of creation (see 'mkdir' system function documentation). |
Implements IFileSystem.
int remove |
( |
const Path & |
path | ) |
|
|
inlinevirtual |
Delete the file given its path.
- Parameters
-
[in] | path | : path of the file to be removed from the file system. |
Implements IFileSystem.
int rename |
( |
const Path & |
from, |
|
|
const Path & |
to |
|
) |
| |
|
inlinevirtual |
Rename the provided uri
- Parameters
-
[in] | from | : initial name. |
[in] | to | : final name. |
Implements IFileSystem.
int rmdir |
( |
const Path & |
path | ) |
|
|
inlinevirtual |
Delete the entry given its path.
- Parameters
-
[in] | path | : path of the entry to be removed from the file system. |
Implements IFileSystem.
ssize_t setAttribute |
( |
const Path & |
filename, |
|
|
const char * |
key, |
|
|
const char * |
fmt, |
|
|
|
... |
|
) |
| |
|
inlinevirtual |
Set metadata associated with the file for a given key.
- Parameters
-
[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 |
- Returns
- -1 if error, 0 otherwise.
Implements IFileSystem.
Reimplemented in FileSystemLinux, and FileSystemMacos.
The documentation for this class was generated from the following files:
- /builds/workspace/publish-doc-api-gitlab/gatb-core/src/gatb/system/impl/FileSystemCommon.hpp
- /builds/workspace/publish-doc-api-gitlab/gatb-core/src/gatb/system/impl/FileSystemCommon.cpp