This is the reference documentation of module ALib Files of the ALib C++ Library.
Nested Namespaces: | |
namespace | detail |
This namespace implements internals of namespace alib::files. | |
Type Index: | |
struct | FFilter |
class | File |
class | FileExpressions |
class | FilesCamp |
class | FInfo |
The entry type which is embedded in each tree node. More... | |
class | FTree |
struct | FTreeListener |
class | OwnerAndGroupResolver |
struct | ResultsPaths |
struct | ScanParameters |
Input parameters to function ScanFiles. More... | |
struct | TSharedFTree |
class | TTextFile |
Type Definition Index: | |
using | SPFileFilter = std::shared_ptr<FFilter> |
A shared pointer to a filter. | |
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)()) |
void | FFormat_File (const alib::Box &box, const alib::String &formatSpec, alib::NumberFormat &nf, alib::AString &target) |
ALIB_API FInfo::Qualities | ScanFiles (FTree &tree, ScanParameters ¶meters, std::vector< ResultsPaths > &resultPaths, SharedLock *lock) |
FInfo::Qualities | ScanFiles (SharedFTree &tree, ScanParameters ¶meters, std::vector< ResultsPaths > &resultPaths) |
Variable Index: | |
String | DBG_DUMP_FORMAT |
String | DBG_FILES_SCAN_VERBOSE_LOG_FORMAT |
using SPFileFilter = std::shared_ptr<FFilter> |
A shared pointer to a filter.
Definition at line 49 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.
This function is only available with debug-compilations.
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. |
void FFormat_File | ( | const Box & | box, |
const String & | formatSpec, | ||
NumberFormat & | nf, | ||
AString & | target ) |
This implementation of boxing function FFormat for objects of type File, simply invokes the method File::Format and thus, using the format specification is given with that method.
Note that the NumberFormat instance used for formatting file sizes and similar, does not use the instance given with parameter nf. Instead, the instance retrieved with FTree::GetNumberFormat is used. This feature enables to determine the number format separately for file data output, independent of the settings the formater uses.
If the parameter formatSpec is empty, the string "ta h on gn s dm nal" is used, which is resourced in camp FILES under the key "FFMT".
box | The box containing the file object. |
formatSpec | The format string. |
nf | The number format specification to use. |
target | The target string to write to. |
Definition at line 395 of file file.cpp.
ALIB_API FInfo::Qualities ScanFiles | ( | FTree & | tree, |
ScanParameters & | parameters, | ||
std::vector< ResultsPaths > & | resultPaths, | ||
SharedLock * | lock ) |
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 a scan is always stored using the "Real Path" of the entry. This means that 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 on 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 before 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 uses one of two different 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 the given params struct. Further paths/nodes pairs are created when symbolic links are found and followed. |
lock | Pointer to an (optional) SharedLock. The overloaded version of this function that accepts SharedFTree sets this to the instance found in the shared tree. This parameter is available (and to be passed) only if the module ALib Threads is included in the ALib Distribution. |
|
inline |
Invokes ScanFiles( FTree&, ScanParameters&, std::vector<ResultsPaths>&,SharedLock*) passing the lock included in the given SharedFTree as parameter lock.
tree | The shared tree to fill. |
parameters | The input parameters to determine the scan process. |
resultPaths | The result paths. |
Definition at line 293 of file fscanner.hpp.
|
extern |
The format string used with namespace function DbgDump.
Defaults to "{:ta h{2,r} on{10,r} gn{10,r} s(IEC){10,r} dm qqq FxFa (rd{3r}' D' rf{3r}' F' re{2r}' EA' rb{2r}'BL) 'nf l}\n"
This global variable is only available with debug-compilations.