Twitch SDK (Internal)
Public Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
ttv::json::StyledWriter Class Reference

Writes a Value in JSON format in a human friendly way. More...

#include <writer.h>

Inheritance diagram for ttv::json::StyledWriter:
ttv::json::Writer

Public Member Functions

 StyledWriter ()
 
virtual ~StyledWriter ()
 
virtual std::string write (const Value &root)
 Serialize a Value in JSON format. More...
 

Private Types

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

Private Member Functions

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

Static Private Member Functions

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

Private Attributes

ChildValues childValues_
 
std::string document_
 
std::string indentString_
 
unsigned int rightMargin_
 
unsigned int indentSize_
 
bool addChildValues_
 

Detailed Description

Writes a Value in JSON format in a human friendly way.

The rules for line break and indent are as follow:

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

See also
Reader, Value, Value::setComment()

Member Typedef Documentation

◆ ChildValues

typedef std::vector<std::string> ttv::json::StyledWriter::ChildValues
private

Constructor & Destructor Documentation

◆ StyledWriter()

ttv::json::StyledWriter::StyledWriter ( )

◆ ~StyledWriter()

virtual ttv::json::StyledWriter::~StyledWriter ( )
inlinevirtual

Member Function Documentation

◆ hasCommentForValue()

bool ttv::json::StyledWriter::hasCommentForValue ( const Value value)
private

◆ indent()

void ttv::json::StyledWriter::indent ( )
private

◆ isMultineArray()

bool ttv::json::StyledWriter::isMultineArray ( const Value value)
private

◆ normalizeEOL()

static std::string ttv::json::StyledWriter::normalizeEOL ( const std::string &  text)
staticprivate

◆ pushValue()

void ttv::json::StyledWriter::pushValue ( const std::string &  value)
private

◆ unindent()

void ttv::json::StyledWriter::unindent ( )
private

◆ write()

virtual std::string ttv::json::StyledWriter::write ( const Value root)
virtual

Serialize a Value in JSON format.

Parameters
rootValue to serialize.
Returns
String containing the JSON document that represents the root value.

Implements ttv::json::Writer.

◆ writeArrayValue()

void ttv::json::StyledWriter::writeArrayValue ( const Value value)
private

◆ writeCommentAfterValueOnSameLine()

void ttv::json::StyledWriter::writeCommentAfterValueOnSameLine ( const Value root)
private

◆ writeCommentBeforeValue()

void ttv::json::StyledWriter::writeCommentBeforeValue ( const Value root)
private

◆ writeIndent()

void ttv::json::StyledWriter::writeIndent ( )
private

◆ writeValue()

void ttv::json::StyledWriter::writeValue ( const Value value)
private

◆ writeWithIndent()

void ttv::json::StyledWriter::writeWithIndent ( const std::string &  value)
private

Member Data Documentation

◆ addChildValues_

bool ttv::json::StyledWriter::addChildValues_
private

◆ childValues_

ChildValues ttv::json::StyledWriter::childValues_
private

◆ document_

std::string ttv::json::StyledWriter::document_
private

◆ indentSize_

unsigned int ttv::json::StyledWriter::indentSize_
private

◆ indentString_

std::string ttv::json::StyledWriter::indentString_
private

◆ rightMargin_

unsigned int ttv::json::StyledWriter::rightMargin_
private

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