Define hex helper utils
This commit attempts to optimize some code and reduce our dependence on
boost libraries, as the coding standard recommends. It does this by
introducing a new method, intToHexString, which is a greatly simplified
"to hex" converter that doesn't require std::locale, or stream buffers,
and is very efficient. This deletes our need for boost::format, as well
as our need for boost::lexical_cast, both of which are fairly heavy
libraries.
Tested:
Unit tests pass.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I3b0f6eeb10256f87320adcc0ae9396f6bcbc8740
diff --git a/redfish-core/lib/memory.hpp b/redfish-core/lib/memory.hpp
index 2d647dc..5d508c4 100644
--- a/redfish-core/lib/memory.hpp
+++ b/redfish-core/lib/memory.hpp
@@ -19,9 +19,9 @@
#include <app.hpp>
#include <boost/container/flat_map.hpp>
-#include <boost/format.hpp>
#include <registries/privilege_registry.hpp>
#include <utils/collection.hpp>
+#include <utils/hex_utils.hpp>
#include <utils/json_utils.hpp>
namespace redfish
@@ -154,7 +154,7 @@
return;
}
- aResp->res.jsonValue[key] = (boost::format("0x%04x") % *value).str();
+ aResp->res.jsonValue[key] = "0x" + intToHexString(*value);
}
inline void getPersistentMemoryProperties(