This commit is contained in:
Christopher Dunn 2015-01-26 11:12:53 -06:00
parent 472d29f57b
commit 999f5912f0

View File

@ -23,20 +23,18 @@
namespace Json { namespace Json {
class Value; class Value;
class StreamWriterBuilder;
/** /**
Usage: Usage:
\code \code
using namespace Json; using namespace Json;
Value value; void writeToStdout(StreamWriter::Builder const& builder, Value const& value) {
StreamWriter::Builder builder; std::unique_ptr<StreamWriter> const writer(
builder.withCommentStyle(StreamWriter::CommentStyle::None);
std::shared_ptr<StreamWriter> writer(
builder.newStreamWriter(&std::cout)); builder.newStreamWriter(&std::cout));
writer->write(value); writer->write(value);
std::cout << std::endl; // add lf and flush std::cout << std::endl; // add lf and flush
}
\endcode \endcode
*/ */
class JSON_API StreamWriter { class JSON_API StreamWriter {
@ -73,9 +71,20 @@ std::string writeString(Value const& root, StreamWriter::Factory const& factory)
/** \brief Build a StreamWriter implementation. /** \brief Build a StreamWriter implementation.
*/
Usage:
\code
using namespace Json;
Value value = ...;
StreamWriter::Builder builder;
builder.cs_ = StreamWriter::CommentStyle::None;
std::shared_ptr<StreamWriter> writer(
builder.newStreamWriter(&std::cout));
writer->write(value);
std::cout << std::endl; // add lf and flush
\endcode
*/
class JSON_API StreamWriterBuilder : public StreamWriter::Factory { class JSON_API StreamWriterBuilder : public StreamWriter::Factory {
// typedef StreamWriter::CommentStyle CommentStyle;
public: public:
// Note: We cannot add data-members to this class without a major version bump. // Note: We cannot add data-members to this class without a major version bump.
// So these might as well be completely exposed. // So these might as well be completely exposed.