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_numeric_effecter.hpp b/libpldmresponder/platform_numeric_effecter.hpp
index eea53e6..b919516 100644
--- a/libpldmresponder/platform_numeric_effecter.hpp
+++ b/libpldmresponder/platform_numeric_effecter.hpp
@@ -16,9 +16,6 @@
#include <map>
#include <optional>
-using namespace pldm::responder::pdr;
-using namespace pldm::utils;
-
namespace pldm
{
namespace responder
@@ -35,14 +32,14 @@
* failure, PropertyValue: The value to be set
*/
template <typename T>
-std::pair<int, std::optional<PropertyValue>>
+std::pair<int, std::optional<pldm::utils::PropertyValue>>
getEffecterRawValue(const pldm_numeric_effecter_value_pdr* pdr,
T& effecterValue, std::string propertyType)
{
// X = Round [ (Y - B) / m ]
// refer to DSP0248_1.2.0 27.8
int rc = 0;
- PropertyValue value;
+ pldm::utils::PropertyValue value;
switch (pdr->effecter_data_size)
{
case PLDM_EFFECTER_DATA_SIZE_UINT8:
@@ -164,7 +161,7 @@
* @return std::pair<int, std::optional<PropertyValue>> - rc:Success or
* failure, PropertyValue: The value to be set
*/
-std::pair<int, std::optional<PropertyValue>>
+std::pair<int, std::optional<pldm::utils::PropertyValue>>
convertToDbusValue(const pldm_numeric_effecter_value_pdr* pdr,
uint8_t effecterDataSize, uint8_t* effecterValue,
std::string propertyType)
@@ -236,9 +233,10 @@
std::unique_ptr<pldm_pdr, decltype(&pldm_pdr_destroy)>
numericEffecterPdrRepo(pldm_pdr_init(), pldm_pdr_destroy);
- Repo numericEffecterPDRs(numericEffecterPdrRepo.get());
- getRepoByType(handler.getRepo(), numericEffecterPDRs,
- PLDM_NUMERIC_EFFECTER_PDR);
+ pldm::responder::pdr_utils::Repo numericEffecterPDRs(
+ numericEffecterPdrRepo.get());
+ pldm::responder::pdr::getRepoByType(handler.getRepo(), numericEffecterPDRs,
+ PLDM_NUMERIC_EFFECTER_PDR);
if (numericEffecterPDRs.empty())
{
std::cerr << "The Numeric Effecter PDR repo is empty." << std::endl;
@@ -247,7 +245,7 @@
// Get the pdr structure of pldm_numeric_effecter_value_pdr according
// to the effecterId
- PdrEntry pdrEntry{};
+ pldm::responder::pdr_utils::PdrEntry pdrEntry{};
auto pdrRecord = numericEffecterPDRs.getFirstRecord(pdrEntry);
while (pdrRecord)
{
@@ -277,7 +275,7 @@
{
const auto& [dbusMappings, dbusValMaps] =
handler.getDbusObjMaps(effecterId);
- DBusMapping dbusMapping{
+ pldm::utils::DBusMapping dbusMapping{
dbusMappings[0].objectPath, dbusMappings[0].interface,
dbusMappings[0].propertyName, dbusMappings[0].propertyType};