summaryrefslogtreecommitdiff
path: root/http/logging.hpp
diff options
context:
space:
mode:
authorEd Tanous <ed@tanous.net>2024-04-07 02:03:49 +0300
committerEd Tanous <ed@tanous.net>2024-04-11 19:38:16 +0300
commit4a7fbefdff330f06d5698a1e60ce893225cd389e (patch)
tree036f2c7795de1d48d06834d6b0ccbe1d0d5c9e79 /http/logging.hpp
parentd9e89dfd49538c54d280dce3750f4af264cfd5fc (diff)
downloadbmcweb-4a7fbefdff330f06d5698a1e60ce893225cd389e.tar.xz
Fix large copies with url_view and segments_view
Despite these objects being called "view" they are still relatively large, as clang-tidy correctly flags, and we ignore. Change all function uses to capture by: const boost::urls::url_view_base& Which is the base class of all boost URL types, and any class (url, url_view, etc) is convertible to that base. Change-Id: I8ee2ea3f4cfba38331303a7e4eb520a2b6f8ba92 Signed-off-by: Ed Tanous <ed@tanous.net>
Diffstat (limited to 'http/logging.hpp')
-rw-r--r--http/logging.hpp21
1 files changed, 4 insertions, 17 deletions
diff --git a/http/logging.hpp b/http/logging.hpp
index 2f88c90b14..de14d99e8f 100644
--- a/http/logging.hpp
+++ b/http/logging.hpp
@@ -5,7 +5,7 @@
#include <boost/system/error_code.hpp>
#include <boost/url/pct_string_view.hpp>
#include <boost/url/string_view.hpp>
-#include <boost/url/url.hpp>
+#include <boost/url/url_view_base.hpp>
#include <nlohmann/json.hpp>
#include <bit>
@@ -46,27 +46,14 @@ struct std::formatter<boost::urls::pct_string_view>
}
};
-template <>
-struct std::formatter<boost::urls::url_view>
-{
- constexpr auto parse(std::format_parse_context& ctx)
- {
- return ctx.begin();
- }
- auto format(const boost::urls::url& msg, auto& ctx) const
- {
- return std::format_to(ctx.out(), "{}", std::string_view(msg.buffer()));
- }
-};
-
-template <>
-struct std::formatter<boost::urls::url>
+template <std::derived_from<boost::urls::url_view_base> URL>
+struct std::formatter<URL>
{
constexpr auto parse(std::format_parse_context& ctx)
{
return ctx.begin();
}
- auto format(const boost::urls::url& msg, auto& ctx) const
+ auto format(const URL& msg, auto& ctx) const
{
return std::format_to(ctx.out(), "{}", std::string_view(msg.buffer()));
}