@@ -31,7 +31,7 @@ class StreamWriterBuilder;
3131 using namespace Json;
3232 Value value;
3333 StreamWriter::Builder builder;
34- builder.setCommentStyle (StreamWriter::CommentStyle::None);
34+ builder.withCommentStyle (StreamWriter::CommentStyle::None);
3535 std::shared_ptr<StreamWriter> writer(
3636 builder.newStreamWriter(&std::cout));
3737 writer->write(value);
@@ -66,32 +66,32 @@ class JSON_API StreamWriter {
6666 Builder ();
6767 ~Builder (); // delete underlying StreamWriterBuilder
6868
69- void setCommentStyle (CommentStyle cs); // / default: All
69+ Builder& withCommentStyle (CommentStyle cs); // / default: All
7070 /* * \brief Write in human-friendly style.
7171
7272 If "", then skip all indentation, newlines, and comments,
7373 which implies CommentStyle::None.
7474 Default: "\t"
7575 */
76- void setIndentation (std::string indentation);
76+ Builder& withIndentation (std::string indentation);
7777 /* * \brief Drop the "null" string from the writer's output for nullValues.
7878 * Strictly speaking, this is not valid JSON. But when the output is being
7979 * fed to a browser's Javascript, it makes for smaller output and the
8080 * browser can handle the output just fine.
8181 */
82- void setDropNullPlaceholders (bool v);
82+ Builder& withDropNullPlaceholders (bool v);
8383 /* * \brief Do not add \n at end of document.
8484 * Normally, we add an extra newline, just because.
8585 */
86- void setOmitEndingLineFeed (bool v);
86+ Builder& withOmitEndingLineFeed (bool v);
8787 /* * \brief Add a space after ':'.
8888 * If indentation is non-empty, we surround colon with whitespace,
8989 * e.g. " : "
9090 * This will add back the trailing space when there is no indentation.
9191 * This seems dubious when the entire document is on a single line,
9292 * but we leave this here to repduce the behavior of the old `FastWriter`.
9393 */
94- void setEnableYAMLCompatibility (bool v);
94+ Builder& withEnableYAMLCompatibility (bool v);
9595
9696 // / Do not take ownership of sout, but maintain a reference.
9797 StreamWriter* newStreamWriter (std::ostream* sout) const ;
@@ -103,6 +103,7 @@ std::string writeString(Value const& root, StreamWriter::Builder const& builder)
103103
104104
105105/* * \brief Abstract class for writers.
106+ * \deprecated Use StreamWriter::Builder.
106107 */
107108class JSON_API Writer {
108109public:
@@ -118,6 +119,7 @@ class JSON_API Writer {
118119 *consumption,
119120 * but may be usefull to support feature such as RPC where bandwith is limited.
120121 * \sa Reader, Value
122+ * \deprecated Use StreamWriter::Builder.
121123 */
122124class JSON_API FastWriter : public Writer {
123125public:
@@ -169,6 +171,7 @@ class JSON_API FastWriter : public Writer {
169171 *#CommentPlacement.
170172 *
171173 * \sa Reader, Value, Value::setComment()
174+ * \deprecated Use StreamWriter::Builder.
172175 */
173176class JSON_API StyledWriter : public Writer {
174177public:
@@ -230,6 +233,7 @@ class JSON_API StyledWriter : public Writer {
230233 *
231234 * \param indentation Each level will be indented by this amount extra.
232235 * \sa Reader, Value, Value::setComment()
236+ * \deprecated Use StreamWriter::Builder.
233237 */
234238class JSON_API StyledStreamWriter {
235239public:
0 commit comments