async_mqtt 9.0.1
Loading...
Searching...
No Matches
packet_helper.hpp
1// Copyright Takatoshi Kondo 2023
2//
3// Distributed under the Boost Software License, Version 1.0.
4// (See accompanying file LICENSE_1_0.txt or copy at
5// http://www.boost.org/LICENSE_1_0.txt)
6
7#if !defined(ASYNC_MQTT_PACKET_PACKET_HELPER_HPP)
8#define ASYNC_MQTT_PACKET_PACKET_HELPER_HPP
9
10#include <iosfwd>
11#include <async_mqtt/packet/packet_traits.hpp>
12#include <async_mqtt/packet/packet_fwd.hpp>
13#include <async_mqtt/packet/packet_variant_fwd.hpp>
14
15namespace async_mqtt {
16
17template <typename Packet>
18struct hex_dump_t {
19 hex_dump_t(Packet const& p):p{p} {}
20
21 Packet const& p;
22};
23
24template <typename Packet>
25std::ostream& operator<< (std::ostream& o, hex_dump_t<Packet> const& v);
26
39template <typename Packet>
40hex_dump_t<Packet> hex_dump(Packet const& p) {
41 return hex_dump_t<Packet>{p};
42}
43
44} // namespace async_mqtt
45
46#include <async_mqtt/packet/impl/packet_helper.hpp>
47
48#endif // ASYNC_MQTT_PACKET_PACKET_HELPER_HPP
std::ostream & operator<<(std::ostream &o, mqtt_error v)
output to the stream
hex_dump_t< Packet > hex_dump(Packet const &p)
hexdump the packet. Usage. std::cout << hex_dump(p) << std::endl;
Definition packet_helper.hpp:40