std::string getLocaleValue(const ConfigReader &config, const std::string &group, const std::string &key, const std::string &language) { lang wanted(language); std::vector<std::string> localeKeys; if (wanted.country.size() > 0 && wanted.modifier.size() > 0) { localeKeys.push_back(wanted.language + "_" + wanted.country + "@" + wanted.modifier); } if (wanted.country.size() > 0) { localeKeys.push_back(wanted.language + "_" + wanted.country); } if (wanted.modifier.size() > 0) { localeKeys.push_back(wanted.language + "@" + wanted.modifier); } localeKeys.push_back(wanted.language); for (std::vector<std::string>::size_type i = 0; i < localeKeys.size(); ++i) { std::string localeKey = key + "[" + localeKeys[i] + "]"; if (config.hasKey(group, localeKey)) { return config.value(group, localeKey); } } return config.value(group, key); }
void marineb_state::bcruzm12(machine_config &config) { wanted(config); m_outlatch->q_out_cb<1>().set(FUNC(marineb_state::flipscreen_y_w)).invert(); m_outlatch->q_out_cb<2>().set(FUNC(marineb_state::flipscreen_x_w)).invert(); }
void read_wifi(struct params *p) { static char *buf = 0; static int buflen = 4096; struct ieee80211_frame *wh; int rc; if (!buf) { buf = (char*) malloc(buflen); if (!buf) err(1, "malloc()"); } rc = sniff(p->rx, buf, buflen); if (rc == -1) err(1, "sniff()"); wh = get_wifi(buf, &rc); if (!wh) return; /* relayed macast */ if (frame_type(wh, IEEE80211_FC0_TYPE_DATA, IEEE80211_FC0_SUBTYPE_DATA) && (wh->i_fc[1] & IEEE80211_FC1_DIR_FROMDS) && (memcmp(wh->i_addr2, p->ap, 6) == 0) && (memcmp(wh->i_addr1, p->mcast, 5) == 0) && (memcmp(p->mac, wh->i_addr3, 6) == 0)) { got_mcast(p, wh, rc); return; } /* data */ if (frame_type(wh, IEEE80211_FC0_TYPE_DATA, IEEE80211_FC0_SUBTYPE_DATA)) { if (!wanted(p, wh, rc)) return; enque(p, &buf, wh, rc); if (p->state == S_START) send_queue(p); return; } }
int main() { wanted([](int i) { std::cout << i << std::endl; }, 1, 2, std::make_tuple(3, 4, 5)); }