JODA  0.13.1 (59b41972)
JSON On-Demand Analysis
Public Member Functions
joda::filesystem::DirectoryFileScanner Class Reference

#include <DirectoryFileScanner.h>

Public Member Functions

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
 

Detailed Description

This class scans a directory on the filesystem and returns a list of all files within

Member Function Documentation

◆ fileIsValid()

bool joda::filesystem::DirectoryFileScanner::fileIsValid ( const std::string &  file)

Checks if a given file path is a valid file

Parameters
fileThe file path to check
Returns
True if the file is valid; False else
Here is the caller graph for this function:

◆ 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
dirThe directory to calculate the size of
recursiveDecides if subdirectories are traversed recursivley
extensionAn 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
Here is the caller graph for this function:

◆ getFilesInDir() [1/2]

std::vector< std::string > joda::filesystem::DirectoryFileScanner::getFilesInDir ( const std::string &  dir)

Returns all files in the given directory

Parameters
dirThe directory to scan
Returns
A list of filepaths in string representation
Here is the caller graph for this function:

◆ 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
dirThe directory to scan
endingThe 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
fileThe file path to check
Returns
The size of the file if it is valid; 0 if not
Here is the caller graph for this function:

◆ 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
fileThe file path to check
endingThe ending to check against
Returns
True if the file has the given extension; False else
Here is the caller graph for this function:

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