This is the reference documentation of module ALib Files of the ALib C++ Library .
Nested Namespaces: | |
namespace | detail |
Type Index: | |
struct | FFilter |
class | FileExpressions |
class | Files |
class | FInfo |
class | FTree |
class | OwnerAndGroupResolver |
struct | ResultsPaths |
struct | ScanParameters |
Type Definition Index: | |
using | PathString = alib::strings::TLocalString<character, 512> |
using | SPFileFilter = std::shared_ptr<FFilter> |
Function Index: | |
ALIB_API AString & | DbgDump (AString &target, FTree &tree, EnumBitSet< FInfo::Types > includedTypes=EnumBitSet< FInfo::Types >(true), FTree::Cursor startNode=FTree::Cursor(), unsigned int depth=(std::numeric_limits< unsigned int >::max)()) |
ALIB_API enum FInfo::Qualities | ScanFiles (FTree &tree, ScanParameters ¶meters, std::vector< ResultsPaths > &resultPaths) |
typedef alib::strings::TLocalString< character, 512 > PathString = alib::strings::TLocalString<character, 512> |
using SPFileFilter = std::shared_ptr<FFilter> |
A shared pointer to a filter.
Definition at line 54 of file ffilter.hpp.
ALIB_API AString & DbgDump | ( | AString & | target, |
FTree & | tree, | ||
EnumBitSet< FInfo::Types > | includedTypes = EnumBitSet< FInfo::Types >(true), | ||
FTree::Cursor | startNode = FTree::Cursor(), | ||
unsigned int | depth = (std::numeric_limits< unsigned int >::max)() ) |
Dumps the given branch of this object's tree.
target | The target string buffer. |
tree | The tree to dump. |
includedTypes | Optional filter for types. Defaults to 'all'. |
startNode | The start node. If this is not a valid node , the root node is chosen. Defaults to an invalid cursor. |
depth | The maximum depth of recursion. Defaults to unlimited depth. |
ALIB_API enum FInfo::Qualities ScanFiles | ( | FTree & | tree, |
ScanParameters & | parameters, | ||
std::vector< ResultsPaths > & | resultPaths ) |
Scans the filesystem according to given ScanParameters and adds FInfo entries to the given FTree .
This function has a contract with class FTree that is used to store the scan results. This contract states, that any file or directory found during scan is always stored using the "Real Path" of the entry. This means, any symbolic link is resolved. The consequences are:
The latter is reflected with parameter resultPaths of this function, which is defined as a std::vector
.
Existing entries in the given tree are not overwritten. They might be scanned with "higher" FInfo::Qualities values; depending given parameters and how they had been scanned before. If the same "level" of scanning is provided, existing entries will not be scanned again. If a rescan of a certain path is wanted, then the target entry of that path has to be deleted prior to invoking this function. Due to the implementation of class FTree, repeated delete and scan operations will not cause any heap-memory activities (of-course, as long as no new entries are detected).
File scanning is a platform dependent task and hence ALib switches provides two implementations:
C++ std::filesystem
.The fallback version using std::filesystem
has the following restrictions:
0
.tree | The tree to fill. |
parameters | The input parameters to determine the scan process. |
resultPaths | A container to add the resulting list of 'real' paths and corresponding start nodes found during the search. The first entry added by this function is always the 'real'-version of field StartPath of given params struct. Further paths/nodes pairs are created when symbolic links are found and followed. |