Migrate to C++17 and refactor
Change-Id: I53407266939258990a1c3a9363c3ebe9ea113fd2
diff --git a/src/detail/probe-encoder.cpp b/src/detail/probe-encoder.cpp
index 13b040e..cdace7e 100644
--- a/src/detail/probe-encoder.cpp
+++ b/src/detail/probe-encoder.cpp
@@ -20,10 +20,10 @@
#include "detail/probe-encoder.hpp"
-namespace ndncert {
+namespace ndncert::probetlv {
Block
-probetlv::encodeApplicationParameters(const std::multimap<std::string, std::string>& parameters)
+encodeApplicationParameters(const std::multimap<std::string, std::string>& parameters)
{
Block content(ndn::tlv::ApplicationParameters);
for (const auto& items : parameters) {
@@ -35,7 +35,8 @@
}
std::multimap<std::string, std::string>
-probetlv::decodeApplicationParameters(const Block& block) {
+decodeApplicationParameters(const Block& block)
+{
std::multimap<std::string, std::string> result;
block.parse();
const auto& elements = block.elements();
@@ -56,8 +57,8 @@
}
Block
-probetlv::encodeDataContent(const std::vector<Name>& identifiers, optional<size_t> maxSuffixLength,
- std::vector<ndn::Name> redirectionItems)
+encodeDataContent(const std::vector<Name>& identifiers, std::optional<size_t> maxSuffixLength,
+ const std::vector<Name>& redirectionItems)
{
Block content(ndn::tlv::Content);
for (const auto& name : identifiers) {
@@ -78,9 +79,9 @@
}
void
-probetlv::decodeDataContent(const Block& block,
- std::vector<std::pair<Name, int>>& availableNames,
- std::vector<Name>& availableRedirection) {
+decodeDataContent(const Block& block, std::vector<std::pair<Name, int>>& availableNames,
+ std::vector<Name>& availableRedirection)
+{
block.parse();
for (const auto& item : block.elements()) {
if (item.type() == tlv::ProbeResponse) {
@@ -121,4 +122,4 @@
}
}
-} // namespace ndncert
+} // namespace ndncert::probetlv