1 /////////////////////////////////////////////////////////////////////////////
2 // FileFilterMgr.h : declaration file
4 // The FileFilterMgr loads a collection of named file filters from disk,
5 // and provides lookup access by name, or array access by index, to these
6 // named filters. It also provides test functions for actually using the filters.
7 /////////////////////////////////////////////////////////////////////////////
9 // This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
10 // This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
11 // You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
12 /////////////////////////////////////////////////////////////////////////////
14 #ifndef FileFilter_h_included
15 #define FileFilter_h_included
17 // Uses MFC C++ template containers
18 #ifndef __AFXTEMPL_H__
30 // Reload filter array from specified directory (passed to CFileFind)
31 void LoadFromDirectory(LPCTSTR szPattern);
33 // access to array of filters
34 int GetFilterCount() const { return m_filters.GetSize(); }
35 CString GetFilterName(int i);
36 FileFilter * GetFilter(LPCTSTR szFilterName);
38 // methods to actually use filter
39 BOOL TestFileNameAgainstFilter(FileFilter * pFilter, LPCTSTR szFileName);
40 BOOL TestDirNameAgainstFilter(FileFilter * pFilter, LPCTSTR szDirName);
43 // Implementation methods
45 // Clear the list of known filters
46 void DeleteAllFilters();
47 // Load a filter from a file (if syntax is valid)
48 void LoadFilterFile(LPCTSTR szFilepath, LPCTSTR szFilename);
50 // Implementation data
52 CTypedPtrArray<CPtrArray, FileFilter *> m_filters;
56 #endif // FileFilter_h_included