Boost logo

Boost :

From: Jeff Garland (jeff_at_[hidden])
Date: 2002-03-07 16:58:41


Sorry if this comes twice....

> -----Original Message-----
> From: Jan Langer [mailto:jan_at_[hidden]]
> Sent: Thursday, March 07, 2002 2:50 PM
> To: 'boost_at_[hidden]'
> Subject: RE: [boost] Re: Design for a file system library
>
>
> On Thu, 7 Mar 2002, Stewart, Robert wrote:
> >So you're saying that hierarchy_iterator is something that you instantiate
> >to find what things are available, on the local filesystem, to iterate with
> >directory_iterator?
>
> exactly.

I like what you want to do with hierarchy_iterator except I see no need for a
different type. It is plain and simple a directory_iterator. Consider the
following:

class directory_iterator {
public:
  enum special_locations {roots, current_working, current_root};
  directory_iterator(special_locations);
  //...
};

On Unix
  directory_iterator ditr(directory_iterator::roots) ditr; // will return "/"

On Unix
  directory_iterator ditr(directory_iterator::roots) ditr; // will return "A:\
C:\ ..."

I think this could be done portably and still no global state. Of course, no
guarantees if someone mounts a new drive or changes the current working
directory after iteration has begun....

Jeff


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