diff --git a/include/nlohmann/detail/view/serializer.hpp b/include/nlohmann/detail/view/serializer.hpp index a47dee182..dbaca6171 100644 --- a/include/nlohmann/detail/view/serializer.hpp +++ b/include/nlohmann/detail/view/serializer.hpp @@ -439,6 +439,45 @@ class view_serializer } private: + /// dump_text() with ensure_ascii, out of line: the walk without it is + /// faster when it is not merged with this one into dump() + NLOHMANN_VIEW_NOINLINE void dump_ascii(const node* root) + { + if (m_style.pretty) + { + if (m_style.source_numbers) + { + dump_text(root); + } + else + { + dump_text(root); + } + } + else if (m_style.source_numbers) + { + dump_text(root); + } + else + { + dump_text(root); + } + } + + /// dump_text() with indentation, out of line: the compact walk is faster + /// when it is not merged with the indented ones into dump() + NLOHMANN_VIEW_NOINLINE void dump_pretty(const node* root) + { + if (m_style.source_numbers) + { + dump_text(root); + } + else + { + dump_text(root); + } + } + /// a string that is not a plain string of the source (decoded, or written /// by an edit), without ensure_ascii: runs without characters to escape /// are copied. If validate is set, the string must be valid UTF-8: the @@ -469,45 +508,6 @@ class view_serializer m_out.put('"'); } - /// dump_text() with indentation, out of line: the compact walk is faster - /// when it is not merged with the indented ones into dump() - NLOHMANN_VIEW_NOINLINE void dump_pretty(const node* root) - { - if (m_style.source_numbers) - { - dump_text(root); - } - else - { - dump_text(root); - } - } - - /// dump_text() with ensure_ascii, out of line: the walk without it is - /// faster when it is not merged with this one into dump() - NLOHMANN_VIEW_NOINLINE void dump_ascii(const node* root) - { - if (m_style.pretty) - { - if (m_style.source_numbers) - { - dump_text(root); - } - else - { - dump_text(root); - } - } - else if (m_style.source_numbers) - { - dump_text(root); - } - else - { - dump_text(root); - } - } - /// whether dump_text() copies a string or key from the source: one of /// the source, and with ensure_ascii one without bytes >= 0x7F (an overload /// each, so that the walk without ensure_ascii is compiled exactly as diff --git a/single_include/nlohmann/json_view.hpp b/single_include/nlohmann/json_view.hpp index 2ccc17cd6..7b058469d 100644 --- a/single_include/nlohmann/json_view.hpp +++ b/single_include/nlohmann/json_view.hpp @@ -6506,6 +6506,45 @@ class view_serializer } private: + /// dump_text() with ensure_ascii, out of line: the walk without it is + /// faster when it is not merged with this one into dump() + NLOHMANN_VIEW_NOINLINE void dump_ascii(const node* root) + { + if (m_style.pretty) + { + if (m_style.source_numbers) + { + dump_text(root); + } + else + { + dump_text(root); + } + } + else if (m_style.source_numbers) + { + dump_text(root); + } + else + { + dump_text(root); + } + } + + /// dump_text() with indentation, out of line: the compact walk is faster + /// when it is not merged with the indented ones into dump() + NLOHMANN_VIEW_NOINLINE void dump_pretty(const node* root) + { + if (m_style.source_numbers) + { + dump_text(root); + } + else + { + dump_text(root); + } + } + /// a string that is not a plain string of the source (decoded, or written /// by an edit), without ensure_ascii: runs without characters to escape /// are copied. If validate is set, the string must be valid UTF-8: the @@ -6536,45 +6575,6 @@ class view_serializer m_out.put('"'); } - /// dump_text() with indentation, out of line: the compact walk is faster - /// when it is not merged with the indented ones into dump() - NLOHMANN_VIEW_NOINLINE void dump_pretty(const node* root) - { - if (m_style.source_numbers) - { - dump_text(root); - } - else - { - dump_text(root); - } - } - - /// dump_text() with ensure_ascii, out of line: the walk without it is - /// faster when it is not merged with this one into dump() - NLOHMANN_VIEW_NOINLINE void dump_ascii(const node* root) - { - if (m_style.pretty) - { - if (m_style.source_numbers) - { - dump_text(root); - } - else - { - dump_text(root); - } - } - else if (m_style.source_numbers) - { - dump_text(root); - } - else - { - dump_text(root); - } - } - /// whether dump_text() copies a string or key from the source: one of /// the source, and with ensure_ascii one without bytes >= 0x7F (an overload /// each, so that the walk without ensure_ascii is compiled exactly as