|
Boost Users : |
Subject: Re: [Boost-users] Having program_options generate a round-trippable config file?
From: André Prins (a.h.prins_at_[hidden])
Date: 2011-01-19 05:56:29
> ... I'd like to save a
> program_options::parse_config_file-friendly file containing the final
> values obtained. Such a config file could be given back to the
> program and would identically reproduce the options used.
Hi Rhys,
About a year ago, I had a similar need and wrote a crude but useful Settings
class with save() and load() methods. I am not saying it is immediately fit
for purpose, as it was specifically tailored to my own needs, but perhaps it
can serve as inspiration
> 1) Accessing the information directly from variables_map seems
> difficult due to variables_map's use of type erasure and the fact that
> it does not save the tokens from which values are derived.
>
I seem to recollect that the save() method did exactly this: iterating
through the variable_map. I used some string manipulation to split
section-names from actual value-names, but that was all.
Regards,
Andre
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net