|
Boost : |
Subject: Re: [boost] Library for configuration file parsing
From: Stewart, Robert (Robert.Stewart_at_[hidden])
Date: 2010-11-29 14:39:42
Denis Shevchenko wrote:
> On 29.11.2010 20:49, Hal Finkel wrote:
>
> > In my opinion, just provide a reload function.
> Already. There are two functions:
> - configurator::reparse()
> - configurator::reparse( const std::string& path_to_new_configuration_file )
>
> First variant for reparsing "old" configuration file, second - for
> reparsing new configuration file.
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.)
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? In that case, the parse()/load() function would need to distinguish between replacing and augmenting the existing content or you'd need to distinguish the function names further:
// reload contents from files used to generate current contents
reload();
// replace current contents with that from a new file
replace(std::string const &);
// augment current contents with that from a new file
append(std::string const &);
Do you support programmatic manipulations of the configuration values? That implies returning references to the configuration values or providing a pub/sub mechanism for learning of changes. That, in turn, means that reloading or replacing content must invalidate outstanding references/subscriptions (though subscriptions could survive if the value in question exists after the update and still refers to the same type, if there are types).
Do you support references among configuration values? Doing so permits some helpful use cases. (Just think about augmenting a shell's PATH versus replacing it outright.)
_____
Rob Stewart robert.stewart_at_[hidden]
Software Engineer, Core Software using std::disclaimer;
Susquehanna International Group, LLP http://www.sig.com
IMPORTANT: The information contained in this email and/or its attachments is confidential. If you are not the intended recipient, please notify the sender immediately by reply and immediately delete this message and all its attachments. Any review, use, reproduction, disclosure or dissemination of this message or any attachment by an unintended recipient is strictly prohibited. Neither this message nor any attachment is intended as or should be construed as an offer, solicitation or recommendation to buy or sell any security or other financial instrument. Neither the sender, his or her employer nor any of their respective affiliates makes any warranties as to the completeness or accuracy of any of the information contained herein or that this message or any of its attachments is free of viruses.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk