build: switch to C++17
Change-Id: Ia147b22fbdee68d87f0289851683ffbbb4466caa
diff --git a/src/daemon/rrset-factory.cpp b/src/daemon/rrset-factory.cpp
index eed7ad0..41e93a1 100644
--- a/src/daemon/rrset-factory.cpp
+++ b/src/daemon/rrset-factory.cpp
@@ -98,7 +98,7 @@
rrset.setVersion(name.get(-1));
- return std::make_pair(rrset, name);
+ return {rrset, name};
}
bool
@@ -125,13 +125,10 @@
if (ttl == DEFAULT_RR_TTL)
ttl = m_zone.getTtl();
- std::pair<Rrset, Name> rrsetAndName = generateBaseRrset(label, label::NS_RR_TYPE, version, ttl);
- const Name& name = rrsetAndName.second;
- Rrset& rrset = rrsetAndName.first;
+ auto [rrset, name] = generateBaseRrset(label, label::NS_RR_TYPE, version, ttl);
Link link(name);
link.setDelegationList(std::move(delegations));
-
setContentType(link, NDNS_LINK, ttl);
sign(link);
rrset.setData(link.wireEncode());
@@ -152,19 +149,16 @@
if (ttl == DEFAULT_RR_TTL)
ttl = m_zone.getTtl();
- Name name;
- Rrset rrset;
- std::tie(rrset, name) = generateBaseRrset(label, label::TXT_RR_TYPE, version, ttl);
+ auto [rrset, name] = generateBaseRrset(label, label::TXT_RR_TYPE, version, ttl);
std::vector<Block> rrs;
rrs.reserve(strings.size());
for (const auto& item : strings) {
- rrs.push_back(makeBinaryBlock(ndns::tlv::RrData, item.data(), item.size()));
+ rrs.push_back(makeStringBlock(ndns::tlv::RrData, item));
}
Data data(name);
data.setContent(wireEncode(rrs));
-
setContentType(data, NDNS_RESP, ttl);
sign(data);
rrset.setData(data.wireEncode());
@@ -185,13 +179,10 @@
if (ttl == DEFAULT_RR_TTL)
ttl = m_zone.getTtl();
- Name name;
- Rrset rrset;
- std::tie(rrset, name) = generateBaseRrset(label, label::APPCERT_RR_TYPE, version, ttl);
+ auto [rrset, name] = generateBaseRrset(label, label::APPCERT_RR_TYPE, version, ttl);
Data data(name);
data.setContent(cert.wireEncode());
-
setContentType(data, NDNS_KEY, ttl);
sign(data);
rrset.setData(data.wireEncode());
@@ -211,12 +202,9 @@
if (ttl == DEFAULT_RR_TTL)
ttl = m_zone.getTtl();
- Name name;
- Rrset rrset;
- std::tie(rrset, name) = generateBaseRrset(label, label::NS_RR_TYPE, version, ttl);
+ auto [rrset, name] = generateBaseRrset(label, label::NS_RR_TYPE, version, ttl);
Data data(name);
-
setContentType(data, NDNS_AUTH, ttl);
sign(data);
rrset.setData(data.wireEncode());
@@ -238,9 +226,7 @@
if (ttl == DEFAULT_RR_TTL)
ttl = m_zone.getTtl();
- Name name;
- Rrset rrset;
- std::tie(rrset, name) = generateBaseRrset(label, label::DOE_RR_TYPE, version, ttl);
+ auto [rrset, name] = generateBaseRrset(label, label::DOE_RR_TYPE, version, ttl);
std::vector<Block> range;
range.push_back(lowerLabel.wireEncode());
@@ -303,12 +289,9 @@
{
std::vector<std::string> txts;
wire.parse();
-
for (const auto& e : wire.elements()) {
- txts.push_back(std::string(reinterpret_cast<const char*>(e.value()),
- e.value_size()));
+ txts.emplace_back(reinterpret_cast<const char*>(e.value()), e.value_size());
}
-
return txts;
}