|
Boost : |
From: mfdylan (dylan_at_[hidden])
Date: 2002-02-15 00:16:58
--- In boost_at_y..., "davlet_panech" <davlet_panech_at_y...> wrote:
> Hello,
>
> Is there any interest in a filename parser library?
>
There has been a discussion about it recently if you search back
through the archives.
I started writing one more or less modelled on POSIX basename and
dirname, with an additional 'suffix' call.
There's a couple of things it doesn't handle yet, like joining a
directory name to a filename (ie, what delimiters to put in between)
and making absolute and relative versions of pathnames.
Dealing with various platform differences is perhaps the main
challenge: for a start I need to be able to construct and parse
pathnames for multiple OS's regardless of the currently running OS
(example: I send commands to unix machines from NT and need to
manipulate pathnames in the command lines).
Things like case-sensitivity are almost impossible to deal with
effectively, as under NT at least, you can have both case-insensitive
and case-sensitive filenames.
This means code like
if (pname.suffix() == ".cpp")
...
which I support by having suffix return a new pathname object and
overloading 'operator==' becomes awkward to write well. For the time
being I use a set of traits, with the default being platform
specific, such that win32_traits::ignore_case() returns true.
Anyway, read the previous articles, there are quite a few awkward
decisions you have to make in any design for this sort of thing.
Dylan
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk