Use std::map.contains as per latest c++

This commit replaces occurrences of 'find' with
'contains' to access elements in a std::map
according to the latest C++ standard (since C++20).

However, contains() is not suitable in all situations
as in the case where we want to use the element contained
in the map using contains(), then it would do 2 searches
instead of 1 in the case where we use find() which fetches
the element from the map also.

Here are some relevant links to C++ documentation and
resources:

[1]: https://en.cppreference.com/w/cpp/container/map/find
[2]: https://en.cppreference.com/w/cpp/container/map/contains
[3]: https://wg21.link/N4861

Signed-off-by: Sagar Srinivas <sagar.srinivas@ibm.com>
Change-Id: If589e52026417c1c14a6a946e48826b749034e9a
diff --git a/libpldmresponder/base.cpp b/libpldmresponder/base.cpp
index 8d7b918..e0708a4 100644
--- a/libpldmresponder/base.cpp
+++ b/libpldmresponder/base.cpp
@@ -111,7 +111,7 @@
 
     // DSP0240 has this as a bitfield8[N], where N = 0 to 31
     std::array<bitfield8_t, 32> cmds{};
-    if (capabilities.find(type) == capabilities.end())
+    if (!capabilities.contains(type))
     {
         return CmdHandler::ccOnlyResponse(request,
                                           PLDM_ERROR_INVALID_PLDM_TYPE);
diff --git a/libpldmresponder/event_parser.cpp b/libpldmresponder/event_parser.cpp
index 303a553..23ffa2c 100644
--- a/libpldmresponder/event_parser.cpp
+++ b/libpldmresponder/event_parser.cpp
@@ -69,8 +69,7 @@
             dbusInfo.propertyType = dbus.value("property_type", "");
             if (dbusInfo.objectPath.empty() || dbusInfo.interface.empty() ||
                 dbusInfo.propertyName.empty() ||
-                (supportedDbusPropertyTypes.find(dbusInfo.propertyType) ==
-                 supportedDbusPropertyTypes.end()))
+                !supportedDbusPropertyTypes.contains(dbusInfo.propertyType))
             {
                 error(
                     "Invalid dbus config, OBJPATH= {DBUS_OBJ_PATH} INTERFACE={DBUS_INTF} PROPERTY_NAME={DBUS_PROP} PROPERTY_TYPE={DBUS_PROP_TYPE}",
diff --git a/libpldmresponder/fru.cpp b/libpldmresponder/fru.cpp
index de6fe1f..632489c 100644
--- a/libpldmresponder/fru.cpp
+++ b/libpldmresponder/fru.cpp
@@ -172,7 +172,7 @@
         const auto& interfaces = object.second;
         for (const auto& interface : interfaces)
         {
-            if (itemIntfsLookup.find(interface.first) != itemIntfsLookup.end())
+            if (itemIntfsLookup.contains(interface.first))
             {
                 // checking fru present property is available or not.
                 if (!pldm::utils::checkForFruPresence(object.first.str))
diff --git a/libpldmresponder/pdr_numeric_effecter.hpp b/libpldmresponder/pdr_numeric_effecter.hpp
index ffcc41a..17ed002 100644
--- a/libpldmresponder/pdr_numeric_effecter.hpp
+++ b/libpldmresponder/pdr_numeric_effecter.hpp
@@ -58,8 +58,7 @@
         {
             std::string entity_path = e.value("entity_path", "");
             auto& associatedEntityMap = handler.getAssociateEntityMap();
-            if (entity_path != "" && associatedEntityMap.find(entity_path) !=
-                                         associatedEntityMap.end())
+            if (entity_path != "" && associatedEntityMap.contains(entity_path))
             {
                 pdr->entity_type =
                     associatedEntityMap.at(entity_path).entity_type;
diff --git a/libpldmresponder/pdr_state_effecter.hpp b/libpldmresponder/pdr_state_effecter.hpp
index 49e079c..68cfb00 100644
--- a/libpldmresponder/pdr_state_effecter.hpp
+++ b/libpldmresponder/pdr_state_effecter.hpp
@@ -76,8 +76,7 @@
         {
             std::string entity_path = e.value("entity_path", "");
             auto& associatedEntityMap = handler.getAssociateEntityMap();
-            if (entity_path != "" && associatedEntityMap.find(entity_path) !=
-                                         associatedEntityMap.end())
+            if (entity_path != "" && associatedEntityMap.contains(entity_path))
             {
                 pdr->entity_type =
                     associatedEntityMap.at(entity_path).entity_type;
diff --git a/libpldmresponder/pdr_state_sensor.hpp b/libpldmresponder/pdr_state_sensor.hpp
index 72b47ff..aa29859 100644
--- a/libpldmresponder/pdr_state_sensor.hpp
+++ b/libpldmresponder/pdr_state_sensor.hpp
@@ -79,8 +79,7 @@
         {
             std::string entity_path = e.value("entity_path", "");
             auto& associatedEntityMap = handler.getAssociateEntityMap();
-            if (entity_path != "" && associatedEntityMap.find(entity_path) !=
-                                         associatedEntityMap.end())
+            if (entity_path != "" && associatedEntityMap.contains(entity_path))
             {
                 pdr->entity_type =
                     associatedEntityMap.at(entity_path).entity_type;
diff --git a/libpldmresponder/platform.cpp b/libpldmresponder/platform.cpp
index 72f2977..6c77159 100644
--- a/libpldmresponder/platform.cpp
+++ b/libpldmresponder/platform.cpp
@@ -481,7 +481,7 @@
         }
 
         const auto& possibleStates = compositeSensorStates[sensorOffset];
-        if (possibleStates.find(eventState) == possibleStates.end())
+        if (!possibleStates.contains(eventState))
         {
             return PLDM_ERROR_INVALID_DATA;
         }
diff --git a/pldmtool/pldm_fru_cmd.cpp b/pldmtool/pldm_fru_cmd.cpp
index 2e2ebf4..6d57656 100644
--- a/pldmtool/pldm_fru_cmd.cpp
+++ b/pldmtool/pldm_fru_cmd.cpp
@@ -152,8 +152,7 @@
                         auto oemIPZValue = fruFieldValuestring(tlv->value,
                                                                tlv->length);
 
-                        if (populateMaps.find(oemIPZValue) !=
-                            populateMaps.end())
+                        if (populateMaps.contains(oemIPZValue))
                         {
                             const std::map<uint8_t, std::string> IPZTypes =
                                 populateMaps.at(oemIPZValue);