From: John Maddock (John_Maddock_at_[hidden])
Date: 2002-01-27 08:03:55
I'm really pleased to see someone working on this, however I'm not sure
that we have the right interface yet, on the whole I prefer
but a few extra design considerations should be in order:
the class should be a template with narrow and wide character versions (I'm
not actually sure if a wide character version is possible on non-win32
systems unless there are OS-specific rather than POSIX-standard API's
available, but that's another issue):
template <class charT, class traits=std::char_traits<charT>, class
typedef basic_pathname<char> pathname;
typedef basic_pathname<wchar_t> wpathname; // or similar names....
For the interface - we already have the basics - it should be an immutable
sequence (23.1.1) - and in addition support some of the extra interfaces
analogous to those of std::basic_string:
typedef std::basic_string<charT, traits, Allocator> string_type;
which just leaves the pathname-specific member functions (probably more
BTW member functions like parent()const; should return a pathname not a
string. We also need static member functions for:
the current directory (absolute).
the current directory (relative - ie ./).
the parent directory (relative ie ../).
BTW I am open to the issue of whether there should be separate classes for
filenames and pathnames - although logically they are probably the same
thing. I would also like to see a directory_iterator/file_iterator classes
which enumerated pathnames (note not strings!), there is something like
this already in boost - both Dietmar's dirit lib and in
boost/regex/detail/fileiter.hpp. Neither are perfect, but both could be
scavenged for code and ideas. Finally we also need a way to enumerate
directories in the PATH, and to find the first directory in the PATH which
has a particular file.
whew, enough for now :-)
- John Maddock
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk