return false;
}
vector<string> parts;
- vector<string>::const_iterator i;
stringtok( parts, param->second, ", \t" );
- for( i = parts.begin(); i != parts.end(); ++i ) {
- if( *i == val ) {
+ for (const auto& part: parts) {
+ if (part == val) {
return true;
}
}
prefix="";
string help;
-
- for(map<string,string>::const_iterator i=helpmap.begin();
- i!=helpmap.end();
- ++i)
- {
- if(!prefix.empty() && i->first.find(prefix) != 0) // only print items with prefix
- continue;
+
+ for (const auto& i: helpmap) {
+ if(!prefix.empty() && i.first.find(prefix) != 0) // only print items with prefix
+ continue;
help+=" --";
- help+=i->first;
+ help+=i.first;
- string type=d_typeMap[i->first];
+ string type=d_typeMap[i.first];
if(type=="Parameter")
help+="=...";
else if(type=="Switch")
{
- help+=" | --"+i->first+"=yes";
- help+=" | --"+i->first+"=no";
+ help+=" | --"+i.first+"=yes";
+ help+=" | --"+i.first+"=no";
}
help+="\n\t";
- help+=i->second;
+ help+=i.second;
help+="\n";
}
else
help="# Autogenerated configuration file template\n";
- for(map<string,string>::const_iterator i=helpmap.begin(); i!=helpmap.end(); ++i) {
- if(d_typeMap[i->first]=="Command")
+ for(const auto& i: helpmap) {
+ if(d_typeMap[i.first]=="Command")
continue;
help+="#################################\n";
help+="# ";
- help+=i->first;
+ help+=i.first;
help+="\t";
- help+=i->second;
+ help+=i.second;
help+="\n#\n";
if (current) {
- help+=i->first+"="+params[i->first]+"\n\n";
+ help+=i.first+"="+params[i.first]+"\n\n";
} else {
- help+="# "+i->first+"="+params[i->first]+"\n\n";
+ help+="# "+i.first+"="+params[i.first]+"\n\n";
}
}
return help;
Resolver::~Resolver()
{
- for(std::map<std::string,int>::iterator iter = locals.begin(); iter != locals.end(); ++iter) {
- if (iter->second >= 0)
- close(iter->second);
+ for (auto& iter: locals) {
+ if (iter.second >= 0)
+ close(iter.second);
}
}
vector<DNSResourceRecord> ret;
DNSResourceRecord rr;
- for(MOADNSParser::answers_t::const_iterator i=mdp.d_answers.begin(); i!=mdp.d_answers.end(); ++i) {
- rr.qname = i->first.d_name;
- rr.qtype = i->first.d_type;
- rr.ttl = i->first.d_ttl;
- rr.content = i->first.d_content->getZoneRepresentation(true);
+ for (const auto& i: mdp.d_answers) {
+ rr.qname = i.first.d_name;
+ rr.qtype = i.first.d_type;
+ rr.ttl = i.first.d_ttl;
+ rr.content = i.first.d_content->getZoneRepresentation(true);
result->push_back(rr);
}
size_t i = 0, k;
int sock;
- for(std::map<string,int>::iterator iter=locals.begin(); iter != locals.end(); ++iter, ++i) {
- fds[i].fd = iter->second;
+ for (const auto& iter: locals) {
+ fds[i].fd = iter.second;
fds[i].events = POLLIN;
+ ++i;
}
if (poll(fds.get(), i, 250) < 1) { // wait for 0.25s