core: slim down `common.hpp`

Change-Id: I875c35147edd2261fbaa24e809c170d5cd9b94d3
diff --git a/tools/ndn-autoconfig/dns-srv.cpp b/tools/ndn-autoconfig/dns-srv.cpp
index bc0b3a6..ee1970e 100644
--- a/tools/ndn-autoconfig/dns-srv.cpp
+++ b/tools/ndn-autoconfig/dns-srv.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2022,  Regents of the University of California,
+ * Copyright (c) 2014-2024,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -110,7 +110,7 @@
     NDN_THROW(DnsSrvError("SRV record cannot be parsed (error decoding host name)"));
   }
 
-  return "udp://"s + hostName + ":" + to_string(port);
+  return "udp://"s + hostName + ":" + std::to_string(port);
 }
 
 std::string
diff --git a/tools/ndn-autoconfig/multicast-discovery.cpp b/tools/ndn-autoconfig/multicast-discovery.cpp
index 61312cd..dca08fc 100644
--- a/tools/ndn-autoconfig/multicast-discovery.cpp
+++ b/tools/ndn-autoconfig/multicast-discovery.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2023,  Regents of the University of California,
+ * Copyright (c) 2014-2024,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -55,7 +55,7 @@
     filter,
     [this] (const auto& dataset) { registerHubDiscoveryPrefix(dataset); },
     [this] (uint32_t code, const std::string& reason) {
-      fail("Error " + to_string(code) + " when querying multi-access faces: " + reason);
+      fail("Error " + std::to_string(code) + " when querying multi-access faces: " + reason);
     });
 }
 
@@ -119,7 +119,7 @@
     parameters,
     [this] (const auto&) { requestHubData(); },
     [this] (const auto& resp) {
-      fail("Error " + to_string(resp.getCode()) + " when setting multicast strategy: " + resp.getText());
+      fail("Error " + std::to_string(resp.getCode()) + " when setting multicast strategy: " + resp.getText());
     });
 }
 
diff --git a/tools/ndn-autoconfig/ndn-fch-discovery.cpp b/tools/ndn-autoconfig/ndn-fch-discovery.cpp
index 0e5c6b0..51234fc 100644
--- a/tools/ndn-autoconfig/ndn-fch-discovery.cpp
+++ b/tools/ndn-autoconfig/ndn-fch-discovery.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2023,  Regents of the University of California,
+ * Copyright (c) 2014-2024,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -181,7 +181,7 @@
     }
     if (statusCode != 200) {
       boost::trim(statusMessage);
-      NDN_THROW(HttpException("HTTP request failed: " + to_string(statusCode) + " " + statusMessage));
+      NDN_THROW(HttpException("HTTP request failed: " + std::to_string(statusCode) + " " + statusMessage));
     }
     std::string header;
     while (std::getline(requestStream, header) && header != "\r")
diff --git a/tools/nfdc/command-arguments.hpp b/tools/nfdc/command-arguments.hpp
index 91d17e0..b0f82f0 100644
--- a/tools/nfdc/command-arguments.hpp
+++ b/tools/nfdc/command-arguments.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2022,  Regents of the University of California,
+ * Copyright (c) 2014-2024,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -26,11 +26,14 @@
 #ifndef NFD_TOOLS_NFDC_COMMAND_ARGUMENTS_HPP
 #define NFD_TOOLS_NFDC_COMMAND_ARGUMENTS_HPP
 
-#include "core/common.hpp"
-
 #include <ndn-cxx/encoding/nfd-constants.hpp>
 
 #include <any>
