ZipArchiveLib::CFileFilter Class Reference

#include <FileFilter.h>

Inheritance diagram for ZipArchiveLib::CFileFilter:

Inheritance graph
[legend]

List of all members.

Public Member Functions

 CFileFilter (bool bInverted=false)
bool Evaluate (LPCTSTR lpszParentDir, LPCTSTR lpszName, const CFileInfo &info)
virtual bool HandlesFile (const CFileInfo &info)
bool IsInverted () const
void SetInverted (bool bInverted=true)

Protected Member Functions

virtual bool Accept (LPCTSTR lpszParentDir, LPCTSTR lpszName, const CFileInfo &info)
virtual bool HandlesInversion () const

Protected Attributes

bool m_bInverted


Detailed Description

A base class for filters used in the directory enumeration process.

See also:
Compressing Data

CDirEnumerator::Start

Definition at line 48 of file FileFilter.h.


Constructor & Destructor Documentation

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

Definition at line 61 of file FileFilter.h.


Member Function Documentation

virtual bool ZipArchiveLib::CFileFilter::Accept ( LPCTSTR  lpszParentDir,
LPCTSTR  lpszName,
const CFileInfo info 
) [inline, protected, virtual]

This method is directly called by the Evaluate method during an enumeration process.

If this method returns true, the file will later be processed by the CDirEnumerator::Process method. If this method returns false for a directory, the directory is not enumerated at all.

The meaning of the return value can be reversed by the SetInverted method. If this filter handles the inversion internally, the return value from this method is not reversed by the Evaluate method.

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; false otherwise.
See also:
Evaluate

HandlesInversion

CDirEnumerator::Start

CDirEnumerator::Process

Reimplemented in ZipArchiveLib::CNameFileFilter, and ZipArchiveLib::CGroupFileFilter.

Definition at line 210 of file FileFilter.h.

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

Definition at line 106 of file FileFilter.h.

virtual bool ZipArchiveLib::CFileFilter::HandlesFile ( const CFileInfo info  )  [inline, virtual]

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::CNameFileFilter, and ZipArchiveLib::CGroupFileFilter.

Definition at line 169 of file FileFilter.h.

virtual bool ZipArchiveLib::CFileFilter::HandlesInversion (  )  const [inline, protected, virtual]

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.

Definition at line 236 of file FileFilter.h.

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

Definition at line 143 of file FileFilter.h.

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

Definition at line 130 of file FileFilter.h.


The documentation for this class was generated from the following file:

The ZipArchive Library Copyright © 2000 - 2009 Artpol Software - Tadeusz Dracz. Generated at Fri Apr 24 16:46:41 2009.