Subject: [Boost-bugs] [Boost C++ Libraries] #7180: Property Tree: json_write() pretty = false option not fully respected for arrays
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2012-07-27 02:53:14
#7180: Property Tree: json_write() pretty = false option not fully respected for
arrays
----------------------------------------------------+-----------------------
Reporter: Paul Chandler <mailslot@â¦> | Owner: cornedbee
Type: Bugs | Status: new
Milestone: To Be Determined | Component: property_tree
Version: Boost Development Trunk | Severity: Problem
Keywords: property_tree json_write pretty indent |
----------------------------------------------------+-----------------------
When outputting an array with "pretty" set to false, indentation is output
blindly before the closing brace. This has the potential to waste a lot of
space in certain usage scenarios... like my own :)
Example:
{{{
["1","2" ]
}}}
Expected:
{{{
["1","2"]
}}}
Patch:
{{{
diff -dur boost.old/property_tree/detail/json_parser_write.hpp
boost.new/property_tree/detail/json_parser_write.hpp
--- boost.old/property_tree/detail/json_parser_write.hpp 2012-07-26
19:42:10.000000000 -0700
+++ boost.new/property_tree/detail/json_parser_write.hpp 2012-07-26
19:43:34.000000000 -0700
@@ -93,7 +93,8 @@
stream << Ch(',');
if (pretty) stream << Ch('\n');
}
- stream << Str(4 * indent, Ch(' ')) << Ch(']');
+ if (pretty) stream << Str(4 * indent, Ch(' '));
+ stream << Ch(']');
}
else
}}}
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/7180> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:10 UTC