summaryrefslogtreecommitdiff
path: root/shared/tinyxml/docs/classTiXmlPrinter.html
blob: bfbf41873b3cd00c55ab592735d38e98e727ef11 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>TinyXml: TiXmlPrinter Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.6.2 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
      <li><a href="pages.html"><span>Related&nbsp;Pages</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 class="tabs">
    <ul>
      <li><a href="annotated.html"><span>Class&nbsp;List</span></a></li>
      <li><a href="hierarchy.html"><span>Class&nbsp;Hierarchy</span></a></li>
      <li><a href="functions.html"><span>Class&nbsp;Members</span></a></li>
    </ul>
  </div>
</div>
<div class="contents">
<h1>TiXmlPrinter Class Reference</h1><!-- doxytag: class="TiXmlPrinter" --><!-- doxytag: inherits="TiXmlVisitor" -->
<p>Print to memory functionality.  
<a href="#_details">More...</a></p>

<p><code>#include &lt;<a class="el" href="tinyxml_8h_source.html">tinyxml.h</a>&gt;</code></p>
<div class="dynheader">
Inheritance diagram for TiXmlPrinter:</div>
<div class="dynsection">
 <div class="center">
  <img src="classTiXmlPrinter.png" usemap="#TiXmlPrinter_map" alt=""/>
  <map id="TiXmlPrinter_map" name="TiXmlPrinter_map">
<area href="classTiXmlVisitor.html" alt="TiXmlVisitor" shape="rect" coords="0,0,81,24"/>
</map>
 </div>
</div>

<p><a href="classTiXmlPrinter-members.html">List of all members.</a></p>
<table border="0" cellpadding="0" cellspacing="0">
<tr><td colspan="2"><h2>Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a799f4f0388570cbb54c0d3c345fef7c1"></a><!-- doxytag: member="TiXmlPrinter::VisitEnter" ref="a799f4f0388570cbb54c0d3c345fef7c1" args="(const TiXmlDocument &amp;doc)" -->
virtual bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classTiXmlPrinter.html#a799f4f0388570cbb54c0d3c345fef7c1">VisitEnter</a> (const <a class="el" href="classTiXmlDocument.html">TiXmlDocument</a> &amp;doc)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Visit a document. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a66b33edd76c538b462f789b797a4fdf2"></a><!-- doxytag: member="TiXmlPrinter::VisitExit" ref="a66b33edd76c538b462f789b797a4fdf2" args="(const TiXmlDocument &amp;doc)" -->
virtual bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classTiXmlPrinter.html#a66b33edd76c538b462f789b797a4fdf2">VisitExit</a> (const <a class="el" href="classTiXmlDocument.html">TiXmlDocument</a> &amp;doc)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Visit a document. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a0c5e7bf8622838417a0d0bfb8f433854"></a><!-- doxytag: member="TiXmlPrinter::VisitEnter" ref="a0c5e7bf8622838417a0d0bfb8f433854" args="(const TiXmlElement &amp;element, const TiXmlAttribute *firstAttribute)" -->
virtual bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classTiXmlPrinter.html#a0c5e7bf8622838417a0d0bfb8f433854">VisitEnter</a> (const <a class="el" href="classTiXmlElement.html">TiXmlElement</a> &amp;element, const <a class="el" href="classTiXmlAttribute.html">TiXmlAttribute</a> *firstAttribute)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Visit an element. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a1853cf2f6e63ad4b4232b4835e0acaf0"></a><!-- doxytag: member="TiXmlPrinter::VisitExit" ref="a1853cf2f6e63ad4b4232b4835e0acaf0" args="(const TiXmlElement &amp;element)" -->
virtual bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classTiXmlPrinter.html#a1853cf2f6e63ad4b4232b4835e0acaf0">VisitExit</a> (const <a class="el" href="classTiXmlElement.html">TiXmlElement</a> &amp;element)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Visit an element. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ace1b14d33eede2575c0743e2350f6a38"></a><!-- doxytag: member="TiXmlPrinter::Visit" ref="ace1b14d33eede2575c0743e2350f6a38" args="(const TiXmlDeclaration &amp;declaration)" -->
virtual bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classTiXmlPrinter.html#ace1b14d33eede2575c0743e2350f6a38">Visit</a> (const <a class="el" href="classTiXmlDeclaration.html">TiXmlDeclaration</a> &amp;declaration)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Visit a declaration. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a711e7d65d4af9ec70977568d2451fb1c"></a><!-- doxytag: member="TiXmlPrinter::Visit" ref="a711e7d65d4af9ec70977568d2451fb1c" args="(const TiXmlText &amp;text)" -->
virtual bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classTiXmlPrinter.html#a711e7d65d4af9ec70977568d2451fb1c">Visit</a> (const <a class="el" href="classTiXmlText.html">TiXmlText</a> &amp;text)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Visit a text node. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a83c13d6b980064b30f989f9a35498979"></a><!-- doxytag: member="TiXmlPrinter::Visit" ref="a83c13d6b980064b30f989f9a35498979" args="(const TiXmlComment &amp;comment)" -->
virtual bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classTiXmlPrinter.html#a83c13d6b980064b30f989f9a35498979">Visit</a> (const <a class="el" href="classTiXmlComment.html">TiXmlComment</a> &amp;comment)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Visit a comment node. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ad2dca6dd106e8982fd3c7db1f3330970"></a><!-- doxytag: member="TiXmlPrinter::Visit" ref="ad2dca6dd106e8982fd3c7db1f3330970" args="(const TiXmlUnknown &amp;unknown)" -->
virtual bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classTiXmlPrinter.html#ad2dca6dd106e8982fd3c7db1f3330970">Visit</a> (const <a class="el" href="classTiXmlUnknown.html">TiXmlUnknown</a> &amp;unknown)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Visit an unknow node. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classTiXmlPrinter.html#a213377a4070c7e625bae59716b089e5e">SetIndent</a> (const char *_indent)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Set the indent characters for printing.  <a href="#a213377a4070c7e625bae59716b089e5e"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="abb33ec7d4bad6aaeb57f4304394b133d"></a><!-- doxytag: member="TiXmlPrinter::Indent" ref="abb33ec7d4bad6aaeb57f4304394b133d" args="()" -->
const char *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classTiXmlPrinter.html#abb33ec7d4bad6aaeb57f4304394b133d">Indent</a> ()</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Query the indention string. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classTiXmlPrinter.html#a4be1e37e69e3858c59635aa947174fe6">SetLineBreak</a> (const char *_lineBreak)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Set the line breaking string.  <a href="#a4be1e37e69e3858c59635aa947174fe6"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a11f1b4804a460b175ec244eb5724d96d"></a><!-- doxytag: member="TiXmlPrinter::LineBreak" ref="a11f1b4804a460b175ec244eb5724d96d" args="()" -->
const char *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classTiXmlPrinter.html#a11f1b4804a460b175ec244eb5724d96d">LineBreak</a> ()</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Query the current line breaking string. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classTiXmlPrinter.html#ab23a90629e374cb1cadca090468bbd19">SetStreamPrinting</a> ()</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Switch over to "stream printing" which is the most dense formatting without linebreaks.  <a href="#ab23a90629e374cb1cadca090468bbd19"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a859eede9597d3e0355b77757be48735e"></a><!-- doxytag: member="TiXmlPrinter::CStr" ref="a859eede9597d3e0355b77757be48735e" args="()" -->
const char *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classTiXmlPrinter.html#a859eede9597d3e0355b77757be48735e">CStr</a> ()</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Return the result. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ad01375ae9199bd2f48252eaddce3039d"></a><!-- doxytag: member="TiXmlPrinter::Size" ref="ad01375ae9199bd2f48252eaddce3039d" args="()" -->
size_t&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classTiXmlPrinter.html#ad01375ae9199bd2f48252eaddce3039d">Size</a> ()</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Return the length of the result string. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a3bd4daf44309b41f5813a833caa0d1c9"></a><!-- doxytag: member="TiXmlPrinter::Str" ref="a3bd4daf44309b41f5813a833caa0d1c9" args="()" -->
const std::string &amp;&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classTiXmlPrinter.html#a3bd4daf44309b41f5813a833caa0d1c9">Str</a> ()</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Return the result. <br/></td></tr>
</table>
<hr/><a name="_details"></a><h2>Detailed Description</h2>
<p>Print to memory functionality. </p>
<p>The <a class="el" href="classTiXmlPrinter.html" title="Print to memory functionality.">TiXmlPrinter</a> is useful when you need to:</p>
<ol type="1">
<li>Print to memory (especially in non-STL mode)</li>
<li>Control formatting (line endings, etc.)</li>
</ol>
<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>
<p><a class="el" href="classTiXmlPrinter.html" title="Print to memory functionality.">TiXmlPrinter</a> uses the Visitor API. </p>
<div class="fragment"><pre class="fragment">
	TiXmlPrinter printer;
	printer.SetIndent( "\t" );

	doc.Accept( &amp;printer );
	fprintf( stdout, "%s", printer.CStr() );
	</pre></div> <hr/><h2>Member Function Documentation</h2>
