Boost logo

Boost :

Subject: Re: [boost] Library for configuration file parsing
From: Denis Shevchenko (for.dshevchenko_at_[hidden])
Date: 2010-11-29 15:43:42

On 29.11.2010 22:39, Stewart, Robert wrote:
> One cannot reparse what hasn't been parsed. I suggest "reparse" and "parse" or "reload" and "load" for those two functions. (The latter pair is slightly easier to say.)
Hello Robert!

"Parse" and "load". Strictly speaking you are right, because parsing is
just one of the steps work with the configuration file. So from a
technical point of view the name "load" preferably than "parse". Thanks.
> Have you considered the ability to parse multiple files thereby augmenting the data with each new file's content rather than replacing what had been parsed already?
Confess, I have not thought about it. Do you think this possibility is
really useful?
> That, in turn, means that reloading or replacing content must invalidate outstanding references/subscriptions
I do not use references. If in configuration file exists option "Host":
and we register it:
cf::configurator.add_option( "Host" ).default_value( "" );

then after parsing we have object cf::option with name "Host" and with
value "" (that is, in fact, two std::string). If user obtains
it value:
std::string host = cf::configurator.get_value( "Host" );

he just gets a copy of "".

And if configuration will be changed:
and after that user calls reparse() function, value of corresponding
object cf::option (with name "Host") will be replaced by "".
After that user can obtain (already new) value:
std::string host = cf::configurator.get_value( "Host" );

And if after that user again changes configuration file and comment out
"Host" option:
// Host
and calls reparse() function, and obtains it value:
std::string host = cf::configurator.get_value( "Host" );

he gets a copy of initial default value "".

- Denis

Boost list run by bdawes at, gregod at, cpdaniel at, john at