I'm looking for a cross-platform C++ lighweight configuration library with non restrictive licence. I need something more complex than standard properties file with sections, but I don't want to use XML (too much writing :-)).
I would like to write configuration this way:
render =
{
window =
{
width = 800,
height = 600
}
}
There's boost's property_tree. The license allows commercial use.
Your example:
ptree pt;
pt.put("render.window.width", 800);
pt.put("render.window.height", 600);
This can e.g. be exported to JSON
write_json("my_config.json", pt);
which will then look like
{
"render":
{
"window":
{
"width": 800;
"height": 600;
}
}
}
The same way you can export to XML, INI and INFO.
You can also try JsonCpp and write your configuration files in Json
, which has a very similar syntax to the one you like:
// Configuration options
{
// Default encoding for text
"encoding" : "UTF-8",
// Plug-ins loaded at start-up
"plug-ins" : [
"python",
"c++",
"ruby"
],
// Tab indent size
"indent" : { "length" : 3, "use_space": true }
}
Is under the MIT License
so it's very permissive.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With