#include <FileFilter.h>
A base class for filters used in the directory enumeration process.
- See Also
- Compressing Data
-
CDirEnumerator::Start
ZipArchiveLib::CFileFilter::CFileFilter |
( |
bool |
bInverted = false | ) |
|
|
inline |
Initializes a new instance of the CFileFilter class.
- Parameters
-
bInverted | Set to true to invert the behavior of the filter or to false for the normal behavior. |
- See Also
- SetInverted
virtual bool ZipArchiveLib::CFileFilter::Accept |
( |
LPCTSTR |
lpszParentDir, |
|
|
LPCTSTR |
lpszName, |
|
|
const CFileInfo & |
info |
|
) |
| |
|
inlineprotectedvirtual |
bool ZipArchiveLib::CFileFilter::Evaluate |
( |
LPCTSTR |
lpszParentDir, |
|
|
LPCTSTR |
lpszName, |
|
|
const CFileInfo & |
info |
|
) |
| |
|
inline |
This method is directly called by the CDirEnumerator::Start for each file or directory that was previously accepted with the HandlesFile method.
It internally calls the Accept method and inverts its result, if the filter is in the inverted mode and does not handle the inversion internally.
- If this method returns
true
for a file, then the file is processed (the CDirEnumerator::Process method is called for the file). Otherwise the file is not processed.
- If this method returns
true
for a directory, then the directory can be traversed for files and subfolders (depending on the CDirEnumerator::IsRecursive() method). Otherwise the directory is not traversed.
- Parameters
-
lpszParentDir | The parent directory containing the file to accept. |
lpszName | The name of the file to accept (without a path). |
info | The structure containing the information about the current file. |
- Returns
true
, if the file is accepted (taking inversion into account); false
otherwise.
- See Also
- Accept
-
HandlesFile
-
HandlesInversion
-
SetInverted
-
IsInverted
-
CDirEnumerator::Start
-
CDirEnumerator::Process
virtual bool ZipArchiveLib::CFileFilter::HandlesFile |
( |
const CFileInfo & |
info | ) |
|
|
inlinevirtual |
Returns the value indicating whether the filter can decide about processing of the info file. If it can, then the Evaluate method will be called for the info file. By default this method returns true
for files and false
for directories. Override this method to change its behavior.
- If info is a file and this method returns
false
, then the file is not processed.
- If info is a directory and this method returns
false
, then the directory can still be traversed for files and subfolders (depending on the CDirEnumerator::IsRecursive() method).
The Evaluate method is not called in both cases.
- Parameters
-
info | The structure containing the information about the file. |
- Returns
true
, if the info file should be evaluated by the Evaluate method; false
otherwise.
- Note
- This method is particularly useful when the filter operates in the inverted mode (see SetInverted). For example, if a filter should accept directories in both inverted and non-inverted mode, it would need to specially handle inversion for directories without this method. With this method it can just not accept directories for evaluation and they still will be traversed.
Reimplemented in ZipArchiveLib::CGroupFileFilter, and ZipArchiveLib::CNameFileFilter.
virtual bool ZipArchiveLib::CFileFilter::HandlesInversion |
( |
| ) |
const |
|
inlineprotectedvirtual |
Returns the value indicating whether the current filter handles the inversion mode internally or not.
- If the filter is in the inverted mode and it handles the inversion, then the return value
true
from the Accept method means that the file should be processed.
- If the filter is in the inverted mode and it does not handle the inversion, then the return value
true
from the Accept method means that the file should not be processed.
It may be more efficient to handle the inversion internally in some cases.
- Returns
true
, if the filter handles the inversion internally; false
otherwise.
- Note
- This method returns
false
by default. Override this method to change this behavior.
- See Also
- SetInverted
-
IsInverted
Reimplemented in ZipArchiveLib::CGroupFileFilter.
bool ZipArchiveLib::CFileFilter::IsInverted |
( |
| ) |
const |
|
inline |
Returns the value indicating whether the filter operates in an inverted mode or in a normal mode.
- Returns
true
, if the filter operates in an inverted mode; false
otherwise.
- See Also
- SetInverted
-
HandlesInversion
void ZipArchiveLib::CFileFilter::SetInverted |
( |
bool |
bInverted = true | ) |
|
|
inline |
Sets the filter to operate in the inverted or in the normal mode. If the filter operates in an inverted mode, the file that this filer accepts is not processed and vice versa. Normal mode means that a file is processed (the CDirEnumerator::Process method is called for that file), if the filter accepts the file.
- Parameters
-
bInverted | true to make the filter operate in an inverted mode or false to make the filter operate in a normal mode. |
- See Also
- HandlesInversion
-
IsInverted
The documentation for this class was generated from the following file: