ALib C++ Framework
by
Library Version: 2605 R0
Documentation generated by doxygen
Loading...
Searching...
No Matches
ffilter.hpp
Go to the documentation of this file.
1//==================================================================================================
2/// \file
3/// This header-file is part of module \alib_filetree of the \aliblong.
4///
5/// Copyright 2013-2026 A-Worx GmbH, Germany.
6/// Published under #"mainpage_license".
7//==================================================================================================
8ALIB_EXPORT namespace alib { namespace filetree {
9
10//==================================================================================================
11/// This is a straight forward simple abstract class with just one interface method which has
12/// to return \c true if an file is included (not filtered) or \c false if it is not included and
13/// thus to be filtered out.<br>
14/// Instead of the provision of an #"%FTValue" object, a cursor of an #"%FTree" is provided.
15/// This allows more detailed inspection of parent directories, if needed.
16/// In addition, the full path string (the real path, all symbolic links translated) is provided.
17/// While this could be assembled from the given cursor \p{node}, the provision is made to allow
18/// the highest execution performance, as the string is available during the scan process anyhow.
19///
20/// Instances of derived (non-abstract) implementations can optionally be attached to fields
21/// #"ScanParameters::FileFilter",
22/// #"ScanParameters::DirectoryFilterPreRecursion", and
23/// #"ScanParameters::DirectoryFilterPostRecursion" of class
24/// #"%ScanParameters" to filter files during the scan process.
25///
26/// Users of the API might also create code that uses this interface type for post-scan
27/// filtering, but in this case may of course also rely on their own implementations /mechanics.
28//==================================================================================================
29struct FFilter {
30 /// Destructor
31 virtual ~FFilter() =default;
32
33 /// Abstract virtual method to evaluate the inclusion of the given #"%FTValue" object.
34 /// @param file The node in the file-tree to examine.
35 /// @param parentPath The absolute path to the parent directory that the file resides in.
36 /// @return The result determines, whether the given file or directory has passed the filter or
37 /// not. Consequently, \c true means "passed" and \c false means "filtered out".
38 virtual bool Includes( const FTFile& file, const PathString& parentPath ) =0;
39
40}; //class FFilter
41
42/// A shared pointer to a filter.
43using SPFileFilter= std::shared_ptr<FFilter>;
44
45} // namespace alib[::filetree]
46
47
48/// Type alias in namespace #"%alib".
50
51/// Type alias in namespace #"%alib".
53
54} // namespace [alib]
#define ALIB_EXPORT
std::shared_ptr< FFilter > SPFileFilter
A shared pointer to a filter.
Definition ffilter.hpp:43
Definition alox.cpp:14
filetree::FFilter FFilter
Type alias in namespace #"%alib".
Definition ffilter.hpp:49
strings::TString< PathCharType > PathString
The string-type used with this ALib Module.
Definition path.hpp:34
filetree::SPFileFilter SPFileFilter
Type alias in namespace #"%alib".
Definition ffilter.hpp:52
virtual ~FFilter()=default
Destructor.
virtual bool Includes(const FTFile &file, const PathString &parentPath)=0