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/ethernet.hpp b/redfish-core/lib/ethernet.hpp
index be4ce7e..5ccc25f 100644
--- a/redfish-core/lib/ethernet.hpp
+++ b/redfish-core/lib/ethernet.hpp
@@ -16,6 +16,8 @@
#pragma once
#include <app.hpp>
+#include <boost/algorithm/string/classification.hpp>
+#include <boost/algorithm/string/split.hpp>
#include <boost/container/flat_set.hpp>
#include <dbus_singleton.hpp>
#include <dbus_utility.hpp>
@@ -430,7 +432,7 @@
for (const auto& objpath : dbusData)
{
// Check if proper pattern for object path appears
- if (boost::starts_with(objpath.first.str, ipv6PathStart))
+ if (objpath.first.str.starts_with(ipv6PathStart))
{
for (const auto& interface : objpath.second)
{
@@ -508,7 +510,7 @@
for (const auto& objpath : dbusData)
{
// Check if proper pattern for object path appears
- if (boost::starts_with(objpath.first.str, ipv4PathStart))
+ if (objpath.first.str.starts_with(ipv4PathStart))
{
for (const auto& interface : objpath.second)
{
@@ -569,7 +571,7 @@
}
// Check if given address is local, or global
ipv4Address.linktype =
- boost::starts_with(ipv4Address.address, "169.254.")
+ ipv4Address.address.starts_with("169.254.")
? LinkType::Local
: LinkType::Global;
}
@@ -1815,7 +1817,7 @@
inline bool verifyNames(const std::string& parent, const std::string& iface)
{
- return boost::starts_with(iface, parent + "_");
+ return iface.starts_with(parent + "_");
}
inline void requestEthernetInterfacesRoutes(App& app)
@@ -2272,7 +2274,7 @@
for (const std::string& ifaceItem : ifaceList)
{
- if (boost::starts_with(ifaceItem, rootInterfaceName + "_"))
+ if (ifaceItem.starts_with(rootInterfaceName + "_"))
{
std::string path =
"/redfish/v1/Managers/bmc/EthernetInterfaces/";