summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEd Tanous <edtanous@google.com>2022-07-11 19:50:41 +0300
committerEd Tanous <ed@tanous.net>2022-07-16 05:03:56 +0300
commit11ba39793c016e8476e44be880fb267e059dd4eb (patch)
tree863b07c67ed699cf051ed792b01f68c82027c94c
parent433b68b477a82a31de4104a83404021de1f30214 (diff)
downloadbmcweb-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
-rw-r--r--http/http_connection.hpp1
-rw-r--r--http/websocket.hpp1
-rw-r--r--include/authentication.hpp5
-rw-r--r--include/http_utility.hpp3
-rw-r--r--include/ibm/locks.hpp3
-rw-r--r--include/ibm/management_console_rest.hpp2
-rw-r--r--include/login_routes.hpp4
-rw-r--r--include/multipart_parser.hpp4
-rw-r--r--include/openbmc_dbus_rest.hpp35
-rw-r--r--include/webassets.hpp4
-rw-r--r--redfish-core/include/event_service_manager.hpp2
-rw-r--r--redfish-core/lib/certificate_service.hpp24
-rw-r--r--redfish-core/lib/ethernet.hpp12
-rw-r--r--redfish-core/lib/health.hpp21
-rw-r--r--redfish-core/lib/log_services.hpp5
-rw-r--r--redfish-core/lib/memory.hpp11
-rw-r--r--redfish-core/lib/processor.hpp11
-rw-r--r--redfish-core/lib/sensors.hpp14
-rw-r--r--redfish-core/lib/update_service.hpp10
19 files changed, 82 insertions, 90 deletions
diff --git a/http/http_connection.hpp b/http/http_connection.hpp
index d20fd250c4..feea815832 100644
--- a/http/http_connection.hpp
+++ b/http/http_connection.hpp
@@ -7,7 +7,6 @@
#include "logging.hpp"
#include "utility.hpp"
-#include <boost/algorithm/string.hpp>
#include <boost/algorithm/string/predicate.hpp>
#include <boost/asio/io_context.hpp>
#include <boost/asio/ip/tcp.hpp>
diff --git a/http/websocket.hpp b/http/websocket.hpp
index 3aa8554e1c..ecaa1d2f9a 100644
--- a/http/websocket.hpp
+++ b/http/websocket.hpp
@@ -2,7 +2,6 @@
#include "http_request.hpp"
#include <async_resp.hpp>
-#include <boost/algorithm/string/predicate.hpp>
#include <boost/asio/buffer.hpp>
#include <boost/beast/websocket.hpp>
diff --git a/include/authentication.hpp b/include/authentication.hpp
index 8d59be406e..ac2a7d14a7 100644
--- a/include/authentication.hpp
+++ b/include/authentication.hpp
@@ -3,7 +3,6 @@
#include "webroutes.hpp"
#include <app.hpp>
-#include <boost/algorithm/string/predicate.hpp>
#include <boost/container/flat_set.hpp>
#include <common.hpp>
#include <forward_unauthorized.hpp>
@@ -42,7 +41,7 @@ static std::shared_ptr<persistent_data::UserSession>
{
BMCWEB_LOG_DEBUG << "[AuthMiddleware] Basic authentication";
- if (!boost::starts_with(authHeader, "Basic "))
+ if (!authHeader.starts_with("Basic "))
{
return nullptr;
}
@@ -97,7 +96,7 @@ static std::shared_ptr<persistent_data::UserSession>
performTokenAuth(std::string_view authHeader)
{
BMCWEB_LOG_DEBUG << "[AuthMiddleware] Token authentication";
- if (!boost::starts_with(authHeader, "Token "))
+ if (!authHeader.starts_with("Token "))
{
return nullptr;
}
diff --git a/include/http_utility.hpp b/include/http_utility.hpp
index 3970992974..c150943f8f 100644
--- a/include/http_utility.hpp
+++ b/include/http_utility.hpp
@@ -1,7 +1,8 @@
#pragma once
#include "http_request.hpp"
-#include <boost/algorithm/string.hpp>
+#include <boost/algorithm/string/classification.hpp>
+#include <boost/algorithm/string/split.hpp>
namespace http_helpers
{
diff --git a/include/ibm/locks.hpp b/include/ibm/locks.hpp
index 2c6668c9a6..5df3daa975 100644
--- a/include/ibm/locks.hpp
+++ b/include/ibm/locks.hpp
@@ -1,6 +1,6 @@
#pragma once
-#include <boost/algorithm/string.hpp>
+#include <boost/algorithm/string/predicate.hpp>
#include <boost/container/flat_map.hpp>
#include <boost/endian/conversion.hpp>
#include <include/ibm/utils.hpp>
@@ -9,6 +9,7 @@
#include <filesystem>
#include <fstream>
+#include <variant>
namespace crow
{
diff --git a/include/ibm/management_console_rest.hpp b/include/ibm/management_console_rest.hpp
index 8d50c9f147..0d8e287802 100644
--- a/include/ibm/management_console_rest.hpp
+++ b/include/ibm/management_console_rest.hpp
@@ -2,7 +2,7 @@
#include <app.hpp>
#include <async_resp.hpp>
-#include <boost/algorithm/string.hpp>
+#include <boost/algorithm/string/predicate.hpp>
#include <boost/container/flat_set.hpp>
#include <error_messages.hpp>
#include <event_service_manager.hpp>
diff --git a/include/login_routes.hpp b/include/login_routes.hpp
index fde4b8f645..fd1c357d10 100644
--- a/include/login_routes.hpp
+++ b/include/login_routes.hpp
@@ -34,7 +34,7 @@ inline void requestRoutes(App& app)
// within it are not destroyed before we can use them
nlohmann::json loginCredentials;
// Check if auth was provided by a payload
- if (boost::starts_with(contentType, "application/json"))
+ if (contentType.starts_with("application/json"))
{
loginCredentials = nlohmann::json::parse(req.body, nullptr, false);
if (loginCredentials.is_discarded())
@@ -116,7 +116,7 @@ inline void requestRoutes(App& app)
}
}
}
- else if (boost::starts_with(contentType, "multipart/form-data"))
+ else if (contentType.starts_with("multipart/form-data"))
{
looksLikePhosphorRest = true;
MultipartParser parser;
diff --git a/include/multipart_parser.hpp b/include/multipart_parser.hpp
index 9d801da979..2fe3679452 100644
--- a/include/multipart_parser.hpp
+++ b/include/multipart_parser.hpp
@@ -1,6 +1,5 @@
#pragma once
-#include <boost/algorithm/string/predicate.hpp>
#include <boost/beast/http/fields.hpp>
#include <http_request.hpp>
@@ -58,8 +57,7 @@ class MultipartParser
std::string_view contentType = req.getHeaderValue("content-type");
const std::string boundaryFormat = "multipart/form-data; boundary=";
- if (!boost::starts_with(req.getHeaderValue("content-type"),
- boundaryFormat))
+ if (!contentType.starts_with(boundaryFormat))
{
return ParserError::ERROR_BOUNDARY_FORMAT;
}
diff --git a/include/openbmc_dbus_rest.hpp b/include/openbmc_dbus_rest.hpp
index d0bc29c3d1..cf07f76f33 100644
--- a/include/openbmc_dbus_rest.hpp
+++ b/include/openbmc_dbus_rest.hpp
@@ -17,7 +17,9 @@
#include <app.hpp>
#include <async_resp.hpp>
-#include <boost/algorithm/string.hpp>
+#include <boost/algorithm/string/classification.hpp>
+#include <boost/algorithm/string/predicate.hpp>
+#include <boost/algorithm/string/split.hpp>
#include <boost/container/flat_set.hpp>
#include <dbus_singleton.hpp>
#include <dbus_utility.hpp>
@@ -207,7 +209,7 @@ inline void findRemainingObjectsForEnumerate(
{
for (const auto& interface : interfaces)
{
- if (!boost::starts_with(interface, "org.freedesktop.DBus"))
+ if (!interface.starts_with("org.freedesktop.DBus"))
{
getPropertiesForEnumerate(path, service, interface,
asyncResp);
@@ -244,7 +246,6 @@ struct InProgressEnumerateData
InProgressEnumerateData(InProgressEnumerateData&&) = delete;
InProgressEnumerateData& operator=(const InProgressEnumerateData&) = delete;
InProgressEnumerateData& operator=(InProgressEnumerateData&&) = delete;
-
const std::string objectPath;
std::shared_ptr<dbus::utility::MapperGetSubTreeResponse> subtree;
std::shared_ptr<bmcweb::AsyncResp> asyncResp;
@@ -275,7 +276,7 @@ inline void getManagedObjectsForEnumerate(
for (const auto& objectPath : objects)
{
- if (boost::starts_with(objectPath.first.str, objectName))
+ if (objectPath.first.str.starts_with(objectName))
{
BMCWEB_LOG_DEBUG << "Reading object " << objectPath.first.str;
nlohmann::json& objectJson = dataJson[objectPath.first.str];
@@ -775,7 +776,7 @@ inline int convertJsonToDbus(sd_bus_message* m, const std::string& argType,
}
sd_bus_message_append_basic(m, argCode[0], doubleValue);
}
- else if (boost::starts_with(argCode, "a"))
+ else if (argCode.starts_with("a"))
{
std::string containedType = argCode.substr(1);
r = sd_bus_message_open_container(m, SD_BUS_TYPE_ARRAY,
@@ -795,7 +796,7 @@ inline int convertJsonToDbus(sd_bus_message* m, const std::string& argType,
}
sd_bus_message_close_container(m);
}
- else if (boost::starts_with(argCode, "v"))
+ else if (argCode.starts_with("v"))
{
std::string containedType = argCode.substr(1);
BMCWEB_LOG_DEBUG << "variant type: " << argCode
@@ -819,8 +820,7 @@ inline int convertJsonToDbus(sd_bus_message* m, const std::string& argType,
return r;
}
}
- else if (boost::starts_with(argCode, "(") &&
- boost::ends_with(argCode, ")"))
+ else if (argCode.starts_with("(") && argCode.ends_with(")"))
{
std::string containedType = argCode.substr(1, argCode.size() - 1);
r = sd_bus_message_open_container(m, SD_BUS_TYPE_STRUCT,
@@ -846,8 +846,7 @@ inline int convertJsonToDbus(sd_bus_message* m, const std::string& argType,
}
r = sd_bus_message_close_container(m);
}
- else if (boost::starts_with(argCode, "{") &&
- boost::ends_with(argCode, "}"))
+ else if (argCode.starts_with("{") && argCode.ends_with("}"))
{
std::string containedType = argCode.substr(1, argCode.size() - 1);
r = sd_bus_message_open_container(m, SD_BUS_TYPE_DICT_ENTRY,
@@ -1000,8 +999,7 @@ inline int readArrayFromMessage(const std::string& typeCode,
return r;
}
- bool dict = boost::starts_with(containedType, "{") &&
- boost::ends_with(containedType, "}");
+ bool dict = containedType.starts_with("{") && containedType.ends_with("}");
if (dict)
{
@@ -1243,7 +1241,7 @@ inline int convertDBusToJSON(const std::string& returnType,
return r;
}
}
- else if (boost::starts_with(typeCode, "a"))
+ else if (typeCode.starts_with("a"))
{
r = readArrayFromMessage(typeCode, m, *thisElement);
if (r < 0)
@@ -1251,8 +1249,7 @@ inline int convertDBusToJSON(const std::string& returnType,
return r;
}
}
- else if (boost::starts_with(typeCode, "(") &&
- boost::ends_with(typeCode, ")"))
+ else if (typeCode.starts_with("(") && typeCode.ends_with(")"))
{
r = readStructFromMessage(typeCode, m, *thisElement);
if (r < 0)
@@ -1260,7 +1257,7 @@ inline int convertDBusToJSON(const std::string& returnType,
return r;
}
}
- else if (boost::starts_with(typeCode, "v"))
+ else if (typeCode.starts_with("v"))
{
r = readVariantFromMessage(m, *thisElement);
if (r < 0)
@@ -2028,13 +2025,13 @@ inline void handleDBusUrl(const crow::Request& req,
}
else if (req.method() == boost::beast::http::verb::get)
{
- if (boost::ends_with(objectPath, "/enumerate"))
+ if (objectPath.ends_with("/enumerate"))
{
objectPath.erase(objectPath.end() - sizeof("enumerate"),
objectPath.end());
handleEnumerate(asyncResp, objectPath);
}
- else if (boost::ends_with(objectPath, "/list"))
+ else if (objectPath.ends_with("/list"))
{
objectPath.erase(objectPath.end() - sizeof("list"),
objectPath.end());
@@ -2043,7 +2040,7 @@ inline void handleDBusUrl(const crow::Request& req,
else
{
// Trim any trailing "/" at the end
- if (boost::ends_with(objectPath, "/"))
+ if (objectPath.ends_with("/"))
{
objectPath.pop_back();
handleList(asyncResp, objectPath, 1);
diff --git a/include/webassets.hpp b/include/webassets.hpp
index 6353a42b1a..3d25296f4e 100644
--- a/include/webassets.hpp
+++ b/include/webassets.hpp
@@ -79,7 +79,7 @@ inline void requestRoutes(App& app)
if (std::filesystem::is_directory(dir))
{
// don't recurse into hidden directories or symlinks
- if (boost::starts_with(dir.path().filename().string(), ".") ||
+ if (dir.path().filename().string().starts_with(".") ||
std::filesystem::is_symlink(dir))
{
dirIter.disable_recursion_pending();
@@ -99,7 +99,7 @@ inline void requestRoutes(App& app)
contentEncoding = "gzip";
}
- if (boost::starts_with(webpath.filename().string(), "index."))
+ if (webpath.filename().string().starts_with("index."))
{
webpath = webpath.parent_path();
if (webpath.string().empty() || webpath.string().back() != '/')
diff --git a/redfish-core/include/event_service_manager.hpp b/redfish-core/include/event_service_manager.hpp
index aa7f0eb261..0bce29f541 100644
--- a/redfish-core/include/event_service_manager.hpp
+++ b/redfish-core/include/event_service_manager.hpp
@@ -22,6 +22,8 @@
#include <sys/inotify.h>
+#include <boost/algorithm/string/classification.hpp>
+#include <boost/algorithm/string/split.hpp>
#include <boost/asio/io_context.hpp>
#include <boost/container/flat_map.hpp>
#include <dbus_utility.hpp>
diff --git a/redfish-core/lib/certificate_service.hpp b/redfish-core/lib/certificate_service.hpp
index a4ecbf048c..c2c873d6b9 100644
--- a/redfish-core/lib/certificate_service.hpp
+++ b/redfish-core/lib/certificate_service.hpp
@@ -318,15 +318,14 @@ inline void requestRoutesCertificateActionGenerateCSR(App& app)
std::string objectPath;
std::string service;
- if (boost::starts_with(
- certURI,
+ if (certURI.starts_with(
"/redfish/v1/Managers/bmc/NetworkProtocol/HTTPS/Certificates"))
{
objectPath = certs::httpsObjectPath;
service = certs::httpsServiceName;
}
- else if (boost::starts_with(
- certURI, "/redfish/v1/AccountService/LDAP/Certificates"))
+ else if (certURI.starts_with(
+ "/redfish/v1/AccountService/LDAP/Certificates"))
{
objectPath = certs::ldapObjectPath;
service = certs::ldapServiceName;
@@ -358,8 +357,7 @@ inline void requestRoutesCertificateActionGenerateCSR(App& app)
}
// validate KeyUsage supporting only 1 type based on URL
- if (boost::starts_with(
- certURI,
+ if (certURI.starts_with(
"/redfish/v1/Managers/bmc/NetworkProtocol/HTTPS/Certificates"))
{
if (optKeyUsage->empty())
@@ -382,8 +380,8 @@ inline void requestRoutesCertificateActionGenerateCSR(App& app)
return;
}
}
- else if (boost::starts_with(
- certURI, "/redfish/v1/AccountService/LDAP/Certificates"))
+ else if (certURI.starts_with(
+ "/redfish/v1/AccountService/LDAP/Certificates"))
{
if (optKeyUsage->empty())
{
@@ -799,8 +797,7 @@ inline void requestRoutesCertificateActionsReplaceCertificate(App& app)
std::string objectPath;
std::string name;
std::string service;
- if (boost::starts_with(
- certURI,
+ if (certURI.starts_with(
"/redfish/v1/Managers/bmc/NetworkProtocol/HTTPS/Certificates/"))
{
objectPath =
@@ -808,16 +805,15 @@ inline void requestRoutesCertificateActionsReplaceCertificate(App& app)
name = "HTTPS certificate";
service = certs::httpsServiceName;
}
- else if (boost::starts_with(
- certURI, "/redfish/v1/AccountService/LDAP/Certificates/"))
+ else if (certURI.starts_with(
+ "/redfish/v1/AccountService/LDAP/Certificates/"))
{
objectPath =
std::string(certs::ldapObjectPath) + "/" + std::to_string(id);
name = "LDAP certificate";
service = certs::ldapServiceName;
}
- else if (boost::starts_with(
- certURI,
+ else if (certURI.starts_with(
"/redfish/v1/Managers/bmc/Truststore/Certificates/"))
{
objectPath = std::string(certs::authorityObjectPath) + "/" +
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/";
diff --git a/redfish-core/lib/health.hpp b/redfish-core/lib/health.hpp
index cf84c9306a..2f0f156ae0 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 @@ struct HealthPopulate : std::enable_shared_from_this<HealthPopulate>
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 @@ struct HealthPopulate : std::enable_shared_from_this<HealthPopulate>
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 @@ struct HealthPopulate : std::enable_shared_from_this<HealthPopulate>
}
}
- 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 @@ struct HealthPopulate : std::enable_shared_from_this<HealthPopulate>
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 @@ struct HealthPopulate : std::enable_shared_from_this<HealthPopulate>
return;
}
}
- else if (boost::ends_with(path.str, "warning"))
+ else if (path.str.ends_with("warning"))
{
if (rollup != "Critical")
{
@@ -224,8 +223,8 @@ struct HealthPopulate : std::enable_shared_from_this<HealthPopulate>
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;
diff --git a/redfish-core/lib/log_services.hpp b/redfish-core/lib/log_services.hpp
index ffae14d6a8..fc5754b131 100644
--- a/redfish-core/lib/log_services.hpp
+++ b/redfish-core/lib/log_services.hpp
@@ -27,6 +27,7 @@
#include <unistd.h>
#include <app.hpp>
+#include <boost/algorithm/string/classification.hpp>
#include <boost/algorithm/string/replace.hpp>
#include <boost/algorithm/string/split.hpp>
#include <boost/beast/http.hpp>
@@ -312,7 +313,7 @@ static bool
{
// If we find a redfish log file, save the path
std::string filename = dirEnt.path().filename();
- if (boost::starts_with(filename, redfishLogFilename))
+ if (filename.starts_with(redfishLogFilename))
{
redfishLogFiles.emplace_back(redfishLogDir / filename);
}
@@ -1774,7 +1775,7 @@ inline bool
std::string filename = it.path().filename();
// Prefix of each log files is "log". Find the file and save the
// path
- if (boost::starts_with(filename, "log"))
+ if (filename.starts_with("log"))
{
hostLoggerFiles.emplace_back(it.path());
}
diff --git a/redfish-core/lib/memory.hpp b/redfish-core/lib/memory.hpp
index c4a2ef4ca6..3c10130e5b 100644
--- a/redfish-core/lib/memory.hpp
+++ b/redfish-core/lib/memory.hpp
@@ -18,7 +18,6 @@
#include "health.hpp"
#include <app.hpp>
-#include <boost/algorithm/string.hpp>
#include <dbus_utility.hpp>
#include <nlohmann/json.hpp>
#include <query.hpp>
@@ -383,7 +382,7 @@ inline void getPersistentMemoryProperties(
for (const char* v : values)
{
- if (boost::ends_with(*value, v))
+ if (value->ends_with(v))
{
aResp->res.jsonValue[jsonPtr]["OperatingMemoryModes"].push_back(
v);
@@ -405,7 +404,7 @@ inline void getPersistentMemoryProperties(
for (const char* v : values)
{
- if (boost::ends_with(*value, v))
+ if (value->ends_with(v))
{
aResp->res.jsonValue[jsonPtr]["MemoryMedia"].push_back(v);
break;
@@ -554,7 +553,7 @@ inline void
for (const char* v : values)
{
- if (boost::ends_with(*value, v))
+ if (value->ends_with(v))
{
aResp->res.jsonValue[jsonPtr]["ErrorCorrection"] = v;
break;
@@ -578,7 +577,7 @@ inline void
for (const char* v : values)
{
- if (boost::ends_with(*value, v))
+ if (value->ends_with(v))
{
aResp->res.jsonValue[jsonPtr]["BaseModuleType"] = v;
break;
@@ -642,7 +641,7 @@ inline void
{
aResp->res.jsonValue[jsonPtr]["MemoryType"] = "DRAM";
}
- else if (boost::ends_with(*value, "Logical"))
+ else if (value->ends_with("Logical"))
{
aResp->res.jsonValue[jsonPtr]["MemoryType"] = "IntelOptane";
}
diff --git a/redfish-core/lib/processor.hpp b/redfish-core/lib/processor.hpp
index a8cfb68d47..a7f8a413fe 100644
--- a/redfish-core/lib/processor.hpp
+++ b/redfish-core/lib/processor.hpp
@@ -230,7 +230,7 @@ inline void getCpuDataByService(std::shared_ptr<bmcweb::AsyncResp> aResp,
{
getCpuDataByInterface(aResp, object.second);
}
- else if (boost::starts_with(object.first.str, corePath))
+ else if (object.first.str.starts_with(corePath))
{
for (const auto& interface : object.second)
{
@@ -700,7 +700,7 @@ inline void getProcessorObject(const std::shared_ptr<bmcweb::AsyncResp>& resp,
for (const auto& [objectPath, serviceMap] : subtree)
{
// Ignore any objects which don't end with our desired cpu name
- if (!boost::ends_with(objectPath, processorId))
+ if (!objectPath.ends_with(processorId))
{
continue;
}
@@ -1014,7 +1014,7 @@ inline void patchAppliedOperatingConfig(
std::string expectedPrefix("/redfish/v1/Systems/system/Processors/");
expectedPrefix += processorId;
expectedPrefix += "/OperatingConfigs/";
- if (!boost::starts_with(appliedConfigUri, expectedPrefix) ||
+ if (!appliedConfigUri.starts_with(expectedPrefix) ||
expectedPrefix.size() == appliedConfigUri.size())
{
messages::propertyValueIncorrect(
@@ -1078,7 +1078,7 @@ inline void requestRoutesOperatingConfigCollection(App& app)
for (const std::string& object : objects)
{
- if (!boost::ends_with(object, cpuName))
+ if (!object.ends_with(cpuName))
{
continue;
}
@@ -1138,8 +1138,7 @@ inline void requestRoutesOperatingConfig(App& app)
for (const auto& [objectPath, serviceMap] : subtree)
{
// Ignore any configs without matching cpuX/configY
- if (!boost::ends_with(objectPath, expectedEnding) ||
- serviceMap.empty())
+ if (!objectPath.ends_with(expectedEnding) || serviceMap.empty())
{
continue;
}
diff --git a/redfish-core/lib/sensors.hpp b/redfish-core/lib/sensors.hpp
index 6e72fea43d..04b5190f2b 100644
--- a/redfish-core/lib/sensors.hpp
+++ b/redfish-core/lib/sensors.hpp
@@ -16,7 +16,7 @@
#pragma once
#include <app.hpp>
-#include <boost/algorithm/string/predicate.hpp>
+#include <boost/algorithm/string/classification.hpp>
#include <boost/algorithm/string/split.hpp>
#include <boost/range/algorithm/replace_copy_if.hpp>
#include <dbus_singleton.hpp>
@@ -463,7 +463,7 @@ inline void reduceSensorList(
{
for (const std::string& sensor : *allSensors)
{
- if (boost::starts_with(sensor, type))
+ if (sensor.starts_with(type))
{
activeSensors->emplace(sensor);
}
@@ -1232,11 +1232,11 @@ inline void populateFanRedundancy(
std::string health;
- if (boost::ends_with(*status, "Full"))
+ if (status->ends_with("Full"))
{
health = "OK";
}
- else if (boost::ends_with(*status, "Degraded"))
+ else if (status->ends_with("Degraded"))
{
health = "Warning";
}
@@ -1982,15 +1982,15 @@ void getInventoryLedData(
if (inventoryItem != nullptr)
{
// Store LED state in InventoryItem
- if (boost::ends_with(state, "On"))
+ if (state.ends_with("On"))
{
inventoryItem->ledState = LedState::ON;
}
- else if (boost::ends_with(state, "Blink"))
+ else if (state.ends_with("Blink"))
{
inventoryItem->ledState = LedState::BLINK;
}
- else if (boost::ends_with(state, "Off"))
+ else if (state.ends_with("Off"))
{
inventoryItem->ledState = LedState::OFF;
}
diff --git a/redfish-core/lib/update_service.hpp b/redfish-core/lib/update_service.hpp
index c9fb4a12ad..1beef2e865 100644
--- a/redfish-core/lib/update_service.hpp
+++ b/redfish-core/lib/update_service.hpp
@@ -158,8 +158,8 @@ static void
return !task::completed;
}
- if (boost::ends_with(*state, "Invalid") ||
- boost::ends_with(*state, "Failed"))
+ if (state->ends_with("Invalid") ||
+ state->ends_with("Failed"))
{
taskData->state = "Exception";
taskData->status = "Warning";
@@ -168,7 +168,7 @@ static void
return task::completed;
}
- if (boost::ends_with(*state, "Staged"))
+ if (state->ends_with("Staged"))
{
taskData->state = "Stopping";
taskData->messages.emplace_back(
@@ -183,7 +183,7 @@ static void
return !task::completed;
}
- if (boost::ends_with(*state, "Active"))
+ if (state->ends_with("Active"))
{
taskData->messages.emplace_back(
messages::taskCompletedOK(index));
@@ -924,7 +924,7 @@ inline void requestRoutesSoftwareInventory(App& app)
std::string, std::vector<std::string>>>>&
obj : subtree)
{
- if (!boost::ends_with(obj.first, *swId))
+ if (!obj.first.ends_with(*swId))
{
continue;
}