7#if !defined(ASYNC_MQTT_UTIL_HEX_DUMP_HPP)
8#define ASYNC_MQTT_UTIL_HEX_DUMP_HPP
13#include <async_mqtt/packet/packet_iterator.hpp>
17template <
typename Packet>
19 hex_dump_t(Packet
const& p):p{p} {}
24template <
typename Packet>
25inline std::ostream& operator<< (std::ostream& o, hex_dump_t<Packet>
const& v) {
26 auto cbs = v.p.const_buffer_sequence();
27 auto [it, end] = make_packet_range(cbs);
28 std::ios::fmtflags f(o.flags());
30 for (; it != end; ++it) {
31 o <<
"0x" << std::setw(2) << std::setfill(
'0') << (
static_cast<int>(*it) & 0xff) <<
' ';
44template <
typename Packet>
45hex_dump_t<Packet> hex_dump(Packet
const& p) {
46 return hex_dump_t<Packet>{p};