|
Boost : |
From: Vladimir Prus (ghost_at_[hidden])
Date: 2004-03-19 09:10:19
Hi Janusz,
> I try to use program_options for single config file, with
> options_description where all options are mapped to variables (
> value<T>(&variable)->default_value(x) ). For now, i must use extra
> variable_map, it's possible to omit it?
No -- I meant variables_map to be the primary interface. However, I think that
in your case, the only drawback is extra lines in the code. Or there's
something else?
> And, second question, do you think about interface to create own
> validators?
This depends on your definition of validator. Is that's a function to check
that the value is withing valid range, or something like that, you can use
'notifier'.
If you want to customize the parsing, the current way is:
1. Declare some class derived from typed_value<YourType> and override the
'parse' method.
2. Specialize the 'value' function to return instance of your type.
HTH,
Volodya
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk