ALib C++ Library
Library Version: 2510 R0
Documentation generated by doxygen
Loading...
Searching...
No Matches
ffilter.inl
Go to the documentation of this file.
1//==================================================================================================
2/// \file
3/// This header-file is part of module \alib_files of the \aliblong.
4///
5/// \emoji :copyright: 2013-2025 A-Worx GmbH, Germany.
6/// Published under \ref mainpage_license "Boost Software License".
7//==================================================================================================
8ALIB_EXPORT namespace alib { namespace files {
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 \b FInfo object, a cursor of an \b 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/// 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/// \alib{files::ScanParameters;FileFilter},
22/// \alib{files::ScanParameters;DirectoryFilterPreRecursion}, and
23/// \alib{files::ScanParameters;DirectoryFilterPostRecursion} of class
24/// \b 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 own implementations/mechanics.
28//==================================================================================================
29struct FFilter
30{
31 /// Destructor
32 virtual ~FFilter() = default;
33
34 /// Abstract virtual method to evaluate the inclusion of the given \b FInfo object.
35 /// @param file The node in the file-tree to examine.
36 /// @param parentPath The absolute path to the parent directory that the file resides in.
37 /// @return The result determines, whether the given file or directory has passed the filter or
38 /// not. Consequently, \c true means "passed" and \c false means "filtered out".
39 virtual bool Includes( const File& file, const system::PathString& parentPath ) = 0;
40
41}; //class FFilter
42
43/// A shared pointer to a filter.
44using SPFileFilter= std::shared_ptr<FFilter>;
45
46} // namespace alib[::files]
47
48
49/// Type alias in namespace \b alib.
51
52/// Type alias in namespace \b alib.
54
55} // namespace [alib]
56
57
#define ALIB_EXPORT
Definition alib.inl:488
std::shared_ptr< FFilter > SPFileFilter
A shared pointer to a filter.
Definition ffilter.inl:44
strings::TString< PathCharType > PathString
The string-type used with this ALib Module.
Definition path.inl:33
files::FFilter FFilter
Type alias in namespace alib.
Definition ffilter.inl:50
files::SPFileFilter SPFileFilter
Type alias in namespace alib.
Definition ffilter.inl:53
virtual ~FFilter()=default
Destructor.
virtual bool Includes(const File &file, const system::PathString &parentPath)=0