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/include/node.hpp b/redfish-core/include/node.hpp
index 113514a..ebd8989 100644
--- a/redfish-core/include/node.hpp
+++ b/redfish-core/include/node.hpp
@@ -28,11 +28,11 @@
*/
class AsyncResp {
public:
- AsyncResp(crow::response& response) : res(response) {}
+ AsyncResp(crow::Response& response) : res(response) {}
~AsyncResp() { res.end(); }
- crow::response& res;
+ crow::Response& res;
};
/**
@@ -43,10 +43,10 @@
public:
template <typename... Params>
Node(CrowApp& app, std::string&& entityUrl, Params... params) {
- app.route_dynamic(entityUrl.c_str())
+ app.routeDynamic(entityUrl.c_str())
.methods("GET"_method, "PATCH"_method, "POST"_method,
- "DELETE"_method)([&](const crow::request& req,
- crow::response& res, Params... params) {
+ "DELETE"_method)([&](const crow::Request& req,
+ crow::Response& res, Params... params) {
std::vector<std::string> paramVec = {params...};
dispatchRequest(app, req, res, paramVec);
});
@@ -74,14 +74,14 @@
void getSubRoutes(const std::vector<std::unique_ptr<Node>>& allNodes) {
const std::string* url = getUrl();
if (url == nullptr) {
- //CROW_LOG_CRITICAL << "Unable to get url for route";
+ //BMCWEB_LOG_CRITICAL << "Unable to get url for route";
return;
}
for (const auto& node : allNodes) {
const std::string* route = node->getUrl();
if (route == nullptr) {
- //CROW_LOG_CRITICAL << "Unable to get url for route";
+ //BMCWEB_LOG_CRITICAL << "Unable to get url for route";
continue;
}
if (boost::starts_with(*route, *url)) {
@@ -110,25 +110,25 @@
protected:
// Node is designed to be an abstract class, so doGet is pure virtual
- virtual void doGet(crow::response& res, const crow::request& req,
+ virtual void doGet(crow::Response& res, const crow::Request& req,
const std::vector<std::string>& params) {
res.result(boost::beast::http::status::method_not_allowed);
res.end();
- };
+ }
- virtual void doPatch(crow::response& res, const crow::request& req,
+ virtual void doPatch(crow::Response& res, const crow::Request& req,
const std::vector<std::string>& params) {
res.result(boost::beast::http::status::method_not_allowed);
res.end();
}
- virtual void doPost(crow::response& res, const crow::request& req,
+ virtual void doPost(crow::Response& res, const crow::Request& req,
const std::vector<std::string>& params) {
res.result(boost::beast::http::status::method_not_allowed);
res.end();
}
- virtual void doDelete(crow::response& res, const crow::request& req,
+ virtual void doDelete(crow::Response& res, const crow::Request& req,
const std::vector<std::string>& params) {
res.result(boost::beast::http::status::method_not_allowed);
res.end();
@@ -137,11 +137,11 @@
nlohmann::json json;
private:
- void dispatchRequest(CrowApp& app, const crow::request& req,
- crow::response& res,
+ void dispatchRequest(CrowApp& app, const crow::Request& req,
+ crow::Response& res,
const std::vector<std::string>& params) {
auto ctx =
- app.template get_context<crow::TokenAuthorization::Middleware>(req);
+ app.template getContext<crow::token_authorization::Middleware>(req);
if (!isMethodAllowedForUser(req.method(), entityPrivileges,
ctx.session->username)) {