Subject: Re: [boost] [filesystem] #6521 Directory listing using C++11 range-based for loops
From: Thorsten Ottosen (thorsten.ottosen_at_[hidden])
Date: 2012-04-23 11:37:39
On 20-04-2012 14:35, Beman Dawes wrote:
> On Fri, Apr 20, 2012 at 5:24 AM, Thorsten Ottosen
>> boost::directory_range( const boost::path&, const boost::regex& toExclude )
> is even better:-)
>> Especially for recursive iteration, it is useful to skip entire directories.
> Mind-blowing! Your suggestion is getting very close to a solution for
> the general directory search problem I've wrestled with for years.
> What we would really like is to be able to apply a series of filters,
> some of which apply to directories, some to files. Examples are your
> include|exclude regex filters, applicable to directories|files|both.
> Another filter might be a file filter<=|>= a given size. Dates and
> permissions filters would also be useful. Perhaps user supplied
> filters. And how about filters applied to the contents of files?
I can see those would be useful.
>> Remark: such support is probably most naturally added to the underying
>> iterator classes by storing some boost::optional<> variables.
> I'll need to think about that - it will take me a while to digest this.
Just one remark: The filesystem library may invent its own | syntax for
filter which need not be compatiable with e.g. Boost.Range's adaptors.
In a sence, we could just be allowed to write
directory_filter( "..." ) |
filename_filter( "..." ) |
filestamp_filter( "..." ) |
filesize_filter( "..." ) |
custom_filter( ... ) );
Then all the metaprogramming logic can be done internally in
boost.filesystem, detecting logical errors and rearranging the filters
such that the most beneficial one is run first etc.
just my two cents
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk