Boost logo

Boost Users :

From: Silvio Reis Junior (sreisjr_at_[hidden])
Date: 2008-04-01 12:25:52


Hi all!
I'm trying to learn how to use boost and for a first exercise I chose to
create a class to perform files enumeration.
The code below works fine but I didn't find a way to set a search mask with
wild card, example: *.jpeg or test???.*
How can I do it?

//-------------------------------------------------------------------
VOID CFileSearch::InternalSearch( path RootDir, string Mask )
{
    directory_iterator EndDirItr;
    string OutPut;
    for ( directory_iterator DirItr( RootDir ); DirItr != EndDirItr;
++DirItr )
    {
        if ( is_regular( DirItr->status() ) )
        {
             m_FileCount++;
             OutPut = "FILE: " + DirItr->path().string();
             _tprintf( _T( "%s\n" ), OutPut.c_str() );
        }
        else
        {
            InternalSearch( DirItr->path(), Mask );
        }
    }
}

//-------------------------------------------------------------------
VOID CFileSearch::Search( string RootDir, string Mask )
{
    path TempRootDir = system_complete( path( RootDir, native ) );
    if ( exists( TempRootDir ) == true )
    {
        InternalSearch( TempRootDir, Mask );
        _tprintf( _T( "%d files found\n" ), m_FileCount );
    }
}



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net