bmcweb: /s/boost::beast::string_view/std::string_view/g
Follow-on to https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/18891
Tested: Checked that the host console and virtual media endpoints
still worked as expected.
Change-Id: Ifdc5f21f3668bdf9bd24189504aaeb17b232c921
Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
diff --git a/crow/include/crow/websocket.h b/crow/include/crow/websocket.h
index 239e16b..f461477 100644
--- a/crow/include/crow/websocket.h
+++ b/crow/include/crow/websocket.h
@@ -21,11 +21,11 @@
explicit Connection(const crow::Request& req) :
req(req), userdataPtr(nullptr){};
- virtual void sendBinary(const boost::beast::string_view msg) = 0;
+ virtual void sendBinary(const std::string_view msg) = 0;
virtual void sendBinary(std::string&& msg) = 0;
- virtual void sendText(const boost::beast::string_view msg) = 0;
+ virtual void sendText(const std::string_view msg) = 0;
virtual void sendText(std::string&& msg) = 0;
- virtual void close(const boost::beast::string_view msg = "quit") = 0;
+ virtual void close(const std::string_view msg = "quit") = 0;
virtual boost::asio::io_context& get_io_context() = 0;
virtual ~Connection() = default;
@@ -97,7 +97,7 @@
});
}
- void sendBinary(const boost::beast::string_view msg) override
+ void sendBinary(const std::string_view msg) override
{
ws.binary(true);
outBuffer.emplace_back(msg);
@@ -111,7 +111,7 @@
doWrite();
}
- void sendText(const boost::beast::string_view msg) override
+ void sendText(const std::string_view msg) override
{
ws.text(true);
outBuffer.emplace_back(msg);
@@ -125,7 +125,7 @@
doWrite();
}
- void close(const boost::beast::string_view msg) override
+ void close(const std::string_view msg) override
{
ws.async_close(
boost::beast::websocket::close_code::normal,
@@ -155,30 +155,30 @@
void doRead()
{
- ws.async_read(
- inBuffer, [this, self(shared_from_this())](
+ ws.async_read(inBuffer,
+ [this, self(shared_from_this())](
boost::beast::error_code ec, std::size_t bytes_read) {
- if (ec)
- {
- if (ec != boost::beast::websocket::error::closed)
- {
- BMCWEB_LOG_ERROR << "doRead error " << ec;
- }
- if (closeHandler)
- {
- boost::beast::string_view reason = ws.reason().reason;
- closeHandler(*this, std::string(reason));
- }
- return;
- }
- if (messageHandler)
- {
- messageHandler(*this, inString, ws.got_text());
- }
- inBuffer.consume(bytes_read);
- inString.clear();
- doRead();
- });
+ if (ec)
+ {
+ if (ec != boost::beast::websocket::error::closed)
+ {
+ BMCWEB_LOG_ERROR << "doRead error " << ec;
+ }
+ if (closeHandler)
+ {
+ std::string_view reason = ws.reason().reason;
+ closeHandler(*this, std::string(reason));
+ }
+ return;
+ }
+ if (messageHandler)
+ {
+ messageHandler(*this, inString, ws.got_text());
+ }
+ inBuffer.consume(bytes_read);
+ inString.clear();
+ doRead();
+ });
}
void doWrite()
diff --git a/include/kvm_websocket.hpp b/include/kvm_websocket.hpp
index d0c5539..ae4d899 100644
--- a/include/kvm_websocket.hpp
+++ b/include/kvm_websocket.hpp
@@ -87,7 +87,7 @@
}
outputBuffer.commit(bytesRead);
- boost::beast::string_view payload(
+ std::string_view payload(
static_cast<const char*>(outputBuffer.data().data()), bytesRead);
BMCWEB_LOG_DEBUG << "Sending payload size " << payload.size();
session->sendBinary(payload);
diff --git a/include/obmc_console.hpp b/include/obmc_console.hpp
index 5797613..ca723d3 100644
--- a/include/obmc_console.hpp
+++ b/include/obmc_console.hpp
@@ -76,7 +76,7 @@
}
return;
}
- boost::beast::string_view payload(outputBuffer.data(), bytesRead);
+ std::string_view payload(outputBuffer.data(), bytesRead);
for (auto session : sessions)
{
session->sendBinary(payload);
diff --git a/redfish-core/lib/account_service.hpp b/redfish-core/lib/account_service.hpp
index 70eed78..6d38c06 100644
--- a/redfish-core/lib/account_service.hpp
+++ b/redfish-core/lib/account_service.hpp
@@ -31,7 +31,7 @@
std::string, boost::container::flat_map<
std::string, std::variant<bool, std::string>>>>>;
-inline std::string getPrivilegeFromRoleId(boost::beast::string_view role)
+inline std::string getPrivilegeFromRoleId(std::string_view role)
{
if (role == "priv-admin")
{
@@ -51,7 +51,7 @@
}
return "";
}
-inline std::string getRoleIdFromPrivilege(boost::beast::string_view role)
+inline std::string getRoleIdFromPrivilege(std::string_view role)
{
if (role == "Administrator")
{