Dan Albert | c3bbea3 | 2014-08-21 15:48:37 -0700 | [diff] [blame^] | 1 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
| 2 | <html xmlns="http://www.w3.org/1999/xhtml"> |
| 3 | <head> |
| 4 | <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> |
| 5 | <title>TinyXml: TiXmlPrinter Class Reference</title> |
| 6 | <link href="tabs.css" rel="stylesheet" type="text/css"/> |
| 7 | <link href="doxygen.css" rel="stylesheet" type="text/css"/> |
| 8 | </head> |
| 9 | <body> |
| 10 | <!-- Generated by Doxygen 1.6.2 --> |
| 11 | <div class="navigation" id="top"> |
| 12 | <div class="tabs"> |
| 13 | <ul> |
| 14 | <li><a href="index.html"><span>Main Page</span></a></li> |
| 15 | <li><a href="pages.html"><span>Related Pages</span></a></li> |
| 16 | <li class="current"><a href="annotated.html"><span>Classes</span></a></li> |
| 17 | <li><a href="files.html"><span>Files</span></a></li> |
| 18 | </ul> |
| 19 | </div> |
| 20 | <div class="tabs"> |
| 21 | <ul> |
| 22 | <li><a href="annotated.html"><span>Class List</span></a></li> |
| 23 | <li><a href="hierarchy.html"><span>Class Hierarchy</span></a></li> |
| 24 | <li><a href="functions.html"><span>Class Members</span></a></li> |
| 25 | </ul> |
| 26 | </div> |
| 27 | </div> |
| 28 | <div class="contents"> |
| 29 | <h1>TiXmlPrinter Class Reference</h1><!-- doxytag: class="TiXmlPrinter" --><!-- doxytag: inherits="TiXmlVisitor" --> |
| 30 | <p>Print to memory functionality. |
| 31 | <a href="#_details">More...</a></p> |
| 32 | |
| 33 | <p><code>#include <<a class="el" href="tinyxml_8h_source.html">tinyxml.h</a>></code></p> |
| 34 | <div class="dynheader"> |
| 35 | Inheritance diagram for TiXmlPrinter:</div> |
| 36 | <div class="dynsection"> |
| 37 | <div class="center"> |
| 38 | <img src="classTiXmlPrinter.png" usemap="#TiXmlPrinter_map" alt=""/> |
| 39 | <map id="TiXmlPrinter_map" name="TiXmlPrinter_map"> |
| 40 | <area href="classTiXmlVisitor.html" alt="TiXmlVisitor" shape="rect" coords="0,0,81,24"/> |
| 41 | </map> |
| 42 | </div> |
| 43 | </div> |
| 44 | |
| 45 | <p><a href="classTiXmlPrinter-members.html">List of all members.</a></p> |
| 46 | <table border="0" cellpadding="0" cellspacing="0"> |
| 47 | <tr><td colspan="2"><h2>Public Member Functions</h2></td></tr> |
| 48 | <tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a799f4f0388570cbb54c0d3c345fef7c1"></a><!-- doxytag: member="TiXmlPrinter::VisitEnter" ref="a799f4f0388570cbb54c0d3c345fef7c1" args="(const TiXmlDocument &doc)" --> |
| 49 | virtual bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classTiXmlPrinter.html#a799f4f0388570cbb54c0d3c345fef7c1">VisitEnter</a> (const <a class="el" href="classTiXmlDocument.html">TiXmlDocument</a> &doc)</td></tr> |
| 50 | <tr><td class="mdescLeft"> </td><td class="mdescRight">Visit a document. <br/></td></tr> |
| 51 | <tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a66b33edd76c538b462f789b797a4fdf2"></a><!-- doxytag: member="TiXmlPrinter::VisitExit" ref="a66b33edd76c538b462f789b797a4fdf2" args="(const TiXmlDocument &doc)" --> |
| 52 | virtual bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classTiXmlPrinter.html#a66b33edd76c538b462f789b797a4fdf2">VisitExit</a> (const <a class="el" href="classTiXmlDocument.html">TiXmlDocument</a> &doc)</td></tr> |
| 53 | <tr><td class="mdescLeft"> </td><td class="mdescRight">Visit a document. <br/></td></tr> |
| 54 | <tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a0c5e7bf8622838417a0d0bfb8f433854"></a><!-- doxytag: member="TiXmlPrinter::VisitEnter" ref="a0c5e7bf8622838417a0d0bfb8f433854" args="(const TiXmlElement &element, const TiXmlAttribute *firstAttribute)" --> |
| 55 | virtual bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classTiXmlPrinter.html#a0c5e7bf8622838417a0d0bfb8f433854">VisitEnter</a> (const <a class="el" href="classTiXmlElement.html">TiXmlElement</a> &element, const <a class="el" href="classTiXmlAttribute.html">TiXmlAttribute</a> *firstAttribute)</td></tr> |
| 56 | <tr><td class="mdescLeft"> </td><td class="mdescRight">Visit an element. <br/></td></tr> |
| 57 | <tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a1853cf2f6e63ad4b4232b4835e0acaf0"></a><!-- doxytag: member="TiXmlPrinter::VisitExit" ref="a1853cf2f6e63ad4b4232b4835e0acaf0" args="(const TiXmlElement &element)" --> |
| 58 | virtual bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classTiXmlPrinter.html#a1853cf2f6e63ad4b4232b4835e0acaf0">VisitExit</a> (const <a class="el" href="classTiXmlElement.html">TiXmlElement</a> &element)</td></tr> |
| 59 | <tr><td class="mdescLeft"> </td><td class="mdescRight">Visit an element. <br/></td></tr> |
| 60 | <tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ace1b14d33eede2575c0743e2350f6a38"></a><!-- doxytag: member="TiXmlPrinter::Visit" ref="ace1b14d33eede2575c0743e2350f6a38" args="(const TiXmlDeclaration &declaration)" --> |
| 61 | virtual bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classTiXmlPrinter.html#ace1b14d33eede2575c0743e2350f6a38">Visit</a> (const <a class="el" href="classTiXmlDeclaration.html">TiXmlDeclaration</a> &declaration)</td></tr> |
| 62 | <tr><td class="mdescLeft"> </td><td class="mdescRight">Visit a declaration. <br/></td></tr> |
| 63 | <tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a711e7d65d4af9ec70977568d2451fb1c"></a><!-- doxytag: member="TiXmlPrinter::Visit" ref="a711e7d65d4af9ec70977568d2451fb1c" args="(const TiXmlText &text)" --> |
| 64 | virtual bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classTiXmlPrinter.html#a711e7d65d4af9ec70977568d2451fb1c">Visit</a> (const <a class="el" href="classTiXmlText.html">TiXmlText</a> &text)</td></tr> |
| 65 | <tr><td class="mdescLeft"> </td><td class="mdescRight">Visit a text node. <br/></td></tr> |
| 66 | <tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a83c13d6b980064b30f989f9a35498979"></a><!-- doxytag: member="TiXmlPrinter::Visit" ref="a83c13d6b980064b30f989f9a35498979" args="(const TiXmlComment &comment)" --> |
| 67 | virtual bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classTiXmlPrinter.html#a83c13d6b980064b30f989f9a35498979">Visit</a> (const <a class="el" href="classTiXmlComment.html">TiXmlComment</a> &comment)</td></tr> |
| 68 | <tr><td class="mdescLeft"> </td><td class="mdescRight">Visit a comment node. <br/></td></tr> |
| 69 | <tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ad2dca6dd106e8982fd3c7db1f3330970"></a><!-- doxytag: member="TiXmlPrinter::Visit" ref="ad2dca6dd106e8982fd3c7db1f3330970" args="(const TiXmlUnknown &unknown)" --> |
| 70 | virtual bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classTiXmlPrinter.html#ad2dca6dd106e8982fd3c7db1f3330970">Visit</a> (const <a class="el" href="classTiXmlUnknown.html">TiXmlUnknown</a> &unknown)</td></tr> |
| 71 | <tr><td class="mdescLeft"> </td><td class="mdescRight">Visit an unknown node. <br/></td></tr> |
| 72 | <tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classTiXmlPrinter.html#a213377a4070c7e625bae59716b089e5e">SetIndent</a> (const char *_indent)</td></tr> |
| 73 | <tr><td class="mdescLeft"> </td><td class="mdescRight">Set the indent characters for printing. <a href="#a213377a4070c7e625bae59716b089e5e"></a><br/></td></tr> |
| 74 | <tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="abb33ec7d4bad6aaeb57f4304394b133d"></a><!-- doxytag: member="TiXmlPrinter::Indent" ref="abb33ec7d4bad6aaeb57f4304394b133d" args="()" --> |
| 75 | const char * </td><td class="memItemRight" valign="bottom"><a class="el" href="classTiXmlPrinter.html#abb33ec7d4bad6aaeb57f4304394b133d">Indent</a> ()</td></tr> |
| 76 | <tr><td class="mdescLeft"> </td><td class="mdescRight">Query the indention string. <br/></td></tr> |
| 77 | <tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classTiXmlPrinter.html#a4be1e37e69e3858c59635aa947174fe6">SetLineBreak</a> (const char *_lineBreak)</td></tr> |
| 78 | <tr><td class="mdescLeft"> </td><td class="mdescRight">Set the line breaking string. <a href="#a4be1e37e69e3858c59635aa947174fe6"></a><br/></td></tr> |
| 79 | <tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a11f1b4804a460b175ec244eb5724d96d"></a><!-- doxytag: member="TiXmlPrinter::LineBreak" ref="a11f1b4804a460b175ec244eb5724d96d" args="()" --> |
| 80 | const char * </td><td class="memItemRight" valign="bottom"><a class="el" href="classTiXmlPrinter.html#a11f1b4804a460b175ec244eb5724d96d">LineBreak</a> ()</td></tr> |
| 81 | <tr><td class="mdescLeft"> </td><td class="mdescRight">Query the current line breaking string. <br/></td></tr> |
| 82 | <tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classTiXmlPrinter.html#ab23a90629e374cb1cadca090468bbd19">SetStreamPrinting</a> ()</td></tr> |
| 83 | <tr><td class="mdescLeft"> </td><td class="mdescRight">Switch over to "stream printing" which is the most dense formatting without linebreaks. <a href="#ab23a90629e374cb1cadca090468bbd19"></a><br/></td></tr> |
| 84 | <tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a859eede9597d3e0355b77757be48735e"></a><!-- doxytag: member="TiXmlPrinter::CStr" ref="a859eede9597d3e0355b77757be48735e" args="()" --> |
| 85 | const char * </td><td class="memItemRight" valign="bottom"><a class="el" href="classTiXmlPrinter.html#a859eede9597d3e0355b77757be48735e">CStr</a> ()</td></tr> |
| 86 | <tr><td class="mdescLeft"> </td><td class="mdescRight">Return the result. <br/></td></tr> |
| 87 | <tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ad01375ae9199bd2f48252eaddce3039d"></a><!-- doxytag: member="TiXmlPrinter::Size" ref="ad01375ae9199bd2f48252eaddce3039d" args="()" --> |
| 88 | size_t </td><td class="memItemRight" valign="bottom"><a class="el" href="classTiXmlPrinter.html#ad01375ae9199bd2f48252eaddce3039d">Size</a> ()</td></tr> |
| 89 | <tr><td class="mdescLeft"> </td><td class="mdescRight">Return the length of the result string. <br/></td></tr> |
| 90 | <tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a3bd4daf44309b41f5813a833caa0d1c9"></a><!-- doxytag: member="TiXmlPrinter::Str" ref="a3bd4daf44309b41f5813a833caa0d1c9" args="()" --> |
| 91 | const std::string & </td><td class="memItemRight" valign="bottom"><a class="el" href="classTiXmlPrinter.html#a3bd4daf44309b41f5813a833caa0d1c9">Str</a> ()</td></tr> |
| 92 | <tr><td class="mdescLeft"> </td><td class="mdescRight">Return the result. <br/></td></tr> |
| 93 | </table> |
| 94 | <hr/><a name="_details"></a><h2>Detailed Description</h2> |
| 95 | <p>Print to memory functionality. </p> |
| 96 | <p>The <a class="el" href="classTiXmlPrinter.html" title="Print to memory functionality.">TiXmlPrinter</a> is useful when you need to:</p> |
| 97 | <ol type="1"> |
| 98 | <li>Print to memory (especially in non-STL mode)</li> |
| 99 | <li>Control formatting (line endings, etc.)</li> |
| 100 | </ol> |
| 101 | <p>When constructed, the <a class="el" href="classTiXmlPrinter.html" title="Print to memory functionality.">TiXmlPrinter</a> is in its default "pretty printing" mode. Before calling Accept() you can call methods to control the printing of the XML document. After <a class="el" href="classTiXmlNode.html#acc0f88b7462c6cb73809d410a4f5bb86" title="Accept a hierchical visit the nodes in the TinyXML DOM.">TiXmlNode::Accept()</a> is called, the printed document can be accessed via the <a class="el" href="classTiXmlPrinter.html#a859eede9597d3e0355b77757be48735e" title="Return the result.">CStr()</a>, <a class="el" href="classTiXmlPrinter.html#a3bd4daf44309b41f5813a833caa0d1c9" title="Return the result.">Str()</a>, and <a class="el" href="classTiXmlPrinter.html#ad01375ae9199bd2f48252eaddce3039d" title="Return the length of the result string.">Size()</a> methods.</p> |
| 102 | <p><a class="el" href="classTiXmlPrinter.html" title="Print to memory functionality.">TiXmlPrinter</a> uses the Visitor API. </p> |
| 103 | <div class="fragment"><pre class="fragment"> |
| 104 | TiXmlPrinter printer; |
| 105 | printer.SetIndent( "\t" ); |
| 106 | |
| 107 | doc.Accept( &printer ); |
| 108 | fprintf( stdout, "%s", printer.CStr() ); |
| 109 | </pre></div> <hr/><h2>Member Function Documentation</h2> |
| 110 | <a class="anchor" id="a213377a4070c7e625bae59716b089e5e"></a><!-- doxytag: member="TiXmlPrinter::SetIndent" ref="a213377a4070c7e625bae59716b089e5e" args="(const char *_indent)" --> |
| 111 | <div class="memitem"> |
| 112 | <div class="memproto"> |
| 113 | <table class="memname"> |
| 114 | <tr> |
| 115 | <td class="memname">void TiXmlPrinter::SetIndent </td> |
| 116 | <td>(</td> |
| 117 | <td class="paramtype">const char * </td> |
| 118 | <td class="paramname"> <em>_indent</em></td> |
| 119 | <td> ) </td> |
| 120 | <td><code> [inline]</code></td> |
| 121 | </tr> |
| 122 | </table> |
| 123 | </div> |
| 124 | <div class="memdoc"> |
| 125 | |
| 126 | <p>Set the indent characters for printing. </p> |
| 127 | <p>By default 4 spaces but tab () is also useful, or null/empty string for no indentation. </p> |
| 128 | |
| 129 | </div> |
| 130 | </div> |
| 131 | <a class="anchor" id="a4be1e37e69e3858c59635aa947174fe6"></a><!-- doxytag: member="TiXmlPrinter::SetLineBreak" ref="a4be1e37e69e3858c59635aa947174fe6" args="(const char *_lineBreak)" --> |
| 132 | <div class="memitem"> |
| 133 | <div class="memproto"> |
| 134 | <table class="memname"> |
| 135 | <tr> |
| 136 | <td class="memname">void TiXmlPrinter::SetLineBreak </td> |
| 137 | <td>(</td> |
| 138 | <td class="paramtype">const char * </td> |
| 139 | <td class="paramname"> <em>_lineBreak</em></td> |
| 140 | <td> ) </td> |
| 141 | <td><code> [inline]</code></td> |
| 142 | </tr> |
| 143 | </table> |
| 144 | </div> |
| 145 | <div class="memdoc"> |
| 146 | |
| 147 | <p>Set the line breaking string. </p> |
| 148 | <p>By default set to newline (<br/> |
| 149 | ). Some operating systems prefer other characters, or can be set to the null/empty string for no indenation. </p> |
| 150 | |
| 151 | </div> |
| 152 | </div> |
| 153 | <a class="anchor" id="ab23a90629e374cb1cadca090468bbd19"></a><!-- doxytag: member="TiXmlPrinter::SetStreamPrinting" ref="ab23a90629e374cb1cadca090468bbd19" args="()" --> |
| 154 | <div class="memitem"> |
| 155 | <div class="memproto"> |
| 156 | <table class="memname"> |
| 157 | <tr> |
| 158 | <td class="memname">void TiXmlPrinter::SetStreamPrinting </td> |
| 159 | <td>(</td> |
| 160 | <td class="paramname"></td> |
| 161 | <td> ) </td> |
| 162 | <td><code> [inline]</code></td> |
| 163 | </tr> |
| 164 | </table> |
| 165 | </div> |
| 166 | <div class="memdoc"> |
| 167 | |
| 168 | <p>Switch over to "stream printing" which is the most dense formatting without linebreaks. </p> |
| 169 | <p>Common when the XML is needed for network transmission. </p> |
| 170 | |
| 171 | </div> |
| 172 | </div> |
| 173 | <hr/>The documentation for this class was generated from the following file:<ul> |
| 174 | <li><a class="el" href="tinyxml_8h_source.html">tinyxml.h</a></li> |
| 175 | </ul> |
| 176 | </div> |
| 177 | <hr size="1"/><address style="text-align: right;"><small>Generated by |
| 178 | <a href="http://www.doxygen.org/index.html"> |
| 179 | <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.2 </small></address> |
| 180 | </body> |
| 181 | </html> |