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

Description:

Input parameters to function ScanFiles.

Definition at line 50 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 }
 Options for processing symbolic links. More...
 

Public Static Field Index:

static constexpr unsigned int InfiniteRecursion = (std::numeric_limits<unsigned int>::max)()
 Denotes 'infinite' recursion if set to field MaxDepth.
 

Public Field Index:

bool CrossFileSystems = true
 
SPFileFilter DirectoryFilterPostRecursion
 
SPFileFilter DirectoryFilterPreRecursion
 
SPFileFilter FileFilter
 
bool IncludeArtificialFS = false
 
SymbolicLinks LinkTreatment = SymbolicLinks::RECURSIVE
 Denotes how symbolic links are treated.
 
unsigned int MaxDepth = InfiniteRecursion
 The maximum recursion depth. Defaults to InfiniteRecursion.
 
bool RemoveEmptyDirectories = false
 
Path StartPath
 The path to be scanned.
 

Public Method Index:

 ScanParameters (const lang::system::PathString &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 53 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 79 of file fscanner.hpp.

◆ DirectoryFilterPostRecursion

SPFileFilter DirectoryFilterPostRecursion

If set (not containing nullptr), this filter is invoked after 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 filtering directories, depending on information available only after scanning, hence by the numbers retrieved with FInfo::Sums. To increase performance and filter directories before their recursive scan, alternative field DirectoryFilterPreRecursion is to be used.
See also
Optional filters DirectoryFilterPreRecursion and FileFilter.

Definition at line 118 of file fscanner.hpp.

◆ DirectoryFilterPreRecursion

SPFileFilter DirectoryFilterPreRecursion

Same as DirectoryFilterPostRecursion but is used before 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 130 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 98 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 84 of file fscanner.hpp.

◆ InfiniteRecursion

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

Denotes 'infinite' recursion if set to field MaxDepth.

Definition at line 65 of file fscanner.hpp.

◆ LinkTreatment

Denotes how symbolic links are treated.

Definition at line 71 of file fscanner.hpp.

◆ MaxDepth

unsigned int MaxDepth = InfiniteRecursion

The maximum recursion depth. Defaults to InfiniteRecursion.

Definition at line 74 of file fscanner.hpp.

◆ RemoveEmptyDirectories

bool RemoveEmptyDirectories = false

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

Definition at line 88 of file fscanner.hpp.

◆ StartPath

Path StartPath

The path to be scanned.

Definition at line 68 of file fscanner.hpp.

Constructor(s) / Destructor Details:

◆ ScanParameters()

ScanParameters ( const lang::system::PathString & 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 138 of file fscanner.hpp.


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