Boost logo

Boost Users :

Subject: [Boost-users] Boost Program Options: Any way to have variable number of "objects" each with parameters?
From: Charles Mills (charlesm_at_[hidden])
Date: 2012-06-20 21:19:40


I really like the Boost Program Options library. I've used it for one
program now with great effect and I'd like to use it for another, but can't
figure out how to structure what I need to do so that Boost PO could handle
it.

 

I am solely interested in the ".ini file" for this - command line is
irrelevant.

 

The problem is "how does a program allow the specification of a variable
number of 'objects' each of which has parameters of its own?"

 

Here is a hypothetical program that exemplifies the problem. Suppose a
program were going to create multiple geometric shapes of some sort. An
ideal (unsupported by PO) .ini file might look like

 

rectangles=3

rectangle[0].width=5

rectangle[0].height=10

rectangle[1].width=3

etc.

circles=2

circle[0].diameter=4

etc.

 

Can anyone suggest a way to accomplish this with Boost PO? I'm real flexible
on what the .ini file might look like so long as it solves the problem and
is reasonably explicable to a user. (No need for it to look almost like the
above.)

 

Thanks,

 

Charles



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