Topic: What next for Standard C++ Library? - Filenames
Author: david.tribble@nospam.central.beasys.com
Date: 1997/11/05 Raw View
In article <345F3A08.8C8FC636@ibm.net>, Dave suggests:
>
> A suggestion:
> 1) A class patterned after Java's File class, encapsulating platform
> dependant filesystem naming and access control conventions. Additional
> [overloaded] constructors for things like streams that open operating
> system files could also take references to instances of a C++ file
> class.
It could be patterned after the filename object defined by Common Lisp,
which seems to cover the needs of most operating systems. (See "Common Lisp"
by Guy Steels, chap.23.)
A filename object contains these components (some of which are null or
defaulted if they don't make sense on the current OS):
host - Name of the file system
device - Device or file structure
directory - Directory path prefix
name - File name
type - File type or extension
version - Version or generation number
Some systems use all the fields (such as VMS, with filenames like
"RTFM::USR:[LIB.SOURCE]CTYPE.C;12") while other systems use only a
few (like Unix, with filenames like "/lib/source/ctype.c").
A few constants are also defined, such as:
NAME_WILD - Wildcard name
TYPE_WILD - Wildcard type
VERS_NEWEST - Newest file version number
VERS_PREV - Previous version num
VERS_OLDEST - Oldest existing version num
etc.
There are functions for comparing and validating filenames, splitting and
merging components of filenames, etc. Of course, we would also need
functions to convert a Filename object into something suitable for passing
to fopen() et al, as well as converting command line argument strings into
Filename objects.
[Standard disclaimer: Of course, it's already too late for C and C++.]
-- david.tribble@noSPAM.central.beasys.com --
---
[ comp.std.c++ is moderated. To submit articles: try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ FAQ: http://reality.sgi.com/employees/austern_mti/std-c++/faq.html ]
[ Policy: http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu ]
Author: Dave Levitt <dlevitt.no.spam.please@ibm.net>
Date: 1997/11/05 Raw View
Probably a 'File' class could have member functions like:
File::string toUNC()
File::string toURL()
File::string toPath(); [java has 'Cannonical' and 'Absolute' paths]
david.tribble@nospam.central.beasys.com wrote:
> In article <345F3A08.8C8FC636@ibm.net>, Dave suggests:
> >
> > A suggestion:
> > 1) A class patterned after Java's File class, encapsulating platform
> > dependant filesystem naming and access control conventions. Additional
> > [overloaded] constructors for things like streams that open operating
> > system files could also take references to instances of a C++ file
> > class.
>
> It could be patterned after the filename object defined by Common Lisp,
> which seems to cover the needs of most operating systems. (See "Common Lisp"
> by Guy Steels, chap.23.)
>
> A filename object contains these components (some of which are null or
> defaulted if they don't make sense on the current OS):
>
> host - Name of the file system
> device - Device or file structure
> directory - Directory path prefix
> name - File name
> type - File type or extension
> version - Version or generation number
>
> Some systems use all the fields (such as VMS, with filenames like
> "RTFM::USR:[LIB.SOURCE]CTYPE.C;12") while other systems use only a
> few (like Unix, with filenames like "/lib/source/ctype.c").
>
> A few constants are also defined, such as:
> NAME_WILD - Wildcard name
> TYPE_WILD - Wildcard type
> VERS_NEWEST - Newest file version number
> VERS_PREV - Previous version num
> VERS_OLDEST - Oldest existing version num
> etc.
>
> There are functions for comparing and validating filenames, splitting and
> merging components of filenames, etc. Of course, we would also need
> functions to convert a Filename object into something suitable for passing
> to fopen() et al, as well as converting command line argument strings into
> Filename objects.
>
> [Standard disclaimer: Of course, it's already too late for C and C++.]
---
[ comp.std.c++ is moderated. To submit articles: try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ FAQ: http://reality.sgi.com/employees/austern_mti/std-c++/faq.html ]
[ Policy: http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu ]