QXmlInputSource(3qt)
β¨ QXmlInputSource π β like, the whole entire manual page, bestie
okay so welcome to qxmlinputsource.3qt, the Qt 3 man page for QXmlInputSource, and honestly? she's a baddie. let's get into it π«Ά
πΈ NAME πΈ
QXmlInputSource β the input data for the QXmlReader subclasses. that's it, that's the whole job, and she does it flawlessly π
π SYNOPSIS π
okay so first things first, the reentrancy tea β:
All the functions in this class are reentrant when Qt is built with thread support.</p>
(yeah there's a stray </p> in there, i'm not touching it, it's part of the lore π)
and the include, periodt:
#include <qxml.h>
π Public Members π
QXmlInputSource ()QXmlInputSource ( QIODevice * dev )QXmlInputSource ( QFile & file )β (obsolete)QXmlInputSource ( QTextStream & stream )β (obsolete)virtual ~QXmlInputSource ()virtual void setData ( const QString & dat )virtual void setData ( const QByteArray & dat )virtual void fetchData ()virtual QString data ()virtual QChar next ()virtual void reset ()
π§ Protected Members π§
virtual QString fromRawData ( const QByteArray & data, bool beginning = FALSE )
π DESCRIPTION π
so the QXmlInputSource class provides the input data for the QXmlReader subclasses. she's literally the snack table at the party, everyone comes to her π
all subclasses of QXmlReader read the input XML document from this class. no cap.
now, the encoding situation, and this is the part that's giving genius β¨: 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. but if it does not find an encoding declaration? then it assumes the data is either in UTF-8 or UTF-16, depending on whether it can find a byte-order mark. she's out here doing detective work fr fr π
there are two ways to populate the input source with data:
- you can construct it with a
QIODevice*so that the input source reads the data from that device. - or you can set the data explicitly with one of the
setData()functions.
usually you either construct a QXmlInputSource that works on a QIODevice*, or you construct an empty QXmlInputSource and set the data with setData(). there are only rare occasions where you would want to mix both methods. like, mixing them is giving chaotic energy, and not the cute kind π
the QXmlReader subclasses use the next() function to read the input character by character. character. by. character. slow and steady, main character energy π’β¨ and if you want to start from the beginning again, use reset().
the functions data() and fetchData() are useful if you want to do something with the data other than parsing, e.g. displaying the raw XML file. and the benefit of using the QXmlInputClass in such cases is that it tries to use the correct encoding. she's thoughtful like that π
See also QXmlReader, QXmlSimpleReader, and XML.
π MEMBER FUNCTION DOCUMENTATION π
QXmlInputSource::QXmlInputSource ()
constructs an input source which contains no data. empty. blank. a fresh canvas, bestie π¨
See also setData().
QXmlInputSource::QXmlInputSource ( QIODevice * dev )
constructs an input source and gets the data from device dev. if dev is not open, it is opened in read-only mode. and if dev is 0 or it is not possible to read from the device, the input source will contain no data. sad girl hours but okay π
See also setData(), fetchData(), and QIODevice.
QXmlInputSource::QXmlInputSource ( QFile & file )
β οΈ This function is obsolete. it is provided to keep old source working. we strongly advise against using it in new code. like, please don't, i'm begging π
constructs an input source and gets the data from the file file. if the file cannot be read the input source is empty.
QXmlInputSource::QXmlInputSource ( QTextStream & stream )
β οΈ This function is obsolete. it is provided to keep old source working. we strongly advise against using it in new code. same warning, same energy π
constructs an input source and gets the data from the text stream stream.
QString QXmlInputSource::data () [virtual]
returns the data the input source contains, or QString::null if the input source does not contain any data. so if you get QString::null back, she's got nothing for you, no thoughts head empty π«
See also setData(), QXmlInputSource(), and fetchData().
void QXmlInputSource::fetchData () [virtual]
this function reads more data from the device that was set during construction. and if the input source already contained data, this function deletes that data first. out with the old, in with the new, no nostalgia π§Ήβ¨
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.
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
- during a call to
next()β if the data had run out
you don't normally need to use this function if you use next(). she handles it, trust π
See also data(), next(), and QXmlInputSource().
QString QXmlInputSource::fromRawData ( const QByteArray & data, bool beginning = FALSE ) [virtual protected]
this function reads the XML file from data and tries to recognize the encoding. it converts the raw data data into a QString and returns it. it tries its best to get the correct encoding for the XML file. she's doing her best and her best is iconic π₯
if beginning is TRUE, this function assumes that the data starts at the beginning of a new XML document and looks for an encoding declaration. if beginning is FALSE, it converts the raw data using the encoding determined from prior calls. iykyk π§ β¨
QChar QXmlInputSource::next () [virtual]
returns the next character of the input source. one (1) single character, bestie, we're going one at a time here π
if this function reaches the end of available data, it returns QXmlInputSource::EndOfData. and if you call next() after that, it tries to fetch more data by calling fetchData(). if the fetchData() call results in new data, this function returns the first character of that data; otherwise it returns QXmlInputSource::EndOfDocument. the end. truly the end. π
See also reset(), fetchData(), QXmlSimpleReader::parse(), and QXmlSimpleReader::parseContinue().
void QXmlInputSource::reset () [virtual]
this function sets the position used by next() to the beginning of the data returned by data(). this is useful if you want to use the input source for more than one parse. rewind, rewatch, re-parse, the rewatch culture is real π¬π
See also next().
Example: xml/tagreader-with-features/tagreader.cpp.
void QXmlInputSource::setData ( const QString & dat ) [virtual]
sets the data of the input source to dat.
if the input source already contains data, this function deletes that data first. ruthless. efficient. we stan π«Ά
See also data().
void QXmlInputSource::setData ( const QByteArray & dat ) [virtual]
this is an overloaded member function, provided for convenience. it behaves essentially like the above function.
the data dat is passed through the correct text-codec, before it is set. codec glow-up, slay β¨
π¦ SEE ALSO π¦
π COPYRIGHT π
Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the license file included in the distribution for a complete license statement.
πΈ AUTHOR πΈ
Generated automatically from the source code. (she wrote herself, main character behavior, honestly iconic π )
π BUGS π
if you find a bug in Qt, please report it as described in http://doc.trolltech.com/bughowto.html. good bug reports help us to help you. Thank you. π«Ά
the definitive Qt documentation is provided in HTML format; it is located at $QTDIR/doc/html and can be read using Qt Assistant or with a web browser. this man page is provided as a convenience for those users who prefer man pages, although this format is not officially supported by Trolltech. so like, it's a vibe, not a contract, ok? π
if you find errors in this manual page, please report them to qt-bugs@trolltech.com. please include the name of the manual page (qxmlinputsource.3qt) and the Qt version (3.3.8).
and that's the whole thing bestie!! this was Trolltech AS, dated 2 February 2007, living in Qt 3.3.8 era, and honestly? she ate and left no crumbs. mwah πβ¨ bye pookie π¦π
π¦ where this page comes from
- fedora 43: qt3-devel-docs 3.3.8b-102.fc43 Β· QPL-1.0 OR GPL-2.0-only OR GPL-3.0-only
- fedora 44: qt3-devel-docs 3.3.8b-103.fc44 Β· QPL-1.0 OR GPL-2.0-only OR GPL-3.0-only
- Copyright 1992-2007 Trolltech ASA. All rights reserved. See the
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms