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
182
183
184
185
186
187
188
189
190
191
192
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>TQXmlInputSource Class</title>
<style type="text/css"><!--
fn { margin-left: 1cm; text-indent: -1cm; }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
body { background: #ffffff; color: black; }
--></style>
</head>
<body>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr bgcolor="#E5E5E5">
<td valign=center>
<a href="index.html">
<font color="#004faf">Home</font></a>
| <a href="classes.html">
<font color="#004faf">All Classes</font></a>
| <a href="mainclasses.html">
<font color="#004faf">Main Classes</font></a>
| <a href="annotated.html">
<font color="#004faf">Annotated</font></a>
| <a href="groups.html">
<font color="#004faf">Grouped Classes</font></a>
| <a href="functions.html">
<font color="#004faf">Functions</font></a>
</td>
<td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>TQXmlInputSource Class Reference<br><small>[<a href="xml.html">XML module</a>]</small></h1>
<p>The TQXmlInputSource class provides the input data for the
TQXmlReader subclasses.
<a href="#details">More...</a>
<p>All the functions in this class are <a href="threads.html#reentrant">reentrant</a> when TQt is built with thread support.</p>
<p><tt>#include <<a href="tqxml-h.html">tqxml.h</a>></tt>
<p><a href="tqxmlinputsource-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li class=fn><a href="#TQXmlInputSource"><b>TQXmlInputSource</b></a> ()</li>
<li class=fn><a href="#TQXmlInputSource-2"><b>TQXmlInputSource</b></a> ( TQIODevice * dev )</li>
<li class=fn>TQXmlInputSource ( TQFile & file ) <em>(obsolete)</em></li>
<li class=fn>TQXmlInputSource ( TQTextStream & stream ) <em>(obsolete)</em></li>
<li class=fn>virtual <a href="#~TQXmlInputSource"><b>~TQXmlInputSource</b></a> ()</li>
<li class=fn>virtual void <a href="#setData"><b>setData</b></a> ( const TQString & dat )</li>
<li class=fn>virtual void <a href="#setData-2"><b>setData</b></a> ( const TQByteArray & dat )</li>
<li class=fn>virtual void <a href="#fetchData"><b>fetchData</b></a> ()</li>
<li class=fn>virtual TQString <a href="#data"><b>data</b></a> ()</li>
<li class=fn>virtual TQChar <a href="#next"><b>next</b></a> ()</li>
<li class=fn>virtual void <a href="#reset"><b>reset</b></a> ()</li>
</ul>
<h2>Protected Members</h2>
<ul>
<li class=fn>virtual TQString <a href="#fromRawData"><b>fromRawData</b></a> ( const TQByteArray & data, bool beginning = FALSE )</li>
</ul>
<hr><a name="details"></a><h2>Detailed Description</h2>
The TQXmlInputSource class provides the input data for the
<a href="tqxmlreader.html">TQXmlReader</a> subclasses.
<p>
<p> All subclasses of TQXmlReader read the input XML document from this
class.
<p> This class recognizes the encoding of the data by reading the
encoding declaration in the XML file if it finds one, and reading
the data using the corresponding encoding. If it does not find an
encoding declaration, then it assumes that the data is either in
UTF-8 or UTF-16, depending on whether it can find a byte-order
mark.
<p> There are two ways to populate the input source with data: you can
construct it with a <a href="tqiodevice.html">TQIODevice</a>* so that the input source reads the
data from that device. Or you can set the data explicitly with one
of the <a href="#setData">setData</a>() functions.
<p> Usually you either construct a TQXmlInputSource that works on a
TQIODevice* or you construct an empty TQXmlInputSource and set the
data with setData(). There are only rare occasions where you would
want to mix both methods.
<p> The TQXmlReader subclasses use the <a href="#next">next</a>() function to read the
input character by character. If you want to start from the
beginning again, use <a href="#reset">reset</a>().
<p> The functions <a href="#data">data</a>() and <a href="#fetchData">fetchData</a>() are useful if you want to do
something with the data other than parsing, e.g. displaying the
raw XML file. The benefit of using the TQXmlInputClass in such
cases is that it tries to use the correct encoding.
<p> <p>See also <a href="tqxmlreader.html">TQXmlReader</a>, <a href="tqxmlsimplereader.html">TQXmlSimpleReader</a>, and <a href="xml-tools.html">XML</a>.
<hr><h2>Member Function Documentation</h2>
<h3 class=fn><a name="TQXmlInputSource"></a>TQXmlInputSource::TQXmlInputSource ()
</h3>
Constructs an input source which contains no data.
<p> <p>See also <a href="#setData">setData</a>().
<h3 class=fn><a name="TQXmlInputSource-2"></a>TQXmlInputSource::TQXmlInputSource ( <a href="tqiodevice.html">TQIODevice</a> * dev )
</h3>
Constructs an input source and gets the data from device <em>dev</em>.
If <em>dev</em> is not open, it is opened in read-only mode. If <em>dev</em>
is 0 or it is not possible to read from the device, the input
source will contain no data.
<p> <p>See also <a href="#setData">setData</a>(), <a href="#fetchData">fetchData</a>(), and <a href="tqiodevice.html">TQIODevice</a>.
<h3 class=fn><a name="TQXmlInputSource-3"></a>TQXmlInputSource::TQXmlInputSource ( <a href="tqfile.html">TQFile</a> & file )
</h3> <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
<p> Constructs an input source and gets the data from the file <em>file</em>. If the
file cannot be read the input source is empty.
<h3 class=fn><a name="TQXmlInputSource-4"></a>TQXmlInputSource::TQXmlInputSource ( <a href="tqtextstream.html">TQTextStream</a> & stream )
</h3> <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
<p> Constructs an input source and gets the data from the text stream <em>stream</em>.
<h3 class=fn><a name="~TQXmlInputSource"></a>TQXmlInputSource::~TQXmlInputSource ()<tt> [virtual]</tt>
</h3>
Destructor.
<h3 class=fn><a href="tqstring.html">TQString</a> <a name="data"></a>TQXmlInputSource::data ()<tt> [virtual]</tt>
</h3>
Returns the data the input source contains or <a href="tqstring.html#TQString-null">TQString::null</a> if the
input source does not contain any data.
<p> <p>See also <a href="#setData">setData</a>(), <a href="#TQXmlInputSource">TQXmlInputSource</a>(), and <a href="#fetchData">fetchData</a>().
<h3 class=fn>void <a name="fetchData"></a>TQXmlInputSource::fetchData ()<tt> [virtual]</tt>
</h3>
This function reads more data from the device that was set during
construction. If the input source already contained data, this
function deletes that data first.
<p> This object contains no data after a call to this function if the
object was constructed without a device to read data from or if
this function was not able to get more data from the device.
<p> There are two occasions where a fetch is done implicitly by
another function call: during construction (so that the object
starts out with some initial data where available), and during a
call to <a href="#next">next</a>() (if the data had run out).
<p> You don't normally need to use this function if you use next().
<p> <p>See also <a href="#data">data</a>(), <a href="#next">next</a>(), and <a href="#TQXmlInputSource">TQXmlInputSource</a>().
<h3 class=fn><a href="tqstring.html">TQString</a> <a name="fromRawData"></a>TQXmlInputSource::fromRawData ( const <a href="tqbytearray.html">TQByteArray</a> & data, bool beginning = FALSE )<tt> [virtual protected]</tt>
</h3>
This function reads the XML file from <em>data</em> and tries to
recognize the encoding. It converts the raw data <em>data</em> into a
<a href="tqstring.html">TQString</a> and returns it. It tries its best to get the correct
encoding for the XML file.
<p> If <em>beginning</em> is TRUE, this function assumes that the data
starts at the beginning of a new XML document and looks for an
encoding declaration. If <em>beginning</em> is FALSE, it converts the
raw data using the encoding determined from prior calls.
<h3 class=fn><a href="tqchar.html">TQChar</a> <a name="next"></a>TQXmlInputSource::next ()<tt> [virtual]</tt>
</h3>
Returns the next character of the input source. If this function
reaches the end of available data, it returns
TQXmlInputSource::EndOfData. If you call <a href="#next">next</a>() after that, it
tries to fetch more data by calling <a href="#fetchData">fetchData</a>(). If the
fetchData() call results in new data, this function returns the
first character of that data; otherwise it returns
TQXmlInputSource::EndOfDocument.
<p> <p>See also <a href="#reset">reset</a>(), <a href="#fetchData">fetchData</a>(), <a href="tqxmlsimplereader.html#parse">TQXmlSimpleReader::parse</a>(), and <a href="tqxmlsimplereader.html#parseContinue">TQXmlSimpleReader::parseContinue</a>().
<h3 class=fn>void <a name="reset"></a>TQXmlInputSource::reset ()<tt> [virtual]</tt>
</h3>
This function sets the position used by <a href="#next">next</a>() to the beginning of
the data returned by <a href="#data">data</a>(). This is useful if you want to use the
input source for more than one parse.
<p> <p>See also <a href="#next">next</a>().
<p>Example: <a href="tagreader-with-features-example.html#x1975">xml/tagreader-with-features/tagreader.cpp</a>.
<h3 class=fn>void <a name="setData"></a>TQXmlInputSource::setData ( const <a href="tqstring.html">TQString</a> & dat )<tt> [virtual]</tt>
</h3>
Sets the data of the input source to <em>dat</em>.
<p> If the input source already contains data, this function deletes
that data first.
<p> <p>See also <a href="#data">data</a>().
<h3 class=fn>void <a name="setData-2"></a>TQXmlInputSource::setData ( const <a href="tqbytearray.html">TQByteArray</a> & dat )<tt> [virtual]</tt>
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> The data <em>dat</em> is passed through the correct text-codec, before
it is set.
<!-- eof -->
<hr><p>
This file is part of the <a href="index.html">TQt toolkit</a>.
Copyright © 1995-2007
<a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
<table width=100% cellspacing=0 border=0><tr>
<td>Copyright © 2007
<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
<td align=right><div align=right>TQt 3.3.8</div>
</table></div></address></body>
</html>
|