Wildcard.h
Go to the documentation of this file.
1 
2 // This source file is part of the ZipArchive library source distribution and
3 // is Copyrighted 2000 - 2013 by Artpol Software - Tadeusz Dracz
4 //
5 // This program is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License
7 // as published by the Free Software Foundation; either version 2
8 // of the License, or (at your option) any later version.
9 //
10 // For the licensing details refer to the License.txt file.
11 //
12 // Web Site: http://www.artpol-software.com
14 
15 /*
16  This class is based on code by J. Kercheval, created 01/05/1991
17  and available as a public domain at http://www.snippets.org.
18 */
19 
26 #if !defined(ZIPARCHIVE_WILDCARD_DOT_H)
27 #define ZIPARCHIVE_WILDCARD_DOT_H
28 
29 #if _MSC_VER > 1000
30  #pragma once
31  #if (_MSC_VER > 1000) && (defined ZIP_HAS_DLL)
32  #pragma warning( push )
33  #pragma warning( disable : 4251 ) // needs to have dll-interface to be used by clients of class
34  #endif
35 #endif
36 
37 #include "ZipString.h"
38 
39 namespace ZipArchiveLib
40 {
47  class ZIP_API CWildcard
48  {
49  public:
50 
51  enum Match
52  {
59  matchPattern
60  };
61 
62  enum Pattern
63  {
64  patternEmpty = -4,
69  };
70 
71 
89  bool IsMatch(LPCTSTR lpszText, int* iRetCode = NULL);
90 
101  static bool IsPattern(LPCTSTR lpszPattern);
102 
116  static bool IsPatternValid(LPCTSTR lpszPattern, int* iErrorType = NULL);
117 
135  static int Match(LPCTSTR lpszPattern, LPCTSTR lpszText);
136 
141 
154  CWildcard(LPCTSTR lpszPattern, bool bCaseSensitive)
155  {
156  SetPattern(lpszPattern, bCaseSensitive);
157  }
158 
159  virtual ~CWildcard(){}
160 
173  void SetPattern(LPCTSTR lpszPattern, bool bCaseSensitive)
174  {
175  m_szPattern = lpszPattern;
176  m_bCaseSensitive=bCaseSensitive;
177  if (!bCaseSensitive)
178  m_szPattern.MakeLower();
179  }
180  operator LPCTSTR()
181  {
182  return (LPCTSTR)m_szPattern;
183  }
184  private:
185  bool m_bCaseSensitive;
186  static int MatchAfterStar(LPCTSTR p , LPCTSTR t);
187  CZipString m_szPattern;
188  };
189 }
190 
191 #if (_MSC_VER > 1000) && (defined ZIP_HAS_DLL)
192  #pragma warning (pop)
193 #endif
194 
195 #endif

The ZipArchive Library Copyright © 2000 - 2013 Artpol Software - Tadeusz Dracz. Generated at Fri Dec 13 2013 00:05:37.