Skip to content

Commit 999f591

Browse files
committed
docs
1 parent 472d29f commit 999f591

File tree

1 file changed

+19
-10
lines changed

1 file changed

+19
-10
lines changed

include/json/writer.h

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,18 @@
2323
namespace Json {
2424

2525
class Value;
26-
class StreamWriterBuilder;
2726

2827
/**
2928
3029
Usage:
3130
\code
3231
using namespace Json;
33-
Value value;
34-
StreamWriter::Builder builder;
35-
builder.withCommentStyle(StreamWriter::CommentStyle::None);
36-
std::shared_ptr<StreamWriter> writer(
37-
builder.newStreamWriter(&std::cout));
38-
writer->write(value);
39-
std::cout << std::endl; // add lf and flush
32+
void writeToStdout(StreamWriter::Builder const& builder, Value const& value) {
33+
std::unique_ptr<StreamWriter> const writer(
34+
builder.newStreamWriter(&std::cout));
35+
writer->write(value);
36+
std::cout << std::endl; // add lf and flush
37+
}
4038
\endcode
4139
*/
4240
class JSON_API StreamWriter {
@@ -73,9 +71,20 @@ std::string writeString(Value const& root, StreamWriter::Factory const& factory)
7371

7472

7573
/** \brief Build a StreamWriter implementation.
76-
*/
74+
75+
Usage:
76+
\code
77+
using namespace Json;
78+
Value value = ...;
79+
StreamWriter::Builder builder;
80+
builder.cs_ = StreamWriter::CommentStyle::None;
81+
std::shared_ptr<StreamWriter> writer(
82+
builder.newStreamWriter(&std::cout));
83+
writer->write(value);
84+
std::cout << std::endl; // add lf and flush
85+
\endcode
86+
*/
7787
class JSON_API StreamWriterBuilder : public StreamWriter::Factory {
78-
// typedef StreamWriter::CommentStyle CommentStyle;
7988
public:
8089
// Note: We cannot add data-members to this class without a major version bump.
8190
// So these might as well be completely exposed.

0 commit comments

Comments
 (0)