@@ -676,11 +676,21 @@ bool StyledStreamWriter::hasCommentForValue(const Value& value) {
676676// ////////////////////////
677677// BuiltStyledStreamWriter
678678
679+ // / Scoped enums are not available until C++11.
680+ struct CommentStyle {
681+ // / Decide whether to write comments.
682+ enum Enum {
683+ None, // /< Drop all comments.
684+ Most, // /< Recover odd behavior of previous versions (not implemented yet).
685+ All // /< Keep all comments.
686+ };
687+ };
688+
679689struct BuiltStyledStreamWriter : public StreamWriter
680690{
681691 BuiltStyledStreamWriter (
682692 std::string const & indentation,
683- StreamWriter:: CommentStyle::Enum cs,
693+ CommentStyle::Enum cs,
684694 std::string const & colonSymbol,
685695 std::string const & nullSymbol,
686696 std::string const & endingLineFeedSymbol);
@@ -713,7 +723,7 @@ struct BuiltStyledStreamWriter : public StreamWriter
713723};
714724BuiltStyledStreamWriter::BuiltStyledStreamWriter (
715725 std::string const & indentation,
716- StreamWriter:: CommentStyle::Enum cs,
726+ CommentStyle::Enum cs,
717727 std::string const & colonSymbol,
718728 std::string const & nullSymbol,
719729 std::string const & endingLineFeedSymbol)
@@ -963,11 +973,11 @@ StreamWriter* StreamWriterBuilder::newStreamWriter() const
963973
964974 std::string indentation = settings_[" indentation" ].asString ();
965975 std::string cs_str = settings_[" commentStyle" ].asString ();
966- StreamWriter:: CommentStyle::Enum cs = StreamWriter:: CommentStyle::All;
976+ CommentStyle::Enum cs = CommentStyle::All;
967977 if (cs_str == " All" ) {
968- cs = StreamWriter:: CommentStyle::All;
978+ cs = CommentStyle::All;
969979 } else if (cs_str == " None" ) {
970- cs = StreamWriter:: CommentStyle::None;
980+ cs = CommentStyle::None;
971981 } else {
972982 return NULL ;
973983 }
@@ -1031,7 +1041,7 @@ StreamWriter* OldCompressingStreamWriterBuilder::newStreamWriter() const
10311041 endingLineFeedSymbol = " " ;
10321042 }
10331043 return new BuiltStyledStreamWriter (
1034- " " , StreamWriter:: CommentStyle::None,
1044+ " " , CommentStyle::None,
10351045 colonSymbol, nullSymbol, endingLineFeedSymbol);
10361046}
10371047
0 commit comments