|
Boost : |
From: Vladimir Prus (ghost_at_[hidden])
Date: 2004-11-24 02:19:03
Hi Frank,
> For example, to connect different databases according to different
> requests, there are some options stored in a config file, like this:
>
> [DB1]
> server=172.16.21.1
> database=dbname1
> userid=someone1
> password=xxxxxx
>
> [DB2]
> server=172.16.21.2
> database=dbname2
> userid=someone2
> password=oooooo
>
> i.e. with same key name in different sectors.
Yes, you'd just use the syntax above. The library would interpret the above
as
DB1.server=172.16.21.1
....
DB2.server=172.16.21.1
In other words, it would prepend the name of the section to the name of the
option.
For your use case, you might want to look at one of the examples:
http://zigzag.lvk.cs.msu.su/~ghost/boost/libs/program_options/example/dynamic.cpp
http://zigzag.lvk.cs.msu.su/~ghost/boost/libs/program_options/example/dynamic.cfg
which unfortunately is not committed yet.
- Volodya
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk