From c84f72059d0613aa38d04f67684cffdbf510102e Mon Sep 17 00:00:00 2001 From: Stephen Berry Date: Sun, 27 Sep 2026 14:17:32 -0500 Subject: [PATCH] Rename minify/prettify emit lambda to avoid Qt macro collision --- include/glaze/json/minify.hpp | 26 +++++++++++++------------- include/glaze/json/prettify.hpp | 30 +++++++++++++++--------------- 2 files changed, 28 insertions(+), 28 deletions(-) diff --git a/include/glaze/json/minify.hpp b/include/glaze/json/minify.hpp index 44996ba6db..634085afaf 100644 --- a/include/glaze/json/minify.hpp +++ b/include/glaze/json/minify.hpp @@ -28,7 +28,7 @@ namespace glz // asks for exactly what it stores instead; see emit_bytes for where that count comes from. // None of it survives for a resizable destination, which keeps the unchecked dumps and // nothing more. - const auto emit = [&](const auto& x) { return emit_bytes(ctx, b, ix, x); }; + const auto put = [&](const auto& x) { return emit_bytes(ctx, b, ix, x); }; auto ws_start = it; uint64_t ws_size{}; @@ -83,14 +83,14 @@ namespace glz return; } // non-empty: the scanner reports an empty view as an error - if (not emit(value)) [[unlikely]] { + if (not put(value)) [[unlikely]] { return; } skip_whitespace(); break; } case Comma: { - if (not emit(',')) [[unlikely]] { + if (not put(',')) [[unlikely]] { return; } ++it; @@ -100,14 +100,14 @@ namespace glz case Number: { const auto value = read_json_number(it, end); // non-empty: a Number match is one valid character - if (not emit(value)) [[unlikely]] { + if (not put(value)) [[unlikely]] { return; } skip_whitespace(); break; } case Colon: { - if (not emit(':')) [[unlikely]] { + if (not put(':')) [[unlikely]] { return; } ++it; @@ -115,7 +115,7 @@ namespace glz break; } case Array_Start: { - if (not emit('[')) [[unlikely]] { + if (not put('[')) [[unlikely]] { return; } ++it; @@ -123,7 +123,7 @@ namespace glz break; } case Array_End: { - if (not emit(']')) [[unlikely]] { + if (not put(']')) [[unlikely]] { return; } ++it; @@ -138,7 +138,7 @@ namespace glz if (not match_literal<"null">(ctx, it, end)) [[unlikely]] { return; } - if (not emit("null")) [[unlikely]] { + if (not put("null")) [[unlikely]] { return; } skip_whitespace(); @@ -149,7 +149,7 @@ namespace glz if (not match_literal<"true">(ctx, it, end)) [[unlikely]] { return; } - if (not emit("true")) [[unlikely]] { + if (not put("true")) [[unlikely]] { return; } skip_whitespace(); @@ -159,7 +159,7 @@ namespace glz if (not match_literal<"false">(ctx, it, end)) [[unlikely]] { return; } - if (not emit("false")) [[unlikely]] { + if (not put("false")) [[unlikely]] { return; } skip_whitespace(); @@ -167,7 +167,7 @@ namespace glz } } case Object_Start: { - if (not emit('{')) [[unlikely]] { + if (not put('{')) [[unlikely]] { return; } ++it; @@ -175,7 +175,7 @@ namespace glz break; } case Object_End: { - if (not emit('}')) [[unlikely]] { + if (not put('}')) [[unlikely]] { return; } ++it; @@ -193,7 +193,7 @@ namespace glz // comments out the whole rest of the output. if (not comment.line) { // non-empty: an empty view comes with an error - if (not emit(comment.text)) [[unlikely]] { + if (not put(comment.text)) [[unlikely]] { return; } } diff --git a/include/glaze/json/prettify.hpp b/include/glaze/json/prettify.hpp index 2232c9a6d0..a86585ca2f 100644 --- a/include/glaze/json/prettify.hpp +++ b/include/glaze/json/prettify.hpp @@ -70,7 +70,7 @@ namespace glz // A break that fails is reported rather than swallowed: on a bounded destination that ran // out, carrying on would leave `line_comment_open` set and put this write *inside* the // comment, which is not a truncated document but a wrong one. - const auto emit = [&](const auto& x) { + const auto put = [&](const auto& x) { if constexpr (Opts.comments) { if (line_comment_open) [[unlikely]] { if (not new_line()) [[unlikely]] { @@ -89,13 +89,13 @@ namespace glz return; } // non-empty: the scanner reports an empty view as an error - if (not emit(value)) [[unlikely]] { + if (not put(value)) [[unlikely]] { return; } break; } case Comma: { - if (not emit(',')) [[unlikely]] { + if (not put(',')) [[unlikely]] { return; } ++it; @@ -110,7 +110,7 @@ namespace glz return; } } - else if (not emit(use_tabs ? '\t' : ' ')) [[unlikely]] { + else if (not put(use_tabs ? '\t' : ' ')) [[unlikely]] { return; } } @@ -119,21 +119,21 @@ namespace glz case Number: { const auto value = read_json_number(it, end); // non-empty: a Number match is one valid character - if (not emit(value)) [[unlikely]] { + if (not put(value)) [[unlikely]] { return; } break; } case Colon: { static constexpr sv colon = use_tabs ? sv{":\t"} : sv{": "}; - if (not emit(colon)) [[unlikely]] { + if (not put(colon)) [[unlikely]] { return; } ++it; break; } case Array_Start: { - if (not emit('[')) [[unlikely]] { + if (not put('[')) [[unlikely]] { return; } ++it; @@ -165,7 +165,7 @@ namespace glz return; } // This break is the one the bracket wanted anyway, and it closes an open line - // comment on its way, leaving the emit below nothing to close. + // comment on its way, leaving the put below nothing to close. if constexpr (check_new_lines_in_arrays(Opts)) { if (it[-1] != '[') { if (not new_line()) [[unlikely]] { @@ -173,7 +173,7 @@ namespace glz } } } - if (not emit(']')) [[unlikely]] { + if (not put(']')) [[unlikely]] { return; } ++it; @@ -185,7 +185,7 @@ namespace glz if (not match_literal<"null">(ctx, it, end)) [[unlikely]] { return; } - if (not emit("null")) [[unlikely]] { + if (not put("null")) [[unlikely]] { return; } break; @@ -195,7 +195,7 @@ namespace glz if (not match_literal<"true">(ctx, it, end)) [[unlikely]] { return; } - if (not emit("true")) [[unlikely]] { + if (not put("true")) [[unlikely]] { return; } break; @@ -204,14 +204,14 @@ namespace glz if (not match_literal<"false">(ctx, it, end)) [[unlikely]] { return; } - if (not emit("false")) [[unlikely]] { + if (not put("false")) [[unlikely]] { return; } break; } } case Object_Start: { - if (not emit('{')) [[unlikely]] { + if (not put('{')) [[unlikely]] { return; } ++it; @@ -246,7 +246,7 @@ namespace glz return; } } - if (not emit('}')) [[unlikely]] { + if (not put('}')) [[unlikely]] { return; } ++it; @@ -259,7 +259,7 @@ namespace glz return; } // non-empty: an empty view comes with an error - if (not emit(comment.text)) [[unlikely]] { + if (not put(comment.text)) [[unlikely]] { return; } line_comment_open = comment.line;