Boost logo

Boost :

From: Fernando Cacciola (fcacciola_at_[hidden])
Date: 2002-01-23 13:20:25


----- Original Message -----
From: Vladimir Prus <ghost_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Wednesday, January 23, 2002 3:04 PM
Subject: Re: [boost] environment variable access

> Fernando Cacciola wrote:
>
> > I'll drop in out of context because I considered once something that
might
> > be relevant to this thread.
> > Accessing environment variables has a LOT in common with accessing
windows
> > registry or configuration file variables.
>
> True. And it has a lot of common with command line options. Some time ago
I
> found it quite convenient to have config file and command line to work
> together: config file has many options and command line can override some
of
> them.
>
Yes, I forgot about command line options.

> > Could it be possible that the people working on this consider a
generalized
> > external source variable accessing framework?
> > Would this be too much of a burden?
> >
> > I'm thinking about something that would look like:
> >
> > string location = external::get(env(),"LOCATION", "c:/");
> > string user = external::get(registry(),"UserName", "c:/");
>
> What I'd like (and what I'm trying to implement in command line/config
file
> parser) is map like interface. So that one could be able to say
>
> environment["http_proxy"].as<ip_address>()
>
> where "as" method is a shortcut to lexical_cast/any_cast.
>
This interface looks interesting.
I guess that 'string' would be a good (safe) default type, so that:

environment["http_proxy"]

returns a proxy that can be implicitly converted to a string,
and if concatenated with 'as<>' translate the string using lexical_cast<>.

This proxy could also provide, environment["http_proxy"].exist(), for
instance.

Fernando Cacciola
Sierra s.r.l.
fcacciola_at_[hidden]
www.gosierra.com


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk