Move over to upstream c++ style

This patchset moves bmcweb over to the upstream style naming
conventions for variables, classes, and functions, as well as imposes
the latest clang-format file.

This changeset was mostly built automatically by the included
.clang-tidy file, which has the ability to autoformat and auto rename
variables.  At some point in the future I would like to see this in
greater use, but for now, we will impose it on bmcweb, and see how it
goes.

Tested: Code still compiles, and appears to run, although other issues
are possible and likely.

Change-Id: If422a2e36df924e897736b3feffa89f411d9dac1
Signed-off-by: Ed Tanous <ed.tanous@intel.com>
diff --git a/redfish-core/lib/systems.hpp b/redfish-core/lib/systems.hpp
index 7619f14..668e6a9 100644
--- a/redfish-core/lib/systems.hpp
+++ b/redfish-core/lib/systems.hpp
@@ -28,14 +28,14 @@
  */
 class SystemAsyncResp {
  public:
-  SystemAsyncResp(crow::response &response) : res(response) {}
+  SystemAsyncResp(crow::Response &response) : res(response) {}
 
   ~SystemAsyncResp() {
     if (res.result() != (boost::beast::http::status::ok)) {
       // Reset the json object to clear out any data that made it in before the
       // error happened
       // todo(ed) handle error condition with proper code
-      res.json_value = messages::internalError();
+      res.jsonValue = messages::internalError();
     }
     res.end();
   }
@@ -44,7 +44,7 @@
     res.result(boost::beast::http::status::internal_server_error);
   }
 
