Boost logo

Boost :

From: dylan_at_[hidden]
Date: 2001-11-19 18:06:45


--- In boost_at_y..., dylan_at_m... wrote:
> Just a couple of classes I wrote that I wondered if anyone thought
> any place in boost:
>
> arguments : simple command-line arguments and options parser:

Ok, well it seems like everyone has got their own ideas on this.
Guess we can't expect to see too much agreement in a hurry.

But no comments on the "file_finder"? (the name is based on an MFC
class with similar functionality, I'm open to better ideas)
>
> struct file_finder
> {
> file_finder(const char* pattern);
> ~file_finder();
> typedef const char* const* iterator;
> operator bool() const;
> iterator begin();
> iterator end();
> private:
> glob_t glob_;
> };
>

It doesn't allow access to file info (size, date/time etc) because
glob doesn't do this, and you get this easily enough once you have a
filename. I think something like this needs to be integrated with
the directory iterator stuff already in boost.

Btw the reason for operator bool is to allow:

if (file_finder finder("*.dat"))
{
     file_finder::iterator i = finder.begin();
     do
         process_file(*i);
     while (++i != finder.end();
}
else
    throw no_files_found;

Dylan


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk