util: add printHex() overload that takes a uint64_t

And AsHex helper class.

Change-Id: If6fb6edea258ab281b5ea9cc30deffd2d8994dc5
Refs: #3006
diff --git a/src/name-component.cpp b/src/name-component.cpp
index 13005dd..746f69a 100644
--- a/src/name-component.cpp
+++ b/src/name-component.cpp
@@ -104,7 +104,7 @@
       trimmedString.erase(0, getSha256DigestUriPrefix().size());
       return fromImplicitSha256Digest(fromHex(trimmedString));
     }
-    catch (StringHelperError& e) {
+    catch (const StringHelperError&) {
       BOOST_THROW_EXCEPTION(Error("Cannot convert to a ImplicitSha256DigestComponent (invalid hex "
                                   "encoding)"));
     }
@@ -154,7 +154,7 @@
     }
     else {
       // In case we need to escape, set to upper case hex and save the previous flags.
-      std::ios::fmtflags saveFlags = result.flags(std::ios::hex | std::ios::uppercase);
+      auto savedFlags = result.flags(std::ios::hex | std::ios::uppercase);
 
       for (size_t i = 0; i < valueSize; ++i) {
         uint8_t x = value[i];
@@ -172,7 +172,7 @@
       }
 
       // Restore.
-      result.flags(saveFlags);
+      result.flags(savedFlags);
     }
   }
 }