Hi Ovanes!
Thanks for the explanation. I'll try it.

On Tue, Apr 1, 2008 at 4:42 PM, Ovanes Markarian <om_boost@keywallet.com> wrote:
Silvio,

you have to implement it yourself. You could use a boost regular expression lib or xpressive lib, to match mask(s) with file names found. I would suggest to take a look at boost iterator lib. Using the regex to match the mask + wrapping the directory_iterator into filetered_iterator will do the job.



Best Regards,
Ovanes

On Tue, Apr 1, 2008 at 6:25 PM, Silvio Reis Junior <sreisjr@gmail.com> wrote:
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 mailing list
Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users


_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users