Boost::urls::format

Boost 1.82 dropped a lovely new toy, boost::urls::format, which is a lot
like our urlFromPieces method, but better in that it makes the resulting
uris more readable, and allows doing things like fragments in a single
line instead of multiple.  We should prefer it in some cases.

Tested:
Redfish service validator passes.
Spot checks of URLs work as expected.
Unit tests pass.

Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: Ia7b38f0a95771c862507e7d5b4aa68aa1c98403c
diff --git a/redfish-core/lib/processor.hpp b/redfish-core/lib/processor.hpp
index 1223875..19b059a 100644
--- a/redfish-core/lib/processor.hpp
+++ b/redfish-core/lib/processor.hpp
@@ -28,6 +28,7 @@
 
 #include <boost/container/flat_map.hpp>
 #include <boost/system/error_code.hpp>
+#include <boost/url/format.hpp>
 #include <sdbusplus/asio/property.hpp>
 #include <sdbusplus/message/native_types.hpp>
 #include <sdbusplus/unpack_properties.hpp>
@@ -553,9 +554,9 @@
         {
             const std::string& dbusPath = appliedConfig->str;
             nlohmann::json::object_t operatingConfig;
-            operatingConfig["@odata.id"] = crow::utility::urlFromPieces(
-                "redfish", "v1", "Systems", "system", "Processors", cpuId,
-                "OperatingConfigs");
+            operatingConfig["@odata.id"] = boost::urls::format(
+                "/redfish/v1/Systems/system/Processors/{}/OperatingConfigs",
+                cpuId);
             json["OperatingConfigs"] = std::move(operatingConfig);
 
             // Reuse the D-Bus config object name for the Redfish
@@ -571,9 +572,9 @@
                 return;
             }
             nlohmann::json::object_t appliedOperatingConfig;
-            appliedOperatingConfig["@odata.id"] = crow::utility::urlFromPieces(
-                "redfish", "v1", "Systems", "system", "Processors", cpuId,
-                "OperatingConfigs", dbusPath.substr(baseNamePos + 1));
+            appliedOperatingConfig["@odata.id"] = boost::urls::format(
+                "/redfish/v1/Systems/system/Processors/{}/OperatingConfigs/{}",
+                cpuId, dbusPath.substr(baseNamePos + 1));
             json["AppliedOperatingConfig"] = std::move(appliedOperatingConfig);
 
             // Once we found the current applied config, queue another
@@ -1071,9 +1072,9 @@
         }
         asyncResp->res.jsonValue["@odata.type"] =
             "#OperatingConfigCollection.OperatingConfigCollection";
-        asyncResp->res.jsonValue["@odata.id"] = crow::utility::urlFromPieces(
-            "redfish", "v1", "Systems", "system", "Processors", cpuName,
-            "OperatingConfigs");
+        asyncResp->res.jsonValue["@odata.id"] = boost::urls::format(
+            "/redfish/v1/Systems/system/Processors/{}/OperatingConfigs",
+            cpuName);
         asyncResp->res.jsonValue["Name"] = "Operating Config Collection";
 
         // First find the matching CPU object so we know how to
@@ -1111,9 +1112,9 @@
                 };
                 collection_util::getCollectionMembers(
                     asyncResp,
-                    crow::utility::urlFromPieces("redfish", "v1", "Systems",
-                                                 "system", "Processors",
-                                                 cpuName, "OperatingConfigs"),
+                    boost::urls::format(
+                        "/redfish/v1/Systems/system/Processors/{}/OperatingConfigs",
+                        cpuName),
                     interface, object.c_str());
                 return;
             }
@@ -1162,9 +1163,9 @@
 
                 nlohmann::json& json = asyncResp->res.jsonValue;
                 json["@odata.type"] = "#OperatingConfig.v1_0_0.OperatingConfig";
-                json["@odata.id"] = crow::utility::urlFromPieces(
-                    "redfish", "v1", "Systems", "system", "Processors", cpuName,
-                    "OperatingConfigs", configName);
+                json["@odata.id"] = boost::urls::format(
+                    "/redfish/v1/Systems/system/Processors/{}/OperatingConfigs/{}",
+                    cpuName, configName);
                 json["Name"] = "Processor Profile";
                 json["Id"] = configName;
 
@@ -1260,8 +1261,8 @@
             "</redfish/v1/JsonSchemas/Processor/Processor.json>; rel=describedby");
         asyncResp->res.jsonValue["@odata.type"] =
             "#Processor.v1_11_0.Processor";
-        asyncResp->res.jsonValue["@odata.id"] = crow::utility::urlFromPieces(
-            "redfish", "v1", "Systems", "system", "Processors", processorId);
+        asyncResp->res.jsonValue["@odata.id"] = boost::urls::format(
+            "/redfish/v1/Systems/system/Processors/{}", processorId);
 
         getProcessorObject(
             asyncResp, processorId,