Public Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
Json::StyledStreamWriter Class Reference

Writes a Value in JSON format in a human friendly way, to a stream rather than to a string. More...

#include <json.h>

Public Member Functions

 StyledStreamWriter (std::string indentation="\t")
 
 StyledStreamWriter (std::string indentation="\t")
 
void write (std::ostream &out, const Value &root)
 Serialize a Value in JSON format. More...
 
void write (std::ostream &out, const Value &root)
 Serialize a Value in JSON format. More...
 
 ~StyledStreamWriter ()
 
 ~StyledStreamWriter ()
 

Private Types

typedef std::vector< std::string > ChildValues
 
typedef std::vector< std::string > ChildValues
 

Private Member Functions

bool hasCommentForValue (const Value &value)
 
bool hasCommentForValue (const Value &value)
 
void indent ()
 
void indent ()
 
bool isMultineArray (const Value &value)
 
bool isMultineArray (const Value &value)
 
void pushValue (const std::string &value)
 
void pushValue (const std::string &value)
 
void unindent ()
 
void unindent ()
 
void writeArrayValue (const Value &value)
 
void writeArrayValue (const Value &value)
 
void writeCommentAfterValueOnSameLine (const Value &root)
 
void writeCommentAfterValueOnSameLine (const Value &root)
 
void writeCommentBeforeValue (const Value &root)
 
void writeCommentBeforeValue (const Value &root)
 
void writeIndent ()
 
void writeIndent ()
 
void writeValue (const Value &value)
 
void writeValue (const Value &value)
 
void writeWithIndent (const std::string &value)
 
void writeWithIndent (const std::string &value)
 

Static Private Member Functions

static std::string normalizeEOL (const std::string &text)
 
static std::string normalizeEOL (const std::string &text)
 

Private Attributes

bool addChildValues_: 1
 
ChildValues childValues_
 
std::ostream * document_
 
std::string indentation_
 
bool indented_: 1
 
std::string indentString_
 
int rightMargin_
 

Detailed Description

Writes a Value in JSON format in a human friendly way, to a stream rather than to a string.

The rules for line break and indent are as follow:

If the Value have comments then they are outputed according to their CommentPlacement.

Parameters
indentationEach level will be indented by this amount extra.
See also
Reader, Value, Value::setComment()
Deprecated:
Use StreamWriterBuilder.

The rules for line break and indent are as follow:

If the Value have comments then they are outputted according to their CommentPlacement.

Parameters
indentationEach level will be indented by this amount extra.
See also
Reader, Value, Value::setComment()
Deprecated:
Use StreamWriterBuilder.

Definition at line 1938 of file third_party/bloaty/third_party/protobuf/conformance/third_party/jsoncpp/json.h.

Member Typedef Documentation

◆ ChildValues [1/2]

typedef std::vector<std::string> Json::StyledStreamWriter::ChildValues
private

◆ ChildValues [2/2]

typedef std::vector<std::string> Json::StyledStreamWriter::ChildValues
private

Constructor & Destructor Documentation

◆ StyledStreamWriter() [1/2]

Json::StyledStreamWriter::StyledStreamWriter ( std::string  indentation = "\t")

◆ ~StyledStreamWriter() [1/2]

Json::StyledStreamWriter::~StyledStreamWriter ( )
inline

◆ StyledStreamWriter() [2/2]

Json::StyledStreamWriter::StyledStreamWriter ( std::string  indentation = "\t")

◆ ~StyledStreamWriter() [2/2]

Json::StyledStreamWriter::~StyledStreamWriter ( )
inline

Member Function Documentation

◆ hasCommentForValue() [1/2]

bool Json::StyledStreamWriter::hasCommentForValue ( const Value value)
private

◆ hasCommentForValue() [2/2]

bool Json::StyledStreamWriter::hasCommentForValue ( const Value value)
private

◆ indent() [1/2]

void Json::StyledStreamWriter::indent ( )
private

◆ indent() [2/2]

