annotate src/core/ini.cc @ 116:254b1d2b7096

settings: add torrents page, make rss feed configurable
author Paper <mrpapersonic@gmail.com>
date Tue, 07 Nov 2023 13:52:13 -0500
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
116
254b1d2b7096 settings: add torrents page, make rss feed configurable
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
1 #include "core/ini.h"
254b1d2b7096 settings: add torrents page, make rss feed configurable
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
2
254b1d2b7096 settings: add torrents page, make rss feed configurable
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
3 namespace INI {
254b1d2b7096 settings: add torrents page, make rss feed configurable
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
4
254b1d2b7096 settings: add torrents page, make rss feed configurable
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
5 /* this should be in some ini.cc or whatever */
254b1d2b7096 settings: add torrents page, make rss feed configurable
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
6 std::string GetIniString(const mINI::INIStructure& ini, const std::string& section,
254b1d2b7096 settings: add torrents page, make rss feed configurable
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
7 const std::string& value, const std::string& def) {
254b1d2b7096 settings: add torrents page, make rss feed configurable
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
8 if (!ini.has(section) || !ini.get(section).has(value))
254b1d2b7096 settings: add torrents page, make rss feed configurable
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
9 return def;
254b1d2b7096 settings: add torrents page, make rss feed configurable
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
10 return ini.get(section).get(value); // ack
254b1d2b7096 settings: add torrents page, make rss feed configurable
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
11 }
254b1d2b7096 settings: add torrents page, make rss feed configurable
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
12
254b1d2b7096 settings: add torrents page, make rss feed configurable
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
13 }