7#if !defined(ASYNC_MQTT_UTIL_JSON_LIKE_OUT_HPP)
8#define ASYNC_MQTT_UTIL_JSON_LIKE_OUT_HPP
13#include <async_mqtt/buffer.hpp>
17struct json_like_out_t {
18 json_like_out_t(buffer
const& buf): buf{buf} {}
23inline std::ostream& operator<<(std::ostream& o, json_like_out_t
const& v) {
24 for (
char c : v.buf) {
51 unsigned int code =
static_cast<unsigned int>(c);
52 if (code < 0x20 || code >= 0x7f) {
53 std::ios::fmtflags flags(o.flags());
54 o <<
"\\u" << std::hex << std::setw(4) << std::setfill(
'0') << (code & 0xff);
66inline json_like_out_t json_like_out(buffer
const& buf) {
67 return json_like_out_t{buf};