bmcweb: move variant usage to std namespace
Change-Id: I9d7069668f91f2ac72d2f4a440f63e0e85dd5269
Signed-off-by: Ed Tanous <ed.tanous@intel.com>
diff --git a/include/dbus_monitor.hpp b/include/dbus_monitor.hpp
index d4f2647..1b82697 100644
--- a/include/dbus_monitor.hpp
+++ b/include/dbus_monitor.hpp
@@ -8,15 +8,15 @@
#include <openbmc_dbus_rest.hpp>
#include <sdbusplus/bus/match.hpp>
#include <sdbusplus/message/types.hpp>
+#include <variant>
namespace nlohmann
{
-template <typename... Args>
-struct adl_serializer<sdbusplus::message::variant<Args...>>
+template <typename... Args> struct adl_serializer<std::variant<Args...>>
{
- static void to_json(json& j, const sdbusplus::message::variant<Args...>& v)
+ static void to_json(json& j, const std::variant<Args...>& v)
{
- sdbusplus::message::variant_ns::visit([&](auto&& val) { j = val; }, v);
+ std::visit([&](auto&& val) { j = val; }, v);
}
};
} // namespace nlohmann
diff --git a/include/dbus_utility.hpp b/include/dbus_utility.hpp
index 8677cc8..e45bb9a 100644
--- a/include/dbus_utility.hpp
+++ b/include/dbus_utility.hpp
@@ -24,10 +24,11 @@
namespace utility
{
-using DbusVariantType = sdbusplus::message::variant<
- std::vector<std::tuple<std::string, std::string, std::string>>,
- std::vector<std::string>, std::vector<double>, std::string, int64_t,
- uint64_t, double, int32_t, uint32_t, int16_t, uint16_t, uint8_t, bool>;
+using DbusVariantType =
+ std::variant<std::vector<std::tuple<std::string, std::string, std::string>>,
+ std::vector<std::string>, std::vector<double>, std::string,
+ int64_t, uint64_t, double, int32_t, uint32_t, int16_t,
+ uint16_t, uint8_t, bool>;
using ManagedObjectType = std::vector<
std::pair<sdbusplus::message::object_path,
diff --git a/include/image_upload.hpp b/include/image_upload.hpp
index 6b87530..6bf5661 100644
--- a/include/image_upload.hpp
+++ b/include/image_upload.hpp
@@ -66,8 +66,7 @@
sdbusplus::message::object_path path;
std::vector<std::pair<
std::string,
- std::vector<std::pair<
- std::string, sdbusplus::message::variant<std::string>>>>>
+ std::vector<std::pair<std::string, std::variant<std::string>>>>>
interfaces;
m.read(path, interfaces);
diff --git a/include/openbmc_dbus_rest.hpp b/include/openbmc_dbus_rest.hpp
index 9503191..27a9e3d 100644
--- a/include/openbmc_dbus_rest.hpp
+++ b/include/openbmc_dbus_rest.hpp
@@ -155,8 +155,8 @@
for (const auto &[name, value] : propertiesList)
{
nlohmann::json &propertyJson = objectJson[name];
- sdbusplus::message::variant_ns::visit(
- [&propertyJson](auto &&val) { propertyJson = val; }, value);
+ std::visit([&propertyJson](auto &&val) { propertyJson = val; },
+ value);
}
},
service, objectPath, "org.freedesktop.DBus.Properties", "GetAll",
@@ -255,11 +255,9 @@
{
nlohmann::json &propertyJson =
objectJson[property.first];
- sdbusplus::message::variant_ns::visit(
- [&propertyJson](auto &&val) {
- propertyJson = val;
- },
- property.second);
+ std::visit([&propertyJson](
+ auto &&val) { propertyJson = val; },
+ property.second);
}
}
}