Boost property tree seems like an excellent library to use for parsing config files. However, I can't figure out how to handle situations where there are multiple values per key. For example, let's say I was specifying a box like this:
box
{
x -1 1
y -1 1
z -1 1
}
where x
, y
, and z
are the bounds of the box on the x
, y
, and z
axes respectively, specified using property_tree's INFO format. I see mention in the manual of using quotes for values that use spaces, but then I don't see that I could import those values as numbers. I'd have to parse the string into numbers, which seems to defeat the purpose of using property_tree in the first place. I could certainly give each number a key:
box
{
xlo -1
xhi 1
ylo -1
yhi 1
zlo -1
zhi 1
}
but that seems cumbersome, and will inflate my config file. I also noted that I could handle this situation in program_options, but I lose the nested config file capabilities (yeah, I know I can use dot notation to "nest", but it's not the same).
Is there a way to import e.g. x as a list of numbers like this?
See Question&Answers more detail:os