Boost logo

Boost :

From: Jan Langer (jan_at_[hidden])
Date: 2002-02-25 14:24:48

i uploaded a new version of filesystem which meets bemans requirements.

i have created a class attribute_set (according to dylans proposal). i
implemented only three attributes to provide an example.
a small example:

  directory_iterator i (current_directory <char> ()), end;

  std::size_t ts = 0;
  for (; i != end; ++i)
    attribute_set a (*i);
    require <size <char> > (a);
    require <is_directory <char> > (a);

    std::size_t s = get <size <char> > (a);
    if (!get <is_directory <char> > (a))
      ts += s;

    std::cout << std::setw (12) << s << " " << *i << std::endl;
  std::cout << "\ntotal size: " << ts << "\n";

get() and set() also be called with basic_string as an argument. but in
this case the string is passed to a temporary attribute_set.

several questions which came up during writing:
  - should a posix dir_it skip "." and ".."
  - i currently implemented the classes with basic_ and typedef to avoid
the char template parameter. is this ok?
  - what should the hierarchy iterator do in case of posix? just have
always only one element ("/")?
  - how can i get rid off the <char>'s behind the attributes? it does
not look well.

On Mon, 25 Feb 2002, Beman Dawes wrote:
> >> >>string_t getcwd();
> >> >>bool chdir(name_t name);
> >>
> >> No, not without a lot of discussion. Go back and read the
> >> requirements. Globals are too evil to just casually toss into the
> >hat.
> >>
> >But absolutely necessarily. You can't implement absolute() with it.
>How absolute() does its job internally is an implementation detail; that
>isn't a good argument for exposing getcwd/chdir.

what should absolute() do? it isn't mentioned in the requirements as a

> >I guess if the only access to the current working dir is by calling
> >absolute(".") I'd live with it but I wouldn't be happy.
> >chdir is useful for a few limited purposes, as long as you ensure all
> >relative paths are kept to one thread. It's also useful when forking
> >child processes, but in that case you need a specialised interface,
> >because under NT you have to do it quite differently. I already
> >started work on a class for forking subprocesses, not sure if I
> >posted anything here.
>Everything you at talking about is non-portable. "." for example. Fine if
>you want to do that in your own program, but I'd like that sort of
>non-portable thinking not to seep into the interface.

i would like to see chdir-functions since its not even possible to write
a ls-like-program without it. it is not absolutely necessary but it
would make many things easier (eg. ls).

jan langer ... jan_at_[hidden]
"pi ist genau drei"

Boost list run by bdawes at, gregod at, cpdaniel at, john at