martinus
martinus

Reputation: 18063

Good, simple configuration library for large c++ project?

We are developing a rather large project in C++, where many components require configuration parameters. We would like to use a central place to configure everything (like a registry), preferably with a nice and simple GUI (e.g. like Firefox's about:config) and a simple API.

I am pretty sure this that many applications have this kind of problem, but could not find any libraries available that can be readily used for this. Does anyone know of a good (preferably free) library to use for this?

This should work cross platform in Windows and Linux.

Upvotes: 6

Views: 5407

Answers (6)

Marc Lindahl
Marc Lindahl

Reputation: 161

I've used libconfig before, works well easy and LGPL. http://www.hyperrealm.com/libconfig/

Upvotes: 3

Denis Shevchenko
Denis Shevchenko

Reputation: 1448

Try Configurator. There is no GUI, but it's easy-to-use and flexible C++ library for configuration file parsing (from simplest INI to complex files with arbitrary nesting and semantic checking). Header-only and cross-platform. Uses Boost C++ libraries.

See: http://opensource.dshevchenko.biz/configurator

Upvotes: 0

timday
timday

Reputation: 24892

boost::program_options provides unified (and cross platform) support for configuration from command line, environment variables and configuration files. It seems like it ought to scale to multiple bits of a large software system registering an interest in various parameters (e.g option groups). Not much help with the GUI or persistence side of things though (but then what's wrong with editing a config file with a text editor ?).

Upvotes: 6

kevin42
kevin42

Reputation: 2128

I've often used a simple wrapper around pugxml. I find that creating a configuration class with parameter validation for enumerated types and so on makes the rest of the code much cleaner. If you are just dealing with key/value pairs you will have to validate the data all throughout your code. By writing a custom class for each application you can put all that in one place.

Upvotes: 0

lothar
lothar

Reputation: 20267

The multi platform ACE library has a configuration class that uses config files that have the Windows .ini format.

Upvotes: 0

graham.reeds
graham.reeds

Reputation: 16486

I've used a modified version of John Torjo code from TechRepublic/DDJ (source)

Upvotes: 0

Related Questions