mirror of
https://github.com/open-source-parsers/jsoncpp.git
synced 2025-06-07 09:04:57 +02:00
docs
This commit is contained in:
parent
472d29f57b
commit
999f5912f0
@ -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.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user