Skip Navigation Links
Skip Navigation LinksHome > ZipArchive > How to Use > API Documentation
ZipArchiveLib::CNameFileFilter Class Reference

#include <FileFilter.h>

Inheritance diagram for ZipArchiveLib::CNameFileFilter:
Inheritance graph

Public Types

enum  AppliesToTypes { toFile = 0x1, toDirectory = 0x2, toAll = toFile | toDirectory }
 

Public Member Functions

bool AppliesToType (int iType)
 
 CNameFileFilter (LPCTSTR lpszPattern=_T("*"), bool bInverted=false, int iAppliesToTypes=toFile, bool bCaseSensitive=ZipPlatform::GetSystemCaseSensitivity())
 
int GetAppliesToTypes ()
 
bool HandlesFile (const CFileInfo &info)
 
void SetAppliesToTypes (int iType)
 
- Public Member Functions inherited from ZipArchiveLib::CFileFilter
 CFileFilter (bool bInverted=false)
 
bool Evaluate (LPCTSTR lpszParentDir, LPCTSTR lpszName, const CFileInfo &info)
 
bool IsInverted () const
 
void SetInverted (bool bInverted=true)
 

Protected Member Functions

virtual bool Accept (LPCTSTR, LPCTSTR lpszName, const CFileInfo &info)
 
- Protected Member Functions inherited from ZipArchiveLib::CFileFilter
virtual bool HandlesInversion () const
 

Additional Inherited Members

- Protected Attributes inherited from ZipArchiveLib::CFileFilter
bool m_bInverted
 

Detailed Description

A filter that allows filtering files by a filename mask while an enumeration process.

See Also
Compressing Data
Searching in Archive
CDirEnumerator::Start

Member Enumeration Documentation

The file type to which the CNameFileFilter filter can be applied. You can use the logical OR to combine them.

See Also
SetAppliesToTypes
GetAppliesToTypes
Enumerator:
toFile 

Regular files only.

toDirectory 

Directories only.

toAll 

Both regular files and directories.

Constructor & Destructor Documentation

ZipArchiveLib::CNameFileFilter::CNameFileFilter ( LPCTSTR  lpszPattern = _T("*"),
bool  bInverted = false,
int  iAppliesToTypes = toFile,
bool  bCaseSensitive = ZipPlatform::GetSystemCaseSensitivity() 
)
inline

Initializes a new instance of the CNameFileFilter class.

Parameters
lpszPatternA mask to match against a filename. This filter uses the CWildcard functionality for this purpose.
iAppliesToTypesThe file type to which this filter applies. It an be one or more of the AppliesToTypes values.
bInvertedSet to true to invert the behavior of the filter or to false for the normal behavior.
bCaseSensitivetrue, if the matching process is case-sensitive; false otherwise. By default, a system case-sensitivity setting is used.
See Also
Compressing Data
Searching in Archive
SetInverted
SetAppliesToTypes
CWildcard
ZipPlatform::GetSystemCaseSensitivity

Member Function Documentation

virtual bool ZipArchiveLib::CNameFileFilter::Accept ( LPCTSTR  lpszParentDir,
LPCTSTR  lpszName,
const CFileInfo info 
)
inlineprotectedvirtual

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
lpszParentDirThe parent directory containing the file to accept.
lpszNameThe name of the file to accept (without a path).
infoThe 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 from ZipArchiveLib::CFileFilter.

bool ZipArchiveLib::CNameFileFilter::AppliesToType ( int  iType)
inline

Returns the value indicating whether the filter can be applied to the given iType type.

Parameters
iTypeIt can be one or more of the AppliesToTypes values.
Returns
true, if the filter can be applied to iType type; false otherwise.
See Also
SetAppliesToTypes
GetAppliesToTypes
int ZipArchiveLib::CNameFileFilter::GetAppliesToTypes ( )
inline

Returns the file type to which this filter applies.

Returns
The file type to which this filter applies. It can be one or more of the AppliesToTypes values.
See Also
SetAppliesToTypes
bool ZipArchiveLib::CNameFileFilter::HandlesFile ( const CFileInfo info)
inlinevirtual

Returns the value indicating whether the filter can decide about processing of the info file. The CNameFileFilter returns the value depending on the GetAppliesToTypes value.

Note
To keep traversing directories without adding some of them to the archive, return false from this method for the directory that should be traversed, but not added.
Parameters
infoThe structure containing the information about the file.
Returns
true, if the info file will be evaluated by the Evaluate method; false otherwise.
See Also
GetAppliesToTypes
SetAppliesToTypes

Reimplemented from ZipArchiveLib::CFileFilter.

void ZipArchiveLib::CNameFileFilter::SetAppliesToTypes ( int  iType)
inline

Sets the file type to which this filter applies.

Parameters
iTypeThe file type to which this filter applies. It can be one or more of the AppliesToTypes values.
See Also
GetAppliesToTypes

The documentation for this class was generated from the following file:
Back To Top Up