diff --git a/include/nlohmann/detail/output/binary_writer.hpp b/include/nlohmann/detail/output/binary_writer.hpp index 8fe3ba98d..75a9b6f1e 100644 --- a/include/nlohmann/detail/output/binary_writer.hpp +++ b/include/nlohmann/detail/output/binary_writer.hpp @@ -2894,6 +2894,15 @@ class binary_writer } } + write_cbor_checked_string(value, context); + } + + /// @brief write a CBOR text string checked or sanitized by the error handler; + /// out of line, as the string_t for the sanitized copy would make + /// every call of @ref write_cbor_string set up a frame for it + JSON_HEDLEY_NEVER_INLINE + void write_cbor_checked_string(const string_t& value, const BasicJsonType& context) + { string_t storage; const string_t& sanitized = sanitize_utf8_for_write(value, context, storage); @@ -2946,6 +2955,14 @@ class binary_writer } } + write_msgpack_checked_string(value, context); + } + + /// @brief write a MessagePack str checked or sanitized by the error handler; + /// out of line, like @ref write_cbor_checked_string + JSON_HEDLEY_NEVER_INLINE + void write_msgpack_checked_string(const string_t& value, const BasicJsonType& context) + { string_t storage; const string_t& sanitized = sanitize_utf8_for_write(value, context, storage); @@ -3167,6 +3184,14 @@ class binary_writer return; } + write_ubjson_checked_text(value, context, add_marker, use_bjdata); + } + + /// @brief write a UBJSON/BJData string checked or sanitized by the error + /// handler; out of line, like @ref write_cbor_checked_string + JSON_HEDLEY_NEVER_INLINE + void write_ubjson_checked_text(const string_t& value, const BasicJsonType& context, const bool add_marker, const bool use_bjdata) + { string_t storage; const string_t& sanitized = sanitize_utf8_for_write(value, context, storage); if (add_marker) diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index bcf704525..bacedf9d5 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -27722,6 +27722,15 @@ class binary_writer } } + write_cbor_checked_string(value, context); + } + + /// @brief write a CBOR text string checked or sanitized by the error handler; + /// out of line, as the string_t for the sanitized copy would make + /// every call of @ref write_cbor_string set up a frame for it + JSON_HEDLEY_NEVER_INLINE + void write_cbor_checked_string(const string_t& value, const BasicJsonType& context) + { string_t storage; const string_t& sanitized = sanitize_utf8_for_write(value, context, storage); @@ -27774,6 +27783,14 @@ class binary_writer } } + write_msgpack_checked_string(value, context); + } + + /// @brief write a MessagePack str checked or sanitized by the error handler; + /// out of line, like @ref write_cbor_checked_string + JSON_HEDLEY_NEVER_INLINE + void write_msgpack_checked_string(const string_t& value, const BasicJsonType& context) + { string_t storage; const string_t& sanitized = sanitize_utf8_for_write(value, context, storage); @@ -27995,6 +28012,14 @@ class binary_writer return; } + write_ubjson_checked_text(value, context, add_marker, use_bjdata); + } + + /// @brief write a UBJSON/BJData string checked or sanitized by the error + /// handler; out of line, like @ref write_cbor_checked_string + JSON_HEDLEY_NEVER_INLINE + void write_ubjson_checked_text(const string_t& value, const BasicJsonType& context, const bool add_marker, const bool use_bjdata) + { string_t storage; const string_t& sanitized = sanitize_utf8_for_write(value, context, storage); if (add_marker)