<a class="anchor" id="a213377a4070c7e625bae59716b089e5e"></a><!-- doxytag: member="TiXmlPrinter::SetIndent" ref="a213377a4070c7e625bae59716b089e5e" args="(const char *_indent)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void TiXmlPrinter::SetIndent </td>
          <td>(</td>
          <td class="paramtype">const char *&nbsp;</td>
          <td class="paramname"> <em>_indent</em></td>
          <td>&nbsp;)&nbsp;</td>
          <td><code> [inline]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Set the indent characters for printing. </p>
<p>By default 4 spaces but tab () is also useful, or null/empty string for no indentation. </p>

</div>
</div>
<a class="anchor" id="a4be1e37e69e3858c59635aa947174fe6"></a><!-- doxytag: member="TiXmlPrinter::SetLineBreak" ref="a4be1e37e69e3858c59635aa947174fe6" args="(const char *_lineBreak)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void TiXmlPrinter::SetLineBreak </td>
          <td>(</td>
          <td class="paramtype">const char *&nbsp;</td>
          <td class="paramname"> <em>_lineBreak</em></td>
          <td>&nbsp;)&nbsp;</td>
          <td><code> [inline]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Set the line breaking string. </p>
<p>By default set to newline (<br/>
). Some operating systems prefer other characters, or can be set to the null/empty string for no indenation. </p>

</div>
</div>
<a class="anchor" id="ab23a90629e374cb1cadca090468bbd19"></a><!-- doxytag: member="TiXmlPrinter::SetStreamPrinting" ref="ab23a90629e374cb1cadca090468bbd19" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void TiXmlPrinter::SetStreamPrinting </td>
          <td>(</td>
          <td class="paramname"></td>
          <td>&nbsp;)&nbsp;</td>
          <td><code> [inline]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Switch over to "stream printing" which is the most dense formatting without linebreaks. </p>
<p>Common when the XML is needed for network transmission. </p>

</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li><a class="el" href="tinyxml_8h_source.html">tinyxml.h</a></li>
</ul>
</div>
<hr size="1"/><address style="text-align: right;"><small>Generated by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.2 </small></address>
</body>
</html>
bgstack15