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/include/authentication.hpp b/include/authentication.hpp
index 8d59be4..ac2a7d1 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 @@
 {
     BMCWEB_LOG_DEBUG << "[AuthMiddleware] Basic authentication";
 
-    if (!boost::starts_with(authHeader, "Basic "))
+    if (!authHeader.starts_with("Basic "))
     {
         return nullptr;
     }
@@ -97,7 +96,7 @@
     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 3970992..c150943 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 2c6668c..5df3daa 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 8d50c9f..0d8e287 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 fde4b8f..fd1c357 100644
--- a/include/login_routes.hpp
+++ b/include/login_routes.hpp
@@ -34,7 +34,7 @@
         // 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 @@
                 }
             }
         }
-        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 9d801da..2fe3679 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 @@
         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 d0bc29c..cf07f76 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 @@
             {
                 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 @@
     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 @@
 
         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 @@
             }
             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 @@
             }
             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 @@
                 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 @@
             }
             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 @@
         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 @@
                 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 @@
                 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 @@
                 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 @@
     }
     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 @@
         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 6353a42..3d25296 100644
--- a/include/webassets.hpp
+++ b/include/webassets.hpp
@@ -79,7 +79,7 @@
         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 @@
                 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() != '/')