Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version

Fast regular expressions

, 29 Oct 2000
Compiles a regular expression into a fast automaton.
// FileFindRecursive.h: Schnittstelle f�r die Klasse CFileFindRecursive.

#if !defined(AFX_FILEFINDRECURSIVE_H__C340CE26_9439_11D4_86C5_1E1BBD000000__INCLUDED_)
#define AFX_FILEFINDRECURSIVE_H__C340CE26_9439_11D4_86C5_1E1BBD000000__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include <vector>
using namespace std;

class CFileFindRecursive{
          CString strStartDirectory,
          CString strWildCards,
          bool (*pProcessFile)(const char* pcszPathName,const char* pcszFileName,void* pData),
          void* pData)
          int nPosPrev,nPos;
		  if( strWildCards.GetLength()>1 && strWildCards.Right(1)!=_T(";") ){
			  strWildCards+= _T(";");
          for(  nPos=0,nPosPrev=0; 
                (nPos= strWildCards.Find(';',nPos))!=-1;
              m_strWildCard= strWildCards.Mid(nPosPrev,nPos - nPosPrev);
    void FindInThisDirectory(CString strDir)
        CFileFind findFile;
        if( findFile.FindFile(strDir+"\\"+m_strWildCard) ){
            if( m_bCanceled )
                if( !findFile.IsDirectory() ){
                    m_bCanceled= !m_pFuncProcessFile(findFile.GetFilePath(),
                    if( m_bCanceled )
    void Recurse(CString str)
        CFileFind finder;
        CString strWildcard(str);
        strWildcard += _T("\\*.*");   // start working for files
        BOOL bWorking = finder.FindFile(strWildcard);   
        while (bWorking){
            if( m_bCanceled )
            bWorking = finder.FindNextFile();
            if (finder.IsDots())         continue;
            if (finder.IsDirectory()){

    CString             m_strWildCard;
    bool                m_bCanceled;
    bool (*m_pFuncProcessFile)(const char* pcszPathName,const char* pcszFileName,void* pData);
    void* m_pData;

#endif // !defined(AFX_FILEFINDRECURSIVE_H__C340CE26_9439_11D4_86C5_1E1BBD000000__INCLUDED_)

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

Martin Holzherr

Switzerland Switzerland
No Biography provided

| Advertise | Privacy | Mobile
Web03 | 2.8.140721.1 | Last Updated 30 Oct 2000
Article Copyright 2000 by Martin Holzherr
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid