9 #include "configFileHelpers.hpp"
12 #include <type_traits>
15 template<
typename Callable>
16 void addTargets(
const toml::value& section, std::string targetName, Callable callback)
20 auto targets = toml::find_or(section, targetName, uval);
21 if (!targets.is_uninitialized()) {
22 if (targets.is_array()) {
23 auto& targetArray = targets.as_array();
24 for (
const auto& target : targetArray) {
25 callback(target.as_string());
28 callback(targets.as_string());
31 if (targetName.back() ==
's') {
32 targetName.pop_back();
34 target = toml::find_or(section, targetName, target);
35 if (!target.empty()) {
41 template<
typename Callable>
42 void addTargets(
const Json::Value& section, std::string targetName, Callable callback)
45 if (section.isMember(targetName)) {
46 auto targets = section[targetName];
47 if (targets.isArray()) {
48 for (
const auto& target : targets) {
49 callback(target.asString());
52 callback(targets.asString());
55 if (targetName.back() ==
's') {
56 targetName.pop_back();
57 if (section.isMember(targetName)) {
58 callback(section[targetName].asString());
63 void processOptions(
const toml::value& section,
64 const std::function<
int(
const std::string&)>& optionConversion,
65 const std::function<
int(
const std::string&)>& valueConversion,
66 const std::function<
void(
int,
int)>& optionAction);
68 void processOptions(
const Json::Value& section,
69 const std::function<
int(
const std::string&)>& optionConversion,
70 const std::function<
int(
const std::string&)>& valueConversion,
71 const std::function<
void(
int,
int)>& optionAction);