From 7eca3b4e88bce2787587ceb06d44181822221a09 Mon Sep 17 00:00:00 2001 From: Christopher Dunn Date: Mon, 26 Jan 2015 11:17:42 -0600 Subject: [PATCH] gcc-4.6 (Travis CI) does not support --- include/json/writer.h | 6 ++++-- src/lib_json/json_writer.cpp | 4 ++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/include/json/writer.h b/include/json/writer.h index 0dca690..be8ea38 100644 --- a/include/json/writer.h +++ b/include/json/writer.h @@ -92,14 +92,16 @@ public: /** \brief How to write comments. * Default: All */ - StreamWriter::CommentStyle cs_ = StreamWriter::CommentStyle::All; + StreamWriter::CommentStyle cs_; /** \brief Write in human-friendly style. If "", then skip all indentation and newlines. In that case, you probably want CommentStyle::None also. Default: "\t" */ - std::string indentation_ = "\t"; + std::string indentation_; + + StreamWriterBuilder(); /// Do not take ownership of sout, but maintain a reference. StreamWriter* newStreamWriter(std::ostream* sout) const; diff --git a/src/lib_json/json_writer.cpp b/src/lib_json/json_writer.cpp index b8d1ba8..6e0a429 100644 --- a/src/lib_json/json_writer.cpp +++ b/src/lib_json/json_writer.cpp @@ -961,6 +961,10 @@ int MyStreamWriter::write(Value const& root) } StreamWriter::Factory::~Factory() {} +StreamWriterBuilder::StreamWriterBuilder() + : cs_(StreamWriter::CommentStyle::All) + , indentation_("\t") +{} StreamWriter* StreamWriterBuilder::newStreamWriter(std::ostream* stream) const { std::string colonSymbol = " : ";