void Json::StyledStreamWriter::indent ( )
private

◆ isMultineArray() [1/2]

bool Json::StyledStreamWriter::isMultineArray ( const Value value)
private

◆ isMultineArray() [2/2]

bool Json::StyledStreamWriter::isMultineArray ( const Value value)
private

◆ normalizeEOL() [1/2]

static std::string Json::StyledStreamWriter::normalizeEOL ( const std::string &  text)
staticprivate

◆ normalizeEOL() [2/2]

static std::string Json::StyledStreamWriter::normalizeEOL ( const std::string &  text)
staticprivate

◆ pushValue() [1/2]

void Json::StyledStreamWriter::pushValue ( const std::string &  value)
private

◆ pushValue() [2/2]

void Json::StyledStreamWriter::pushValue ( const std::string &  value)
private

◆ unindent() [1/2]

void Json::StyledStreamWriter::unindent ( )
private

◆ unindent() [2/2]

void Json::StyledStreamWriter::unindent ( )
private

◆ write() [1/2]

void Json::StyledStreamWriter::write ( std::ostream &  out,
const Value root 
)

Serialize a Value in JSON format.

Parameters
outStream to write to. (Can be ostringstream, e.g.)
rootValue to serialize.
Note
There is no point in deriving from Writer, since write() should not return a value.

Definition at line 4578 of file bloaty/third_party/protobuf/conformance/third_party/jsoncpp/jsoncpp.cpp.

◆ write() [2/2]

void Json::StyledStreamWriter::write ( std::ostream &  out,
const Value root 
)

Serialize a Value in JSON format.

Parameters
outStream to write to. (Can be ostringstream, e.g.)
rootValue to serialize.
Note
There is no point in deriving from Writer, since write() should not return a value.

◆ writeArrayValue() [1/2]

void Json::StyledStreamWriter::writeArrayValue ( const Value value)
private

◆ writeArrayValue() [2/2]

void Json::StyledStreamWriter::writeArrayValue ( const Value value)
private

◆ writeCommentAfterValueOnSameLine() [1/2]

void Json::StyledStreamWriter::writeCommentAfterValueOnSameLine ( const Value root)
private

◆ writeCommentAfterValueOnSameLine() [2/2]

void Json::StyledStreamWriter::writeCommentAfterValueOnSameLine ( const Value root)
private

◆ writeCommentBeforeValue() [1/2]

void Json::StyledStreamWriter::writeCommentBeforeValue ( const Value root)
private

◆ writeCommentBeforeValue() [2/2]

void Json::StyledStreamWriter::writeCommentBeforeValue ( const Value root)
private

◆ writeIndent() [1/2]

void Json::StyledStreamWriter::writeIndent ( )
private

◆ writeIndent() [2/2]

void Json::StyledStreamWriter::writeIndent ( )
private

◆ writeValue() [1/2]

void Json::StyledStreamWriter::writeValue ( const Value value)
private

◆ writeValue() [2/2]

void Json::StyledStreamWriter::writeValue ( const Value value)
private

◆ writeWithIndent() [1/2]

void Json::StyledStreamWriter::writeWithIndent ( const std::string &  value)
private

◆ writeWithIndent() [2/2]

void Json::StyledStreamWriter::writeWithIndent ( const std::string &  value)
private

Member Data Documentation

◆ addChildValues_

bool Json::StyledStreamWriter::addChildValues_
private

◆ childValues_

ChildValues Json::StyledStreamWriter::childValues_
private

◆ document_

std::ostream * Json::StyledStreamWriter::document_
private

◆ indentation_

std::string Json::StyledStreamWriter::indentation_
private

◆ indented_

bool Json::StyledStreamWriter::indented_
private

◆ indentString_

std::string Json::StyledStreamWriter::indentString_
private

◆ rightMargin_

int Json::StyledStreamWriter::rightMargin_
private

The documentation for this class was generated from the following files:


grpc
Author(s):
autogenerated on Fri May 16 2025 03:03:40