<html> <head> <title> JsonCpp - JSON data format manipulation library </title> <link href="doxygen.css" rel="stylesheet" type="text/css"> <link href="tabs.css" rel="stylesheet" type="text/css"> </head> <body bgcolor="#ffffff"> <table width="100%"> <tr> <td width="40%" align="left" valign="center"> <a href="https://github.com/open-source-parsers/jsoncpp"> JsonCpp project page </a> </td> <td width="40%" align="right" valign="center"> <a href="http://open-source-parsers.github.io/jsoncpp-docs/doxygen/">JsonCpp home page</a> </td> </tr> </table> <hr> <!-- Generated by Doxygen 1.8.8 --> <div id="navrow1" class="tabs"> <ul class="tablist"> <li><a href="index.html"><span>Main Page</span></a></li> <li><a href="pages.html"><span>Related Pages</span></a></li> <li><a href="namespaces.html"><span>Namespaces</span></a></li> <li class="current"><a href="annotated.html"><span>Classes</span></a></li> <li><a href="files.html"><span>Files</span></a></li> </ul> </div> <div id="navrow2" class="tabs2"> <ul class="tablist"> <li><a href="annotated.html"><span>Class List</span></a></li> <li><a href="inherits.html"><span>Class Hierarchy</span></a></li> <li><a href="functions.html"><span>Class Members</span></a></li> </ul> </div> <div id="nav-path" class="navpath"> <ul> <li class="navelem"><a class="el" href="namespace_json.html">Json</a></li><li class="navelem"><a class="el" href="class_json_1_1_styled_stream_writer.html">StyledStreamWriter</a></li> </ul> </div> </div><!-- top --> <div class="header"> <div class="summary"> <a href="#pub-methods">Public Member Functions</a> | <a href="class_json_1_1_styled_stream_writer-members.html">List of all members</a> </div> <div class="headertitle"> <div class="title">Json::StyledStreamWriter Class Reference</div> </div> </div><!--header--> <div class="contents"> <p>Writes a <a class="el" href="class_json_1_1_value.html" title="Represents a JSON value. ">Value</a> in <a href="http://www.json.org">JSON</a> format in a human friendly way, to a stream rather than to a string. <a href="class_json_1_1_styled_stream_writer.html#details">More...</a></p> <p><code>#include <<a class="el" href="writer_8h_source.html">/home/iurt/rpmbuild/BUILD/jsoncpp-1.6.5/include/json/writer.h</a>></code></p> <div id="dynsection-0" onclick="return toggleVisibility(this)" class="dynheader closed" style="cursor:pointer;"> <img id="dynsection-0-trigger" src="closed.png" alt="+"/> Collaboration diagram for Json::StyledStreamWriter:</div> <div id="dynsection-0-summary" class="dynsummary" style="display:block;"> </div> <div id="dynsection-0-content" class="dyncontent" style="display:none;"> <div class="center"><img src="class_json_1_1_styled_stream_writer__coll__graph.png" border="0" usemap="#_json_1_1_styled_stream_writer_coll__map" alt="Collaboration graph"/></div> <map name="_json_1_1_styled_stream_writer_coll__map" id="_json_1_1_styled_stream_writer_coll__map"> </map> </div> <table class="memberdecls"> <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a> Public Member Functions</h2></td></tr> <tr class="memitem:ae87567a08de865b6dc84d7218a3001df"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="class_json_1_1_styled_stream_writer.html#ae87567a08de865b6dc84d7218a3001df">StyledStreamWriter</a> (std::string indentation="\t")</td></tr> <tr class="separator:ae87567a08de865b6dc84d7218a3001df"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a17444a59f617970279714e97b0ddfa46"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="class_json_1_1_styled_stream_writer.html#a17444a59f617970279714e97b0ddfa46">~StyledStreamWriter</a> ()</td></tr> <tr class="separator:a17444a59f617970279714e97b0ddfa46"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a07807741c6c43ecd35885a87234d0805"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="class_json_1_1_styled_stream_writer.html#a07807741c6c43ecd35885a87234d0805">write</a> (std::ostream &out, const <a class="el" href="class_json_1_1_value.html">Value</a> &root)</td></tr> <tr class="memdesc:a07807741c6c43ecd35885a87234d0805"><td class="mdescLeft"> </td><td class="mdescRight">Serialize a <a class="el" href="class_json_1_1_value.html" title="Represents a JSON value. ">Value</a> in <a href="http://www.json.org">JSON</a> format. <a href="#a07807741c6c43ecd35885a87234d0805">More...</a><br /></td></tr> <tr class="separator:a07807741c6c43ecd35885a87234d0805"><td class="memSeparator" colspan="2"> </td></tr> </table> <a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2> <div class="textblock"><p>Writes a <a class="el" href="class_json_1_1_value.html" title="Represents a JSON value. ">Value</a> in <a href="http://www.json.org">JSON</a> format in a human friendly way, to a stream rather than to a string. </p> <p>The rules for line break and indent are as follow:</p><ul> <li>Object value:<ul> <li>if empty then print {} without indent and line break</li> <li>if not empty the print '{', line break & indent, print one value per line and then unindent and line break and print '}'.</li> </ul> </li> <li>Array value:<ul> <li>if empty then print [] without indent and line break</li> <li>if the array contains no object value, empty array or some other value types, and all the values fit on one lines, then print the array on a single line.</li> <li>otherwise, it the values do not fit on one line, or the array contains object or non empty array, then print one value per line.</li> </ul> </li> </ul> <p>If the <a class="el" href="class_json_1_1_value.html" title="Represents a JSON value. ">Value</a> have comments then they are outputed according to their <a class="el" href="namespace_json.html#a4fc417c23905b2ae9e2c47d197a45351">CommentPlacement</a>.</p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">indentation</td><td>Each level will be indented by this amount extra. </td></tr> </table> </dd> </dl> <dl class="section see"><dt>See also</dt><dd><a class="el" href="class_json_1_1_reader.html" title="Unserialize a JSON document into a Value. ">Reader</a>, <a class="el" href="class_json_1_1_value.html" title="Represents a JSON value. ">Value</a>, <a class="el" href="class_json_1_1_value.html#a29f3a30f7e5d3af6f38d57999bf5b480">Value::setComment()</a> </dd></dl> <dl class="deprecated"><dt><b><a class="el" href="deprecated.html#_deprecated000010">Deprecated:</a></b></dt><dd>Use <a class="el" href="class_json_1_1_stream_writer_builder.html" title="Build a StreamWriter implementation. ">StreamWriterBuilder</a>. </dd></dl> <p>Definition at line <a class="el" href="writer_8h_source.html#l00268">268</a> of file <a class="el" href="writer_8h_source.html">writer.h</a>.</p> </div><h2 class="groupheader">Constructor & Destructor Documentation</h2> <a class="anchor" id="ae87567a08de865b6dc84d7218a3001df"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">Json::StyledStreamWriter::StyledStreamWriter </td> <td>(</td> <td class="paramtype">std::string </td> <td class="paramname"><em>indentation</em> = <code>"\t"</code></td><td>)</td> <td></td> </tr> </table> </div><div class="memdoc"> <p>Definition at line <a class="el" href="json__writer_8cpp_source.html#l00583">583</a> of file <a class="el" href="json__writer_8cpp_source.html">json_writer.cpp</a>.</p> </div> </div> <a class="anchor" id="a17444a59f617970279714e97b0ddfa46"></a> <div class="memitem"> <div class="memproto"> <table class="mlabels"> <tr> <td class="mlabels-left"> <table class="memname"> <tr> <td class="memname">Json::StyledStreamWriter::~StyledStreamWriter </td> <td>(</td> <td class="paramname"></td><td>)</td> <td></td> </tr> </table> </td> <td class="mlabels-right"> <span class="mlabels"><span class="mlabel">inline</span></span> </td> </tr> </table> </div><div class="memdoc"> <p>Definition at line <a class="el" href="writer_8h_source.html#l00271">271</a> of file <a class="el" href="writer_8h_source.html">writer.h</a>.</p> </div> </div> <h2 class="groupheader">Member Function Documentation</h2> <a class="anchor" id="a07807741c6c43ecd35885a87234d0805"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void Json::StyledStreamWriter::write </td> <td>(</td> <td class="paramtype">std::ostream & </td> <td class="paramname"><em>out</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const <a class="el" href="class_json_1_1_value.html">Value</a> & </td> <td class="paramname"><em>root</em> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div><div class="memdoc"> <p>Serialize a <a class="el" href="class_json_1_1_value.html" title="Represents a JSON value. ">Value</a> in <a href="http://www.json.org">JSON</a> format. </p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">out</td><td>Stream to write to. (Can be ostringstream, e.g.) </td></tr> <tr><td class="paramname">root</td><td><a class="el" href="class_json_1_1_value.html" title="Represents a JSON value. ">Value</a> to serialize. </td></tr> </table> </dd> </dl> <dl class="section note"><dt>Note</dt><dd>There is no point in deriving from <a class="el" href="class_json_1_1_writer.html" title="Abstract class for writers. ">Writer</a>, since <a class="el" href="class_json_1_1_styled_stream_writer.html#a07807741c6c43ecd35885a87234d0805" title="Serialize a Value in JSON format. ">write()</a> should not return a value. </dd></dl> <p>Definition at line <a class="el" href="json__writer_8cpp_source.html#l00587">587</a> of file <a class="el" href="json__writer_8cpp_source.html">json_writer.cpp</a>.</p> </div> </div> <hr/>The documentation for this class was generated from the following files:<ul> <li>/home/iurt/rpmbuild/BUILD/jsoncpp-1.6.5/include/json/<a class="el" href="writer_8h_source.html">writer.h</a></li> <li>/home/iurt/rpmbuild/BUILD/jsoncpp-1.6.5/src/lib_json/<a class="el" href="json__writer_8cpp_source.html">json_writer.cpp</a></li> </ul> </div><!-- contents --> <hr> </body> </html>