@@ -676,11 +676,21 @@ bool StyledStreamWriter::hasCommentForValue(const Value& value) {
676
676
// ////////////////////////
677
677
// BuiltStyledStreamWriter
678
678
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
+
679
689
struct BuiltStyledStreamWriter : public StreamWriter
680
690
{
681
691
BuiltStyledStreamWriter (
682
692
std::string const & indentation,
683
- StreamWriter:: CommentStyle::Enum cs,
693
+ CommentStyle::Enum cs,
684
694
std::string const & colonSymbol,
685
695
std::string const & nullSymbol,
686
696
std::string const & endingLineFeedSymbol);
@@ -713,7 +723,7 @@ struct BuiltStyledStreamWriter : public StreamWriter
713
723
};
714
724
BuiltStyledStreamWriter::BuiltStyledStreamWriter (
715
725
std::string const & indentation,
716
- StreamWriter:: CommentStyle::Enum cs,
726
+ CommentStyle::Enum cs,
717
727
std::string const & colonSymbol,
718
728
std::string const & nullSymbol,
719
729
std::string const & endingLineFeedSymbol)
@@ -963,11 +973,11 @@ StreamWriter* StreamWriterBuilder::newStreamWriter() const
963
973
964
974
std::string indentation = settings_[" indentation" ].asString ();
965
975
std::string cs_str = settings_[" commentStyle" ].asString ();
966
- StreamWriter:: CommentStyle::Enum cs = StreamWriter:: CommentStyle::All;
976
+ CommentStyle::Enum cs = CommentStyle::All;
967
977
if (cs_str == " All" ) {
968
- cs = StreamWriter:: CommentStyle::All;
978
+ cs = CommentStyle::All;
969
979
} else if (cs_str == " None" ) {
970
- cs = StreamWriter:: CommentStyle::None;
980
+ cs = CommentStyle::None;
971
981
} else {
972
982
return NULL ;
973
983
}
@@ -1031,7 +1041,7 @@ StreamWriter* OldCompressingStreamWriterBuilder::newStreamWriter() const
1031
1041
endingLineFeedSymbol = " " ;
1032
1042
}
1033
1043
return new BuiltStyledStreamWriter (
1034
- " " , StreamWriter:: CommentStyle::None,
1044
+ " " , CommentStyle::None,
1035
1045
colonSymbol, nullSymbol, endingLineFeedSymbol);
1036
1046
}
1037
1047
0 commit comments