treewide: remove 'using namespace' from headers
Using namespace at global scope in a header file violates the cpp core
guidelines. Quoting the guidelines:
"Doing so takes away an #includer’s ability to effectively
disambiguate and to use alternatives. It also makes #included headers
order-dependent as they might have different meaning when included in
different orders."
For further reading:
https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rs-using-directive
The guidelines don't call out using using namespace from namespace
scope, but it is only marginally less problematic and still unexpected,
so this patch removes those as well.
The process used to do the update is roughly:
1 - git grep 'using namespace' **.hpp
2 - For each instance, remove the offending 'using namespace' line
3 - build
4 - add 'using namespace' to cpp files or fully resolve types in hpp
files until the project builds again.
Further cleanup is possible - for example cpp files could be scrubbed
for unnecessary namespace qualification - this was not done here to make
review as simple as possible.
Change-Id: I4931f5e78a1b5b74b4a4774c035a549f4d59b91a
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
diff --git a/libpldmresponder/platform_state_sensor.hpp b/libpldmresponder/platform_state_sensor.hpp
index 48a750a..53477ff 100644
--- a/libpldmresponder/platform_state_sensor.hpp
+++ b/libpldmresponder/platform_state_sensor.hpp
@@ -13,8 +13,6 @@
#include <cstdint>
#include <map>
-using namespace pldm::responder::pdr;
-
namespace pldm
{
namespace responder
@@ -34,8 +32,9 @@
template <class DBusInterface>
uint8_t getStateSensorEventState(
const DBusInterface& dBusIntf,
- const std::map<State, pldm::utils::PropertyValue>& stateToDbusValue,
- const DBusMapping& dbusMapping)
+ const std::map<pldm::responder::pdr_utils::State,
+ pldm::utils::PropertyValue>& stateToDbusValue,
+ const pldm::utils::DBusMapping& dbusMapping)
{
try
{
@@ -88,7 +87,7 @@
std::unique_ptr<pldm_pdr, decltype(&pldm_pdr_destroy)> stateSensorPdrRepo(
pldm_pdr_init(), pldm_pdr_destroy);
- Repo stateSensorPDRs(stateSensorPdrRepo.get());
+ pldm::responder::pdr_utils::Repo stateSensorPDRs(stateSensorPdrRepo.get());
getRepoByType(handler.getRepo(), stateSensorPDRs, PLDM_STATE_SENSOR_PDR);
if (stateSensorPDRs.empty())
{
@@ -96,7 +95,7 @@
return PLDM_PLATFORM_INVALID_SENSOR_ID;
}
- PdrEntry pdrEntry{};
+ pldm::responder::pdr_utils::PdrEntry pdrEntry{};
auto pdrRecord = stateSensorPDRs.getFirstRecord(pdrEntry);
while (pdrRecord)
{
@@ -135,8 +134,8 @@
int rc = PLDM_SUCCESS;
try
{
- const auto& [dbusMappings, dbusValMaps] =
- handler.getDbusObjMaps(sensorId, TypeId::PLDM_SENSOR_ID);
+ const auto& [dbusMappings, dbusValMaps] = handler.getDbusObjMaps(
+ sensorId, pldm::responder::pdr_utils::TypeId::PLDM_SENSOR_ID);
stateField.clear();
for (size_t i = 0; i < sensorRearmCnt; i++)