Remove usages of boost::starts/ends_with
Per the coding standard, now that C++ supports std::string::starts_with
and std::string::ends_with, we should be using them over the boost
alternatives. This commit goes through and updates all usages.
Arguably some of these are incorrect, and instances of common error 13,
but because this is mostly a mechanical it intentionally doesn't try to
handle it.
Tested: Unit tests pass.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: Ic4c6e5d0da90f7442693199dc691a47d2240fa4f
diff --git a/redfish-core/lib/health.hpp b/redfish-core/lib/health.hpp
index cf84c93..2f0f156 100644
--- a/redfish-core/lib/health.hpp
+++ b/redfish-core/lib/health.hpp
@@ -18,7 +18,6 @@
#include "async_resp.hpp"
#include <app.hpp>
-#include <boost/algorithm/string/predicate.hpp>
#include <dbus_singleton.hpp>
#include <dbus_utility.hpp>
#include <nlohmann/json.hpp>
@@ -73,7 +72,7 @@
if (selfPath)
{
if (boost::equals(path.str, *selfPath) ||
- boost::starts_with(path.str, *selfPath + "/"))
+ path.str.starts_with(*selfPath + "/"))
{
isSelf = true;
}
@@ -89,7 +88,7 @@
for (const std::string& child : inventory)
{
- if (boost::starts_with(path.str, child))
+ if (path.str.starts_with(child))
{
isChild = true;
break;
@@ -138,15 +137,15 @@
}
}
- if (boost::starts_with(path.str, globalInventoryPath) &&
- boost::ends_with(path.str, "critical"))
+ if (path.str.starts_with(globalInventoryPath) &&
+ path.str.ends_with("critical"))
{
health = "Critical";
rollup = "Critical";
return;
}
- if (boost::starts_with(path.str, globalInventoryPath) &&
- boost::ends_with(path.str, "warning"))
+ if (path.str.starts_with(globalInventoryPath) &&
+ path.str.ends_with("warning"))
{
health = "Warning";
if (rollup != "Critical")
@@ -154,7 +153,7 @@
rollup = "Warning";
}
}
- else if (boost::ends_with(path.str, "critical"))
+ else if (path.str.ends_with("critical"))
{
rollup = "Critical";
if (isSelf)
@@ -163,7 +162,7 @@
return;
}
}
- else if (boost::ends_with(path.str, "warning"))
+ else if (path.str.ends_with("warning"))
{
if (rollup != "Critical")
{
@@ -224,8 +223,8 @@
self->statuses = resp;
for (auto it = self->statuses.begin(); it != self->statuses.end();)
{
- if (boost::ends_with(it->first.str, "critical") ||
- boost::ends_with(it->first.str, "warning"))
+ if (it->first.str.ends_with("critical") ||
+ it->first.str.ends_with("warning"))
{
it++;
continue;