diff options
author | Ed Tanous <edtanous@google.com> | 2022-07-11 19:50:41 +0300 |
---|---|---|
committer | Ed Tanous <ed@tanous.net> | 2022-07-16 05:03:56 +0300 |
commit | 11ba39793c016e8476e44be880fb267e059dd4eb (patch) | |
tree | 863b07c67ed699cf051ed792b01f68c82027c94c /redfish-core/lib/ethernet.hpp | |
parent | 433b68b477a82a31de4104a83404021de1f30214 (diff) | |
download | bmcweb-11ba39793c016e8476e44be880fb267e059dd4eb.tar.xz |
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
Diffstat (limited to 'redfish-core/lib/ethernet.hpp')
-rw-r--r-- | redfish-core/lib/ethernet.hpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/redfish-core/lib/ethernet.hpp b/redfish-core/lib/ethernet.hpp index be4ce7ed2e..5ccc25fe39 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 @@ inline void 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 @@ inline void 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 @@ inline void } // 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 void parseInterfaceData(nlohmann::json& jsonResponse, 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 @@ inline void requestEthernetInterfacesRoutes(App& app) 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/"; |