From 5434561948021537875
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,11fbc0471f50a737
X-Google-Attributes: gidf78e5,public
From: Dave Levitt <dlevitt.no.spam.please@ibm.net>
Subject: Re: What next for Standard C++ Library? - Filenames
Date: 1997/11/05
Message-ID: <3460C941.5AA4276B@ibm.net>#1/1
X-Deja-AN: 287243190
References: <345F3A08.8C8FC636@ibm.net> <63nsba$i17@drn.zippo.com>
X-Original-Date: Wed, 05 Nov 1997 14:30:09 -0500
Organization: -
X-Auth: PGPMoose V1.1 PGP comp.std.c++ iQBFAgUANGDSOOEDnX0m9pzZAQFPjQF/QKo7CFz8rEUUN6tNrbr6lOmYfR1gFPug Z9QaEnHSEKTzOAX+4BvFtAHNj953Jx73 =/8pq
Newsgroups: comp.std.c++


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                             ]