-  crow::response &res;
+  crow::Response &res;
 };
 
 /**
@@ -63,8 +63,8 @@
  public:
   template <typename CallbackFunc>
   void getBaseboardList(CallbackFunc &&callback) {
-    CROW_LOG_DEBUG << "Get list of available boards.";
-    crow::connections::system_bus->async_method_call(
+    BMCWEB_LOG_DEBUG << "Get list of available boards.";
+    crow::connections::systemBus->async_method_call(
         [callback{std::move(callback)}](const boost::system::error_code ec,
                                         const std::vector<std::string> &resp) {
           // Callback requires vector<string> to retrieve all available board
@@ -78,7 +78,7 @@
             callback(false, board_list);
             return;
           }
-          CROW_LOG_DEBUG << "Got " << resp.size() << " boards.";
+          BMCWEB_LOG_DEBUG << "Got " << resp.size() << " boards.";
           // Iterate over all retrieved ObjectPaths.
           for (const std::string &objpath : resp) {
             std::size_t last_pos = objpath.rfind("/");
@@ -114,8 +114,8 @@
         "xyz.openbmc_project.Inventory.Item.System",
         "xyz.openbmc_project.Common.UUID",
     };
-    CROW_LOG_DEBUG << "Get available system components.";
-    crow::connections::system_bus->async_method_call(
+    BMCWEB_LOG_DEBUG << "Get available system components.";
+    crow::connections::systemBus->async_method_call(
         [ name, aResp{std::move(aResp)} ](
             const boost::system::error_code ec,
             const std::vector<std::pair<
@@ -123,7 +123,7 @@
                 std::vector<std::pair<std::string, std::vector<std::string>>>>>
                 &subtree) {
           if (ec) {
-            CROW_LOG_DEBUG << "DBUS response error";
+            BMCWEB_LOG_DEBUG << "DBUS response error";
             aResp->setErrorStatus();
             return;
           }
@@ -134,7 +134,7 @@
                                                      std::vector<std::string>>>>
                    &object : subtree) {
             const std::string &path = object.first;
-            CROW_LOG_DEBUG << "Got path: " << path;
+            BMCWEB_LOG_DEBUG << "Got path: " << path;
             const std::vector<std::pair<std::string, std::vector<std::string>>>
                 &connectionNames = object.second;
             if (connectionNames.size() < 1) {
@@ -143,31 +143,31 @@
             // Check if computer system exist
             if (boost::ends_with(path, name)) {
               foundName = true;
-              CROW_LOG_DEBUG << "Found name: " << name;
+              BMCWEB_LOG_DEBUG << "Found name: " << name;
               const std::string connectionName = connectionNames[0].first;
-              crow::connections::system_bus->async_method_call(
+              crow::connections::systemBus->async_method_call(
                   [ aResp, name(std::string(name)) ](
                       const boost::system::error_code ec,
                       const std::vector<std::pair<std::string, VariantType>>
                           &propertiesList) {
                     if (ec) {
-                      CROW_LOG_ERROR << "DBUS response error: " << ec;
+                      BMCWEB_LOG_ERROR << "DBUS response error: " << ec;
                       aResp->setErrorStatus();
                       return;
                     }
-                    CROW_LOG_DEBUG << "Got " << propertiesList.size()
+                    BMCWEB_LOG_DEBUG << "Got " << propertiesList.size()
                                    << "properties for system";
                     for (const std::pair<std::string, VariantType> &property :
                          propertiesList) {
                       const std::string *value =
-                          mapbox::get_ptr<const std::string>(property.second);
+                          mapbox::getPtr<const std::string>(property.second);
                       if (value != nullptr) {
-                        aResp->res.json_value[property.first] = *value;
+                        aResp->res.jsonValue[property.first] = *value;
                       }
                     }
-                    aResp->res.json_value["Name"] = name;
-                    aResp->res.json_value["Id"] =
-                        aResp->res.json_value["SerialNumber"];
+                    aResp->res.jsonValue["Name"] = name;
+                    aResp->res.jsonValue["Id"] =
+                        aResp->res.jsonValue["SerialNumber"];
                   },
                   connectionName, path, "org.freedesktop.DBus.Properties",
                   "GetAll", "xyz.openbmc_project.Inventory.Decorator.Asset");
@@ -176,22 +176,22 @@
               for (auto const &s : connectionNames) {
                 for (auto const &i : s.second) {
                   if (boost::ends_with(i, "Dimm")) {
-                    CROW_LOG_DEBUG << "Found Dimm, now get it properties.";
-                    crow::connections::system_bus->async_method_call(
+                    BMCWEB_LOG_DEBUG << "Found Dimm, now get it properties.";
+                    crow::connections::systemBus->async_method_call(
                         [&, aResp](const boost::system::error_code ec,
                                    const std::vector<std::pair<
                                        std::string, VariantType>> &properties) {
                           if (ec) {
-                            CROW_LOG_ERROR << "DBUS response error " << ec;
+                            BMCWEB_LOG_ERROR << "DBUS response error " << ec;
                             aResp->setErrorStatus();
                             return;
                           }
-                          CROW_LOG_DEBUG << "Got " << properties.size()
+                          BMCWEB_LOG_DEBUG << "Got " << properties.size()
                                          << "Dimm properties.";
                           for (const auto &p : properties) {
                             if (p.first == "MemorySize") {
                               const std::string *value =
-                                  mapbox::get_ptr<const std::string>(p.second);
+                                  mapbox::getPtr<const std::string>(p.second);
                               if ((value != nullptr) && (*value != "NULL")) {
                                 // Remove units char
                                 int32_t unitCoeff;
@@ -200,16 +200,16 @@
                                 } else if (boost::ends_with(*value, "KB")) {
                                   unitCoeff = 1000000;
                                 } else {
-                                  CROW_LOG_ERROR << "Unsupported memory units";
+                                  BMCWEB_LOG_ERROR << "Unsupported memory units";
                                   aResp->setErrorStatus();
                                   return;
                                 }
 
                                 auto memSize = boost::lexical_cast<int>(
                                     value->substr(0, value->length() - 2));
-                                aResp->res.json_value["TotalSystemMemoryGiB"] +=
+                                aResp->res.jsonValue["TotalSystemMemoryGiB"] +=
                                     memSize * unitCoeff;
-                                aResp->res.json_value["MemorySummary"]["Status"]
+                                aResp->res.jsonValue["MemorySummary"]["Status"]
                                                      ["State"] = "Enabled";
                               }
                             }
@@ -218,34 +218,34 @@
                         s.first, path, "org.freedesktop.DBus.Properties",
                         "GetAll", "xyz.openbmc_project.Inventory.Item.Dimm");
                   } else if (boost::ends_with(i, "Cpu")) {
-                    CROW_LOG_DEBUG << "Found Cpu, now get it properties.";
-                    crow::connections::system_bus->async_method_call(
+                    BMCWEB_LOG_DEBUG << "Found Cpu, now get it properties.";
+                    crow::connections::systemBus->async_method_call(
                         [&, aResp](const boost::system::error_code ec,
                                    const std::vector<std::pair<
                                        std::string, VariantType>> &properties) {
                           if (ec) {
-                            CROW_LOG_ERROR << "DBUS response error " << ec;
+                            BMCWEB_LOG_ERROR << "DBUS response error " << ec;
                             aResp->setErrorStatus();
                             return;
                           }
-                          CROW_LOG_DEBUG << "Got " << properties.size()
+                          BMCWEB_LOG_DEBUG << "Got " << properties.size()
                                          << "Cpu properties.";
                           for (const auto &p : properties) {
                             if (p.first == "ProcessorFamily") {
                               const std::string *value =
-                                  mapbox::get_ptr<const std::string>(p.second);
+                                  mapbox::getPtr<const std::string>(p.second);
                               if (value != nullptr) {
                                 aResp->res
-                                    .json_value["ProcessorSummary"]["Count"] =
+                                    .jsonValue["ProcessorSummary"]["Count"] =
                                     aResp->res
-                                        .json_value["ProcessorSummary"]["Count"]
+                                        .jsonValue["ProcessorSummary"]["Count"]
                                         .get<int>() +
                                     1;
-                                aResp->res.json_value["ProcessorSummary"]
+                                aResp->res.jsonValue["ProcessorSummary"]
                                                      ["Status"]["State"] =
                                     "Enabled";
                                 aResp->res
-                                    .json_value["ProcessorSummary"]["Model"] =
+                                    .jsonValue["ProcessorSummary"]["Model"] =
                                     *value;
                               }
                             }
@@ -254,31 +254,31 @@
                         s.first, path, "org.freedesktop.DBus.Properties",
                         "GetAll", "xyz.openbmc_project.Inventory.Item.Cpu");
                   } else if (boost::ends_with(i, "UUID")) {
-                    CROW_LOG_DEBUG << "Found UUID, now get it properties.";
-                    crow::connections::system_bus->async_method_call(
+                    BMCWEB_LOG_DEBUG << "Found UUID, now get it properties.";
+                    crow::connections::systemBus->async_method_call(
                         [aResp](const boost::system::error_code ec,
                                 const std::vector<std::pair<
                                     std::string, VariantType>> &properties) {
                           if (ec) {
-                            CROW_LOG_DEBUG << "DBUS response error " << ec;
+                            BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
                             aResp->setErrorStatus();
                             return;
                           }
-                          CROW_LOG_DEBUG << "Got " << properties.size()
+                          BMCWEB_LOG_DEBUG << "Got " << properties.size()
                                          << "UUID properties.";
                           for (const std::pair<std::string, VariantType> &p :
                                properties) {
                             if (p.first == "BIOSVer") {
                               const std::string *value =
-                                  mapbox::get_ptr<const std::string>(p.second);
+                                  mapbox::getPtr<const std::string>(p.second);
                               if (value != nullptr) {
-                                aResp->res.json_value["BiosVersion"] = *value;
+                                aResp->res.jsonValue["BiosVersion"] = *value;
                               }
                             }
                             if (p.first == "UUID") {
                               const std::string *value =
-                                  mapbox::get_ptr<const std::string>(p.second);
-                              CROW_LOG_DEBUG << "UUID = " << *value
+                                  mapbox::getPtr<const std::string>(p.second);
+                              BMCWEB_LOG_DEBUG << "UUID = " << *value
                                              << " length " << value->length();
                               if (value != nullptr) {
                                 // Workaround for to short return str in smbios
@@ -290,7 +290,7 @@
                                                         '0');
                                   value = &correctedValue;
                                 } else if (value->length() == 32) {
-                                  aResp->res.json_value["UUID"] =
+                                  aResp->res.jsonValue["UUID"] =
                                       value->substr(0, 8) + "-" +
                                       value->substr(8, 4) + "-" +
                                       value->substr(12, 4) + "-" +
@@ -329,17 +329,17 @@
   template <typename CallbackFunc>
   void getLedGroupIdentify(std::shared_ptr<SystemAsyncResp> aResp,
                            CallbackFunc &&callback) {
-    CROW_LOG_DEBUG << "Get led groups";
-    crow::connections::system_bus->async_method_call(
+    BMCWEB_LOG_DEBUG << "Get led groups";
+    crow::connections::systemBus->async_method_call(
         [
           aResp{std::move(aResp)}, &callback
         ](const boost::system::error_code &ec, const ManagedObjectsType &resp) {
           if (ec) {
-            CROW_LOG_DEBUG << "DBUS response error " << ec;
+            BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
             aResp->setErrorStatus();
             return;
           }
-          CROW_LOG_DEBUG << "Got " << resp.size() << "led group objects.";
+          BMCWEB_LOG_DEBUG << "Got " << resp.size() << "led group objects.";
           for (const auto &objPath : resp) {
             const std::string &path = objPath.first;
             if (path.rfind("enclosure_identify") != std::string::npos) {
@@ -348,7 +348,7 @@
                   for (const auto &property : interface.second) {
                     if (property.first == "Asserted") {
                       const bool *asserted =
-                          mapbox::get_ptr<const bool>(property.second);
+                          mapbox::getPtr<const bool>(property.second);
                       if (nullptr != asserted) {
                         callback(*asserted, aResp);
                       } else {
@@ -369,24 +369,24 @@
   template <typename CallbackFunc>
   void getLedIdentify(std::shared_ptr<SystemAsyncResp> aResp,
                       CallbackFunc &&callback) {
-    CROW_LOG_DEBUG << "Get identify led properties";
-    crow::connections::system_bus->async_method_call(
+    BMCWEB_LOG_DEBUG << "Get identify led properties";
+    crow::connections::systemBus->async_method_call(
         [ aResp{std::move(aResp)}, &callback ](
             const boost::system::error_code ec,
             const PropertiesType &properties) {
           if (ec) {
-            CROW_LOG_DEBUG << "DBUS response error " << ec;
+            BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
             aResp->setErrorStatus();
             return;
           }
-          CROW_LOG_DEBUG << "Got " << properties.size() << "led properties.";
+          BMCWEB_LOG_DEBUG << "Got " << properties.size() << "led properties.";
           std::string output;
           for (const auto &property : properties) {
             if (property.first == "State") {
               const std::string *s =
-                  mapbox::get_ptr<std::string>(property.second);
+                  mapbox::getPtr<std::string>(property.second);
               if (nullptr != s) {
-                CROW_LOG_DEBUG << "Identify Led State: " << *s;
+                BMCWEB_LOG_DEBUG << "Identify Led State: " << *s;
                 const auto pos = s->rfind('.');
                 if (pos != std::string::npos) {
                   auto led = s->substr(pos + 1);
@@ -419,31 +419,31 @@
    * @return None.
    */
   void getHostState(std::shared_ptr<SystemAsyncResp> aResp) {
-    CROW_LOG_DEBUG << "Get host information.";
-    crow::connections::system_bus->async_method_call(
+    BMCWEB_LOG_DEBUG << "Get host information.";
+    crow::connections::systemBus->async_method_call(
         [aResp{std::move(aResp)}](const boost::system::error_code ec,
                                   const PropertiesType &properties) {
           if (ec) {
-            CROW_LOG_DEBUG << "DBUS response error " << ec;
+            BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
             aResp->setErrorStatus();
             return;
           }
-          CROW_LOG_DEBUG << "Got " << properties.size() << "host properties.";
+          BMCWEB_LOG_DEBUG << "Got " << properties.size() << "host properties.";
           for (const auto &property : properties) {
             if (property.first == "CurrentHostState") {
               const std::string *s =
-                  mapbox::get_ptr<const std::string>(property.second);
-              CROW_LOG_DEBUG << "Host state: " << *s;
+                  mapbox::getPtr<const std::string>(property.second);
+              BMCWEB_LOG_DEBUG << "Host state: " << *s;
               if (nullptr != s) {
                 const auto pos = s->rfind('.');
                 if (pos != std::string::npos) {
                   // Verify Host State
                   if (s->substr(pos + 1) == "Running") {
-                    aResp->res.json_value["PowerState"] = "On";
-                    aResp->res.json_value["Status"]["State"] = "Enabled";
+                    aResp->res.jsonValue["PowerState"] = "On";
+                    aResp->res.jsonValue["Status"]["State"] = "Enabled";
                   } else {
-                    aResp->res.json_value["PowerState"] = "Off";
-                    aResp->res.json_value["Status"]["State"] = "Disabled";
+                    aResp->res.jsonValue["PowerState"] = "Off";
+                    aResp->res.jsonValue["Status"]["State"] = "Disabled";
                   }
                 }
               }
@@ -484,7 +484,7 @@
   /**
    * Functions triggers appropriate requests on DBus
    */
-  void doGet(crow::response &res, const crow::request &req,
+  void doGet(crow::Response &res, const crow::Request &req,
              const std::vector<std::string> &params) override {
     // Get board list, and call the below callback for JSON preparation
     provider.getBaseboardList(
@@ -499,7 +499,7 @@
             // Then attach members, count size and return,
             Node::json["Members"] = boardArray;
             Node::json["Members@odata.count"] = boardArray.size();
-            res.json_value = Node::json;
+            res.jsonValue = Node::json;
           } else {
             // ... otherwise, return INTERNALL ERROR
             res.result(boost::beast::http::status::internal_server_error);
@@ -555,7 +555,7 @@
   /**
    * Functions triggers appropriate requests on DBus
    */
-  void doGet(crow::response &res, const crow::request &req,
+  void doGet(crow::Response &res, const crow::Request &req,
              const std::vector<std::string> &params) override {
     // Check if there is required param, truly entering this shall be
     // impossible
@@ -567,8 +567,8 @@
 
     const std::string &name = params[0];
 
-    res.json_value = Node::json;
-    res.json_value["@odata.id"] = "/redfish/v1/Systems/" + name;
+    res.jsonValue = Node::json;
+    res.jsonValue["@odata.id"] = "/redfish/v1/Systems/" + name;
 
     auto asyncResp = std::make_shared<SystemAsyncResp>(res);
 
@@ -582,18 +582,18 @@
                 aResp, [](const std::string &ledStatus,
                           const std::shared_ptr<SystemAsyncResp> &aResp) {
                   if (!ledStatus.empty()) {
-                    aResp->res.json_value["IndicatorLED"] = ledStatus;
+                    aResp->res.jsonValue["IndicatorLED"] = ledStatus;
                   }
                 });
           } else {
-            aResp->res.json_value["IndicatorLED"] = "Off";
+            aResp->res.jsonValue["IndicatorLED"] = "Off";
           }
         });
     provider.getComputerSystem(asyncResp, name);
     provider.getHostState(asyncResp);
   }
 
-  void doPatch(crow::response &res, const crow::request &req,
+  void doPatch(crow::Response &res, const crow::Request &req,
                const std::vector<std::string> &params) override {
     // Check if there is required param, truly entering this shall be
     // impossible
@@ -614,7 +614,7 @@
         "IndicatorLED", patch, reqLedState,
         static_cast<int>(json_util::MessageSetting::TYPE_ERROR) |
             static_cast<int>(json_util::MessageSetting::MISSING),
-        res.json_value, std::string("/" + name + "/IndicatorLED"));
+        res.jsonValue, std::string("/" + name + "/IndicatorLED"));
     if ((r != json_util::Result::SUCCESS) || (reqLedState == nullptr)) {
       res.result(boost::beast::http::status::bad_request);
       res.end();
@@ -631,28 +631,28 @@
 
     // Update led status
     auto asyncResp = std::make_shared<SystemAsyncResp>(res);
-    res.json_value = Node::json;
-    res.json_value["@odata.id"] = "/redfish/v1/Systems/" + name;
+    res.jsonValue = Node::json;
+    res.jsonValue["@odata.id"] = "/redfish/v1/Systems/" + name;
 
     provider.getHostState(asyncResp);
     provider.getComputerSystem(asyncResp, name);
 
     if (dbusLedState.empty()) {
       messages::addMessageToJsonRoot(
-          res.json_value,
+          res.jsonValue,
           messages::propertyValueNotInList(*reqLedState, "IndicatorLED"));
     } else {
       // Update led group
-      CROW_LOG_DEBUG << "Update led group.";
-      crow::connections::system_bus->async_method_call(
+      BMCWEB_LOG_DEBUG << "Update led group.";
+      crow::connections::systemBus->async_method_call(
           [&, asyncResp{std::move(asyncResp)} ](
               const boost::system::error_code ec) {
             if (ec) {
-              CROW_LOG_DEBUG << "DBUS response error " << ec;
+              BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
               asyncResp->setErrorStatus();
               return;
             }
-            CROW_LOG_DEBUG << "Led group update done.";
+            BMCWEB_LOG_DEBUG << "Led group update done.";
           },
           "xyz.openbmc_project.LED.GroupManager",
           "/xyz/openbmc_project/led/groups/enclosure_identify",
@@ -661,17 +661,17 @@
           sdbusplus::message::variant<bool>(
               (dbusLedState == "Off" ? false : true)));
       // Update identify led status
-      CROW_LOG_DEBUG << "Update led SoftwareInventoryCollection.";
-      crow::connections::system_bus->async_method_call(
+      BMCWEB_LOG_DEBUG << "Update led SoftwareInventoryCollection.";
+      crow::connections::systemBus->async_method_call(
           [&, asyncResp{std::move(asyncResp)} ](
               const boost::system::error_code ec) {
             if (ec) {
-              CROW_LOG_DEBUG << "DBUS response error " << ec;
+              BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
               asyncResp->setErrorStatus();
               return;
             }
-            CROW_LOG_DEBUG << "Led state update done.";
-            res.json_value["IndicatorLED"] = *reqLedState;
+            BMCWEB_LOG_DEBUG << "Led state update done.";
+            res.jsonValue["IndicatorLED"] = *reqLedState;
           },
           "xyz.openbmc_project.LED.Controller.identify",
           "/xyz/openbmc_project/led/physical/identify",