Migrate to C++17 and refactor

Change-Id: I53407266939258990a1c3a9363c3ebe9ea113fd2
diff --git a/src/detail/error-encoder.cpp b/src/detail/error-encoder.cpp
index 990ce84..3dcb6ca 100644
--- a/src/detail/error-encoder.cpp
+++ b/src/detail/error-encoder.cpp
@@ -22,10 +22,10 @@
 
 NDN_LOG_INIT(ndncert.encode.error);
 
-namespace ndncert {
+namespace ndncert::errortlv {
 
 Block
-errortlv::encodeDataContent(ErrorCode errorCode, const std::string& description)
+encodeDataContent(ErrorCode errorCode, const std::string& description)
 {
   Block response(ndn::tlv::Content);
   response.push_back(ndn::makeNonNegativeIntegerBlock(tlv::ErrorCode, static_cast<size_t>(errorCode)));
@@ -35,7 +35,7 @@
 }
 
 std::tuple<ErrorCode, std::string>
-errortlv::decodefromDataContent(const Block& block)
+decodefromDataContent(const Block& block)
 {
   try {
     block.parse();
@@ -47,34 +47,35 @@
     for (const auto& item : block.elements()) {
       if (item.type() == tlv::ErrorCode) {
         error = static_cast<ErrorCode>(readNonNegativeInteger(block.get(tlv::ErrorCode)));
-        codeCount ++;
+        codeCount++;
       }
       else if (item.type() == tlv::ErrorInfo) {
         errorInfo = readString(block.get(tlv::ErrorInfo));
-        infoCount ++;
+        infoCount++;
       }
       else if (ndn::tlv::isCriticalType(item.type())) {
-        otherCriticalCount ++;
+        otherCriticalCount++;
       }
       else {
         //ignore
       }
     }
     if (codeCount == 0 && infoCount == 0) {
-      return std::make_tuple(ErrorCode::NO_ERROR, "");
+      return {ErrorCode::NO_ERROR, ""};
     }
     if (codeCount != 1 || infoCount != 1) {
       NDN_THROW(std::runtime_error("Error TLV contains " + std::to_string(codeCount) + " error code(s) and " +
-                                      std::to_string(infoCount) + "error info(s), instead of expected 1 times each."));
+                                   std::to_string(infoCount) + " error info(s), instead of expected 1 time each."));
     }
     if (otherCriticalCount > 0) {
       NDN_THROW(std::runtime_error("Unknown Critical TLV type in error packet"));
     }
-    return std::make_tuple(error, errorInfo);
-  } catch (const std::exception& e) {
-    NDN_LOG_ERROR("[errortlv::DecodeFromDataContent] Exception in error message decoding: " << e.what());
-    return std::make_tuple(ErrorCode::NO_ERROR, "");
+    return {error, errorInfo};
+  }
+  catch (const std::exception& e) {
+    NDN_LOG_ERROR("Exception in error message decoding: " << e.what());
+    return {ErrorCode::NO_ERROR, ""};
   }
 }
 
-} // namespace ndncert
+} // namespace ndncert::errortlv