CZipArchive::CWildcard Class Reference

A class used in wildcard pattern matching. More...

#include <ZipArchive.h>

List of all members.

Public Types

enum  Match {
  matchNone, matchValid, matchEnd, matchAbort,
  matchRange, matchLiteral, matchPattern
}
enum  Pattern {
  patternEmpty = -4, patternClose, patternRange, patternEsc,
  patternValid
}

Public Member Functions

bool IsMatch (LPCTSTR lpszText, int *iRetCode=NULL)
 Match the pattern against the string lpszText A match means the entire string lpszText is used up in matching.
 CWildcard ()
 CWildcard (LPCTSTR lpszPattern, bool bCaseSensitive)
 Initialize the pattern.
virtual ~CWildcard ()
void SetPattern (LPCTSTR lpszPattern, bool bCaseSensitive)
 Set the pattern to lpszPattern.
 operator LPCTSTR ()

Static Public Member Functions

static bool IsPattern (LPCTSTR lpszPattern)
static bool IsPatternValid (LPCTSTR lpszPattern, int *iErrorType=NULL)
 Test the pattern for validity.
static int Match (LPCTSTR lpszPattern, LPCTSTR lpszText)
 Match the pattern lpszPattern against the string lpszText A match means the entire string lpszText is used up in matching.

Static Protected Member Functions

static int MatchAfterStar (LPCTSTR p, LPCTSTR t)

Protected Attributes

bool m_bCaseSensitive
CZipString m_szPattern


Detailed Description

A class used in wildcard pattern matching.

This class is based on code by J. Kercheval, created 01/05/1991 and available as a public domain at http://www.snippets.org.

Definition at line 1708 of file ZipArchive.h.


Member Enumeration Documentation

enum CZipArchive::CWildcard::Match
 

Enumerator:
matchNone  for internal use
matchValid  valid match
matchEnd  premature end of pattern string
matchAbort  premature end of text string
matchRange  match failure on [..] construct
matchLiteral  match failure on literal match
matchPattern  bad pattern

Definition at line 1713 of file ZipArchive.h.

enum CZipArchive::CWildcard::Pattern
 

Enumerator:
patternEmpty  [..] construct is empty
patternClose  no end bracket in [..] construct
patternRange  malformed range in [..] construct
patternEsc  literal escape at end of pattern
patternValid  valid pattern

Definition at line 1724 of file ZipArchive.h.


Constructor & Destructor Documentation

CZipArchive::CWildcard::CWildcard LPCTSTR  lpszPattern,
bool  bCaseSensitive
[inline]
 

Initialize the pattern.

See also:
SetPattern

Definition at line 1787 of file ZipArchive.h.


Member Function Documentation

bool CZipArchive::CWildcard::IsMatch LPCTSTR  lpszText,
int *  iRetCode = NULL
 

Match the pattern against the string lpszText A match means the entire string lpszText is used up in matching.

Parameters:
lpszText the string to match against
iRetCode if not NULL, set to one of Match values indicating the return code
Returns:
true if lpszText matches the pattern.
See also:
SetPattern

static bool CZipArchive::CWildcard::IsPattern LPCTSTR  lpszPattern  )  [static]
 

Parameters:
lpszPattern 
Returns:
true if lpszPattern has any special wildcard characters.

static bool CZipArchive::CWildcard::IsPatternValid LPCTSTR  lpszPattern,
int *  iErrorType = NULL
[static]
 

Test the pattern for validity.

Parameters:
lpszPattern the pattern to test
iErrorType if not NULL, set to one of Pattern values indicating the return code
Returns:
true if lpszPattern is a well formed regular expression according to the CWildcard class syntax (see SetPattern)

static int CZipArchive::CWildcard::Match LPCTSTR  lpszPattern,
LPCTSTR  lpszText
[static]
 

Match the pattern lpszPattern against the string lpszText A match means the entire string lpszText is used up in matching.

Parameters:
lpszPattern see SetPattern
lpszText the string to match against
Returns:
one of Match values

void CZipArchive::CWildcard::SetPattern LPCTSTR  lpszPattern,
bool  bCaseSensitive
[inline]
 

Set the pattern to lpszPattern.

Parameters:
lpszPattern In the pattern string:
  • * matches any sequence of characters(zero or more)
  • ? matches any character
  • [SET] matches any character in the specified set,
  • [!SET] or[^SET] matches any character not in the specified set.
A set is composed of characters or ranges; a range looks like character hyphen character(as in 0 - 9 or A - Z).[0 - 9a - zA - Z_] is the minimal set of characters allowed in the[..] pattern construct. Other characters are allowed(ie. 8 bit characters) if your system will support them.

Note:
To suppress the special syntactic significance of any of []*?!^-\, and match the character exactly, precede it with a \
Parameters:
bCaseSensitive if true, the pattern is case-sensitive

Definition at line 1814 of file ZipArchive.h.


The documentation for this class was generated from the following file:
ZipArchive Copyright © 2000 - 2006 Tadeusz Dracz . Generated at Fri Apr 7 13:55:24 2006.