Replace boost with std replace
Per our coding standard, we should be using std namespace methods for
these things when both a boost one and a std one exist. Update the
code.
Tested: Code compiles. I don't think we have great examples of the
usages of these APIs.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I35cfa25c4f8038ba8d9e3dbe337b5b3d72c64144
diff --git a/redfish-core/lib/managers.hpp b/redfish-core/lib/managers.hpp
index 52a3c85..d1e43fb 100644
--- a/redfish-core/lib/managers.hpp
+++ b/redfish-core/lib/managers.hpp
@@ -24,9 +24,9 @@
#include "utils/sw_utils.hpp"
#include "utils/systemd_utils.hpp"
-#include <boost/algorithm/string/replace.hpp>
#include <boost/date_time.hpp>
+#include <algorithm>
#include <cstdint>
#include <memory>
#include <sstream>
@@ -716,7 +716,7 @@
"Zones");
return false;
}
- boost::replace_all(input, "_", " ");
+ std::replace(input.begin(), input.end(), '_', ' ');
zones.emplace_back(std::move(input));
}
return true;
@@ -728,7 +728,8 @@
{
BMCWEB_LOG_DEBUG << "Find Chassis: " << value << "\n";
- std::string escaped = boost::replace_all_copy(value, " ", "_");
+ std::string escaped = value;
+ std::replace(escaped.begin(), escaped.end(), '_', ' ');
escaped = "/" + escaped;
auto it = std::find_if(managedObj.begin(), managedObj.end(),
[&escaped](const auto& obj) {
@@ -950,7 +951,7 @@
}
for (std::string& value : *container)
{
- boost::replace_all(value, "_", " ");
+ std::replace(value.begin(), value.end(), '_', ' ');
}
std::string key;
if (index == 0)
@@ -1131,7 +1132,8 @@
{
for (std::string& value : *inputs)
{
- boost::replace_all(value, "_", " ");
+
+ std::replace(value.begin(), value.end(), '_', ' ');
}
output.emplace_back("Inputs", std::move(*inputs));
}
@@ -1614,8 +1616,9 @@
messages::resourceExhaustion(response->res, type);
continue;
}
- output.emplace_back("Name",
- boost::replace_all_copy(name, "_", " "));
+ std::string escaped = name;
+ std::replace(escaped.begin(), escaped.end(), '_', ' ');
+ output.emplace_back("Name", escaped);
std::string chassis;
CreatePIDRet ret = createPidInterface(