5

We want to persist some user settings int he GUI part of our code. I used to do Win32 programming exclusively and the typical way this was done was with registry settings.

I assume that this should be done with configuration files, but was wondering if there was a library or cross platform wrapper that made key/value pair persistence very easy.

Tim
  • 20,184
  • 24
  • 117
  • 214

8 Answers8

7

Qt's QSettings class handles this:

http://doc.qt.nokia.com/4.6/qsettings.html

Pieter
  • 1,191
  • 1
  • 11
  • 29
7

Boost.PropertyTree supports XML, JSON, INI config files.

jfs
  • 399,953
  • 195
  • 994
  • 1,670
2

There is also JSON for a lighter alternative of XML. Lots of implementations on that page too.

DanDan
  • 10,462
  • 8
  • 53
  • 69
2

Qt 4 has a class for it, named QSettings. Looks exactly like what you need.

SigTerm
  • 26,089
  • 6
  • 66
  • 115
1

Why not use an XML as the configuration file. Then you only have to find a cross platform XML library which is easier IMO. Here is a list of nice XML parsing solutions for C++.

Community
  • 1
  • 1
nc3b
  • 15,562
  • 5
  • 51
  • 63
  • I am not a fan of XML - it is far too heavyweight and I find it pretty unreadable. I try not to propagate this standard if I can help it. – Tim May 09 '10 at 00:43
1

Old school Berkley DB comes to mind.

msw
  • 42,753
  • 9
  • 87
  • 112
1

Have a look at Tokyo Cabinet or at Embedded InnoDB.

Jonas
  • 121,568
  • 97
  • 310
  • 388
1

In the old days we used .ini files in windows. Here is a portable version of an ini file read/write library
It will work on Windows as well as Linux.

Romain Hippeau
  • 24,113
  • 5
  • 60
  • 79