bmcweb: Move boost::optional to std::optional
This change is largely a sed replace, and gets us closer to standards
compliance.
Change-Id: Ie60437eff43de830ef19389344a55430dabd9d16
Signed-off-by: Ed Tanous <ed.tanous@intel.com>
diff --git a/crow/include/crow/http_connection.h b/crow/include/crow/http_connection.h
index 2b84b8d..569f15e 100644
--- a/crow/include/crow/http_connection.h
+++ b/crow/include/crow/http_connection.h
@@ -590,19 +590,19 @@
Adaptor adaptor;
Handler* handler;
- // Making this a boost::optional allows it to be efficiently destroyed and
+ // Making this a std::optional allows it to be efficiently destroyed and
// re-created on Connection reset
- boost::optional<
+ std::optional<
boost::beast::http::request_parser<boost::beast::http::string_body>>
parser;
boost::beast::flat_static_buffer<8192> buffer;
- boost::optional<boost::beast::http::response_serializer<
+ std::optional<boost::beast::http::response_serializer<
boost::beast::http::string_body>>
serializer;
- boost::optional<crow::Request> req;
+ std::optional<crow::Request> req;
crow::Response res;
const std::string& serverName;
diff --git a/crow/include/crow/http_response.h b/crow/include/crow/http_response.h
index d66bf47..6090a5b 100644
--- a/crow/include/crow/http_response.h
+++ b/crow/include/crow/http_response.h
@@ -20,7 +20,7 @@
using response_type =
boost::beast::http::response<boost::beast::http::string_body>;
- boost::optional<response_type> stringResponse;
+ std::optional<response_type> stringResponse;
nlohmann::json jsonValue;
diff --git a/redfish-core/include/privileges.hpp b/redfish-core/include/privileges.hpp
index 0f6b903..d5201f0 100644
--- a/redfish-core/include/privileges.hpp
+++ b/redfish-core/include/privileges.hpp
@@ -17,7 +17,6 @@
#include <bitset>
#include <boost/container/flat_map.hpp>
-#include <boost/optional.hpp>
#include <cstdint>
#include <vector>
diff --git a/redfish-core/include/utils/json_utils.hpp b/redfish-core/include/utils/json_utils.hpp
index 1d969e0..7ae8798 100644
--- a/redfish-core/include/utils/json_utils.hpp
+++ b/redfish-core/include/utils/json_utils.hpp
@@ -48,7 +48,7 @@
};
template <typename Type>
-struct is_optional<boost::optional<Type>> : std::true_type
+struct is_optional<std::optional<Type>> : std::true_type
{
};
diff --git a/redfish-core/lib/account_service.hpp b/redfish-core/lib/account_service.hpp
index 97e5f64..475e09c 100644
--- a/redfish-core/lib/account_service.hpp
+++ b/redfish-core/lib/account_service.hpp
@@ -181,8 +181,8 @@
std::string username;
std::string password;
- boost::optional<std::string> roleId("User");
- boost::optional<bool> enabled = true;
+ std::optional<std::string> roleId("User");
+ std::optional<bool> enabled = true;
if (!json_util::readJson(req, res, "UserName", username, "Password",
password, "RoleId", roleId, "Enabled",
enabled))
@@ -412,10 +412,10 @@
return;
}
- boost::optional<std::string> newUserName;
- boost::optional<std::string> password;
- boost::optional<bool> enabled;
- boost::optional<std::string> roleId;
+ std::optional<std::string> newUserName;
+ std::optional<std::string> password;
+ std::optional<bool> enabled;
+ std::optional<std::string> roleId;
if (!json_util::readJson(req, res, "UserName", newUserName, "Password",
password, "RoleId", roleId, "Enabled",
enabled))
@@ -460,9 +460,9 @@
void updateUserProperties(std::shared_ptr<AsyncResp> asyncResp,
const std::string& username,
- boost::optional<std::string> password,
- boost::optional<bool> enabled,
- boost::optional<std::string> roleId)
+ std::optional<std::string> password,
+ std::optional<bool> enabled,
+ std::optional<std::string> roleId)
{
if (password)
{
diff --git a/redfish-core/lib/ethernet.hpp b/redfish-core/lib/ethernet.hpp
index 58896d8..d3fe1fe 100644
--- a/redfish-core/lib/ethernet.hpp
+++ b/redfish-core/lib/ethernet.hpp
@@ -17,10 +17,10 @@
#include <boost/container/flat_map.hpp>
#include <boost/container/flat_set.hpp>
-#include <boost/optional.hpp>
#include <dbus_singleton.hpp>
#include <error_messages.hpp>
#include <node.hpp>
+#include <optional>
#include <utils/json_utils.hpp>
namespace redfish
@@ -80,7 +80,7 @@
std::string hostname;
std::string default_gateway;
std::string mac_address;
- boost::optional<uint32_t> vlan_id;
+ std::optional<uint32_t> vlan_id;
};
// Helper function that changes bits netmask notation (i.e. /24)
@@ -1028,7 +1028,7 @@
}
}
- boost::optional<uint8_t> prefixLength;
+ std::optional<uint8_t> prefixLength;
const std::string *subnetField = nullptr;
nlohmann::json::const_iterator subnetFieldIt =
thisJson.find("SubnetMask");
diff --git a/redfish-core/lib/systems.hpp b/redfish-core/lib/systems.hpp
index 12f15d1..354570c 100644
--- a/redfish-core/lib/systems.hpp
+++ b/redfish-core/lib/systems.hpp
@@ -764,7 +764,7 @@
messages::success(asyncResp->res);
std::string indicatorLedTemp;
- boost::optional<std::string> indicatorLed = indicatorLedTemp;
+ std::optional<std::string> indicatorLed = indicatorLedTemp;
if (!json_util::readJson(req, res, "IndicatorLed", indicatorLed))
{
return;