+#include <map>
+#include <optional>
+#include <string>
+#include <string_view>
+
 #include <boost/logic/tribool.hpp>
 
 namespace nfd::tools::nfdc {
diff --git a/tools/nfdc/command-definition.cpp b/tools/nfdc/command-definition.cpp
index 443aff0..5e59382 100644
--- a/tools/nfdc/command-definition.cpp
+++ b/tools/nfdc/command-definition.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2022,  Regents of the University of California,
+ * Copyright (c) 2014-2024,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -26,9 +26,12 @@
 #include "command-definition.hpp"
 #include "status-report.hpp"
 
-#include <boost/lexical_cast.hpp>
+#include <ndn-cxx/net/face-uri.hpp>
+#include <ndn-cxx/util/backports.hpp>
 #include <ndn-cxx/util/logger.hpp>
 
+#include <boost/lexical_cast.hpp>
+
 namespace nfd::tools::nfdc {
 
 NDN_LOG_INIT(nfdc.CommandDefinition);
@@ -282,14 +285,14 @@
       return Name(token);
 
     case ArgValueType::FACE_URI:
-      return FaceUri(token);
+      return ndn::FaceUri(token);
 
     case ArgValueType::FACE_ID_OR_URI:
       try {
         return boost::lexical_cast<uint64_t>(token);
       }
       catch (const boost::bad_lexical_cast&) {
-        return FaceUri(token);
+        return ndn::FaceUri(token);
       }
 
     case ArgValueType::FACE_PERSISTENCY:
diff --git a/tools/nfdc/command-definition.hpp b/tools/nfdc/command-definition.hpp
index 07ecd15..914c9b5 100644
--- a/tools/nfdc/command-definition.hpp
+++ b/tools/nfdc/command-definition.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2022,  Regents of the University of California,
+ * Copyright (c) 2014-2024,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -28,6 +28,11 @@
 
 #include "command-arguments.hpp"
 
+#include <iosfwd>
+#include <set>
+#include <stdexcept>
+#include <vector>
+
 namespace nfd::tools::nfdc {
 
 /** \brief Indicates argument value type.
diff --git a/tools/nfdc/command-parser.hpp b/tools/nfdc/command-parser.hpp
index e7046e0..fb3f9ef 100644
--- a/tools/nfdc/command-parser.hpp
+++ b/tools/nfdc/command-parser.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2022,  Regents of the University of California,
+ * Copyright (c) 2014-2024,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -26,6 +26,7 @@
 #ifndef NFD_TOOLS_NFDC_COMMAND_PARSER_HPP
 #define NFD_TOOLS_NFDC_COMMAND_PARSER_HPP
 
+#include "core/common.hpp"
 #include "command-definition.hpp"
 #include "execute-command.hpp"
 
@@ -58,7 +59,7 @@
 
 /** \brief Parses a command.
  */
-class CommandParser : noncopyable
+class CommandParser : boost::noncopyable
 {
 public:
   class NoSuchCommandError : public std::invalid_argument
diff --git a/tools/nfdc/execute-command.cpp b/tools/nfdc/execute-command.cpp
index 8c9e5b5..67c6959 100644
--- a/tools/nfdc/execute-command.cpp
+++ b/tools/nfdc/execute-command.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2023,  Regents of the University of California,
+ * Copyright (c) 2014-2024,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -24,6 +24,7 @@
  */
 
 #include "execute-command.hpp"
+#include "core/common.hpp"
 
 namespace nfd::tools::nfdc {
 
diff --git a/tools/nfdc/execute-command.hpp b/tools/nfdc/execute-command.hpp
index 4b1bf5d..4bf6970 100644
--- a/tools/nfdc/execute-command.hpp
+++ b/tools/nfdc/execute-command.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2023,  Regents of the University of California,
+ * Copyright (c) 2014-2024,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -36,6 +36,9 @@
 #include <ndn-cxx/mgmt/nfd/control-response.hpp>
 #include <ndn-cxx/security/key-chain.hpp>
 
+#include <functional>
+#include <iosfwd>
+
 namespace nfd::tools::nfdc {
 
 using ndn::nfd::ControlParameters;
@@ -49,7 +52,7 @@
 public:
   /** \return timeout for each step
    */
-  time::nanoseconds
+  ndn::time::nanoseconds
   getTimeout() const;
 
   ndn::nfd::CommandOptions
diff --git a/tools/nfdc/face-helpers.cpp b/tools/nfdc/face-helpers.cpp
index 780422f..0bfc980 100644
--- a/tools/nfdc/face-helpers.cpp
+++ b/tools/nfdc/face-helpers.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2023,  Regents of the University of California,
+ * Copyright (c) 2014-2024,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -133,7 +133,7 @@
   };
   auto failureCb = [this] (uint32_t code, const auto& reason) {
     m_res = Code::ERROR;
-    m_errorReason = "Error " + to_string(code) + " when querying face: " + reason;
+    m_errorReason = "Error " + std::to_string(code) + " when querying face: " + reason;
   };
 
   if (m_filter.empty()) {
diff --git a/tools/nfdc/face-helpers.hpp b/tools/nfdc/face-helpers.hpp
index 1f54e0a..c4e25f5 100644
--- a/tools/nfdc/face-helpers.hpp
+++ b/tools/nfdc/face-helpers.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2023,  Regents of the University of California,
+ * Copyright (c) 2014-2024,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -26,13 +26,18 @@
 #ifndef NFD_TOOLS_NFDC_FACE_HELPERS_HPP
 #define NFD_TOOLS_NFDC_FACE_HELPERS_HPP
 
+#include "core/common.hpp"
 #include "execute-command.hpp"
 
 #include <ndn-cxx/mgmt/nfd/face-query-filter.hpp>
 #include <ndn-cxx/mgmt/nfd/face-status.hpp>
+#include <ndn-cxx/net/face-uri.hpp>
+
+#include <set>
 
 namespace nfd::tools::nfdc {
 
+using ndn::FaceUri;
 using ndn::nfd::FaceQueryFilter;
 using ndn::nfd::FaceStatus;
 
diff --git a/tools/nfdc/format-helpers.hpp b/tools/nfdc/format-helpers.hpp
index 0f04c16..ac4ffc8 100644
--- a/tools/nfdc/format-helpers.hpp
+++ b/tools/nfdc/format-helpers.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2022,  Regents of the University of California,
+ * Copyright (c) 2014-2024,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -255,7 +255,7 @@
 std::string
 formatDuration(time::nanoseconds d, bool isLong = false)
 {
-  return to_string(time::duration_cast<OutputPrecision>(d).count()) +
+  return std::to_string(time::duration_cast<OutputPrecision>(d).count()) +
          (isLong ? " " : "") + detail::getTimeUnit<OutputPrecision>(isLong);
 }
 
diff --git a/tools/nfdc/module.hpp b/tools/nfdc/module.hpp
index 42725c1..21d9384 100644
--- a/tools/nfdc/module.hpp
+++ b/tools/nfdc/module.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2023,  Regents of the University of California,
+ * Copyright (c) 2014-2024,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -29,6 +29,7 @@
 #include <ndn-cxx/mgmt/nfd/command-options.hpp>
 #include <ndn-cxx/mgmt/nfd/controller.hpp>
 
+#include <functional>
 #include <ostream>
 
 namespace nfd::tools::nfdc {
diff --git a/tools/nfdc/nfdc-pch.hpp b/tools/nfdc/nfdc-pch.hpp
index b2e789d..9ab60e8 100644
--- a/tools/nfdc/nfdc-pch.hpp
+++ b/tools/nfdc/nfdc-pch.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2022,  Regents of the University of California,
+ * Copyright (c) 2014-2024,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -28,7 +28,12 @@
 
 #include "core/common.hpp"
 
+#include <functional>
+#include <map>
+#include <set>
+
 #include <ndn-cxx/mgmt/nfd/controller.hpp>
+#include <ndn-cxx/net/face-uri.hpp>
 #include <ndn-cxx/security/validator-null.hpp>
 #include <ndn-cxx/util/logger.hpp>