#include <DirectoryFileScanner.h>
|
std::vector< std::string > | getFilesInDir (const std::string &dir) |
|
std::vector< std::string > | getFilesInDir (const std::string &dir, const std::string &ending) |
|
bool | fileIsValid (const std::string &file) |
|
bool | hasEnding (const std::string &file, const std::string &ending) |
|
size_t | getFileSize (const std::string &file) const |
|
size_t | getDirectorySize (const std::string &dir, bool recursive, const std::string &extension) const |
|
This class scans a directory on the filesystem and returns a list of all files within
◆ fileIsValid()
bool joda::filesystem::DirectoryFileScanner::fileIsValid |
( |
const std::string & |
file | ) |
|
Checks if a given file path is a valid file
- Parameters
-
file | The file path to check |
- Returns
- True if the file is valid; False else
◆ getDirectorySize()
size_t joda::filesystem::DirectoryFileScanner::getDirectorySize |
( |
const std::string & |
dir, |
|
|
bool |
recursive = false , |
|
|
const std::string & |
extension = "" |
|
) |
| const |
Returns the size (in byte) of a given directory.
- Parameters
-
dir | The directory to calculate the size of |
recursive | Decides if subdirectories are traversed recursivley |
extension | An optional file extension to filter the found files. If empty all files are counted |
- Returns
- The size of the directory if the path was valid; 0 else
◆ getFilesInDir() [1/2]
std::vector< std::string > joda::filesystem::DirectoryFileScanner::getFilesInDir |
( |
const std::string & |
dir | ) |
|
Returns all files in the given directory
- Parameters
-
- Returns
- A list of filepaths in string representation
◆ getFilesInDir() [2/2]
std::vector< std::string > joda::filesystem::DirectoryFileScanner::getFilesInDir |
( |
const std::string & |
dir, |
|
|
const std::string & |
ending |
|
) |
| |
Returns all files in the given directory with the provided file extension
- Parameters
-
dir | The directory to scan |
ending | The file extension (without "."). If ending is empty, all files will be returned |
- Returns
- A list of filepaths in string representation
◆ getFileSize()
size_t joda::filesystem::DirectoryFileScanner::getFileSize |
( |
const std::string & |
file | ) |
const |
Returns the size (in byte) of the given file path.
- Parameters
-
file | The file path to check |
- Returns
- The size of the file if it is valid; 0 if not
◆ hasEnding()
bool joda::filesystem::DirectoryFileScanner::hasEnding |
( |
const std::string & |
file, |
|
|
const std::string & |
ending |
|
) |
| |
Checks if a given file path has the provided file extension
- Parameters
-
file | The file path to check |
ending | The ending to check against |
- Returns
- True if the file has the given extension; False else
The documentation for this class was generated from the following files: