有没有 C++用于 C++ 的跨平台键/值 API 或库?

发布于 2024-08-31 10:09:41 字数 123 浏览 6 评论 0原文

我们希望将一些用户设置保留到代码的 GUI 部分中。我曾经专门进行 Win32 编程,典型的方法是使用注册表设置。

我认为这应该通过配置文件来完成,但想知道是否有一个库或跨平台包装器可以使键/值对持久性变得非常容易。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(8

春庭雪 2024-09-07 10:09:41

Qt 的 QSettings 类处理此问题:

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

Qt's QSettings class handles this:

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

彡翼 2024-09-07 10:09:41

Boost.PropertyTree 支持 XML、JSON、INI配置文件。

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

命硬 2024-09-07 10:09:41

还有 JSON 作为 XML 的更轻量级替代方案。该页面上也有很多实现。

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

紧拥背影 2024-09-07 10:09:41

Qt 4 有一个类,名为 QSettings。看起来和你需要的一模一样。

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

昔日梦未散 2024-09-07 10:09:41

为什么不使用 XML 作为配置文件。那么你只需要找到一个跨平台的 XML 库,在我看来,这更容易。
这里是 C++ 的优秀 XML 解析解决方案的列表。

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++.

妄想挽回 2024-09-07 10:09:41

我想到了老派的 Berkley DB

Old school Berkley DB comes to mind.

追风人 2024-09-07 10:09:41

过去我们在 Windows 中使用 .ini 文件。 这是 ini 文件读/写库的便携式版本
它可以在 Windows 和 Linux 上运行。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文