ALib C++ Library
Library Version: 2402 R1
Documentation generated by doxygen
Loading...
Searching...
No Matches
ScanParameters Struct Reference

Description:

Input parameters to function ScanFiles.

Definition at line 22 of file fscanner.hpp.

#include <fscanner.hpp>

Collaboration diagram for ScanParameters:
[legend]

Public Type Index:

enum class  SymbolicLinks { DONT_RESOLVE = 0 , RESOLVE_BUT_DONT_FOLLOW = 1 , RECURSIVE = 2 }
 

Public Static Field Index:

static constexpr unsigned int InfiniteRecursion = (std::numeric_limits<unsigned int>::max)()
 

Public Field Index:

bool CrossFileSystems = true
 
SPFileFilter DirectoryFilterPostRecursion
 
SPFileFilter DirectoryFilterPreRecursion
 
SPFileFilter FileFilter
 
bool IncludeArtificialFS = false
 
SymbolicLinks LinkTreatment = SymbolicLinks::RECURSIVE
 
unsigned int MaxDepth = InfiniteRecursion
 
bool RemoveEmptyDirectories
 
PathString StartPath
 

Public Method Index:

 ScanParameters (const String &startPath, SymbolicLinks linkTreatment=SymbolicLinks::RECURSIVE, unsigned int maxDepth=InfiniteRecursion, bool crossFileSystems=true, bool includeArtificialFS=false)
 

Enumeration Details:

◆ SymbolicLinks

enum class SymbolicLinks
strong

Options for processing symbolic links.

Enumerator
DONT_RESOLVE 

Demands not to resolve symbolic links in any way.

RESOLVE_BUT_DONT_FOLLOW 

Demands to read symbolic links, but not follow linked directories. FInfo dates, sizes and access rights are set according to the link target.

RECURSIVE 

Read symbolic links and in case they are targeting a directory, recurse into, if this directory meets the other constraints associated with the current scan.

Definition at line 25 of file fscanner.hpp.

Field Details:

◆ CrossFileSystems

bool CrossFileSystems = true

If true, the default, scanning does not stop recursion on directories which represent a mounted filesystem. If false, the search is restricted to the device that StartPath resides in.

Definition at line 51 of file fscanner.hpp.

◆ DirectoryFilterPostRecursion

SPFileFilter DirectoryFilterPostRecursion

If set (not containing nullptr), this filter is invoked after to a recursive scan of a directory. If false is returned, the recursion is not performed, but the (empty) directory remains in the result list, if field RemoveEmptyDirectories evaluates to false.
Note that in case field LinkTreatment is set to SymbolicLinks::RECURSIVE , this filter is also applied to symbolic links, which are readable, not broken and target a directory.

Note
Directories (and symbolic links to directories) are first recursively scanned before this filter is applied. On deletion, of-course the whole scanned subtree is deleted. This allows to filter directories, depending on information available only after scanning, hence by the numbers retrieved with FInfo::Sums . To increase performance and filter directories prior to their recursive scan, alternative field DirectoryFilterPreRecursion is to be used.
See also
Optional filters DirectoryFilterPreRecursion and FileFilter.

Definition at line 90 of file fscanner.hpp.

◆ DirectoryFilterPreRecursion

SPFileFilter DirectoryFilterPreRecursion

Same as DirectoryFilterPostRecursion but is used prior to a recursive scan of a directory. Consequently, this filter leads to much higher scan performance than the alternative version, because huge branches of the file system might be omitted during scan. However, the numbers retrieved with FInfo::Sums will all indicate 0, because no information is retrieved.
If a directory is "pruned" due to this filter, the entry still occurs in the FTree, unless field RemoveEmptyDirectories evaluates to true.

See also
Optional filters DirectoryFilterPostRecursion and FileFilter.

Definition at line 102 of file fscanner.hpp.

◆ FileFilter

SPFileFilter FileFilter

If set (not containing nullptr), files are passed to this filter and removed if false is returned.
The term "files" here means all sort of files except Directories. Directories are either real directories, or in case field LinkTreatment is set to SymbolicLinks::RECURSIVE , symbolic links that target a directory.

See also
Optional filters DirectoryFilterPreRecursion and DirectoryFilterPostRecursion.

Definition at line 70 of file fscanner.hpp.

◆ IncludeArtificialFS

bool IncludeArtificialFS = false

If false (the default), scanning aborts if 'artificial' filesystems are found. Artificial filesystems under GNU/Linux, are for example: /proc, /dev, /run, /sys and /temp.

Definition at line 56 of file fscanner.hpp.

◆ InfiniteRecursion

constexpr unsigned int InfiniteRecursion = (std::numeric_limits<unsigned int>::max)()
staticconstexpr

Denotes 'infinite' recursion if set to field MaxDepth.

Definition at line 37 of file fscanner.hpp.

◆ LinkTreatment

Denotes how symbolic links are treated.

Definition at line 43 of file fscanner.hpp.

◆ MaxDepth

unsigned int MaxDepth = InfiniteRecursion

The maximum recursion depth. Defaults to InfiniteRecursion.

Definition at line 46 of file fscanner.hpp.

◆ RemoveEmptyDirectories

bool RemoveEmptyDirectories

If false, empty directories remain in the result tree. Otherwise they are deleted and do not appear in the tree.

Definition at line 60 of file fscanner.hpp.

◆ StartPath

PathString StartPath

The path to be scanned.

Definition at line 40 of file fscanner.hpp.

Constructor(s) / Destructor Details::

◆ ScanParameters()

ScanParameters ( const String & startPath,
SymbolicLinks linkTreatment = SymbolicLinks::RECURSIVE,
unsigned int maxDepth = InfiniteRecursion,
bool crossFileSystems = true,
bool includeArtificialFS = false )
inline

Constructor accepting all features.

Parameters
startPathStored in field StartPath.
linkTreatmentStored in field LinkTreatment. Defaults to SymbolicLinks::RECURSIVE.
maxDepthStored in field MaxDepth. Defaults to +InfiniteRecursion.
crossFileSystemsStored in field CrossFileSystems. Defaults to true.
includeArtificialFSStored in field IncludeArtificialFS. Defaults to false.

Definition at line 112 of file fscanner.hpp.


The documentation for this struct was generated from the following file: