45 #include <QtCore/qiodevice.h> 47 #ifndef QT_NO_XMLSTREAM 49 #include <QtCore/qstring.h> 50 #include <QtCore/qvector.h> 51 #include <QtCore/qscopedpointer.h> 88 #if defined(Q_OS_MAC32) || defined(Q_OS_AIX) 89 # if !defined QT_BUILD_XML_LIB 90 # define Q_XMLSTREAM_RENAME_SYMBOLS 94 #if defined QT_BUILD_XML_LIB 95 # define Q_XMLSTREAM_EXPORT Q_XML_EXPORT 97 # define Q_XMLSTREAM_EXPORT Q_CORE_EXPORT 100 #if defined Q_XMLSTREAM_RENAME_SYMBOLS 102 # define QXmlStreamAttribute QCoreXmlStreamAttribute 103 # define QXmlStreamAttributes QCoreXmlStreamAttributes 104 # define QXmlStreamEntityDeclaration QCoreXmlStreamEntityDeclaration 105 # define QXmlStreamEntityDeclarations QCoreXmlStreamEntityDeclarations 106 # define QXmlStreamEntityResolver QCoreXmlStreamEntityResolver 107 # define QXmlStreamNamespaceDeclaration QCoreXmlStreamNamespaceDeclaration 108 # define QXmlStreamNamespaceDeclarations QCoreXmlStreamNamespaceDeclarations 109 # define QXmlStreamNotationDeclaration QCoreXmlStreamNotationDeclaration 110 # define QXmlStreamNotationDeclarations QCoreXmlStreamNotationDeclarations 111 # define QXmlStreamReader QCoreXmlStreamReader 112 # define QXmlStreamStringRef QCoreXmlStreamStringRef 113 # define QXmlStreamWriter QCoreXmlStreamWriter 122 :m_string(aString.string()?*aString.string():
QString()), m_position(aString.
position()), m_size(aString.size()){}
125 inline void clear() { m_string.
clear(); m_position = m_size = 0; }
129 inline int size()
const {
return m_size; }
183 return !
value(qualifiedName).isNull();
188 return !
value(qualifiedName).isNull();
193 return !
value(namespaceUri, name).isNull();
196 #if !defined(Q_NO_USING_KEYWORD) 271 && value() == other.
value());
289 #ifndef QT_NO_XMLSTREAMREADER 291 QDOC_PROPERTY(
bool namespaceProcessing READ namespaceProcessing WRITE setNamespaceProcessing)
304 ProcessingInstruction
319 void addData(
const char *
data);
326 bool readNextStartElement();
327 void skipCurrentElement();
332 void setNamespaceProcessing(
bool);
333 bool namespaceProcessing()
const;
341 bool isCDATA()
const;
343 inline bool isDTD()
const {
return tokenType() == DTD; }
347 bool isStandaloneDocument()
const;
351 qint64 lineNumber()
const;
352 qint64 columnNumber()
const;
353 qint64 characterOffset()
const;
370 QStringRef processingInstructionTarget()
const;
375 QXmlStreamNamespaceDeclarations namespaceDeclarations()
const;
377 void addExtraNamespaceDeclarations(
const QXmlStreamNamespaceDeclarations &extraNamespaceDeclaractions);
378 QXmlStreamNotationDeclarations notationDeclarations()
const;
379 QXmlStreamEntityDeclarations entityDeclarations()
const;
390 PrematureEndOfDocumentError
410 #endif // QT_NO_XMLSTREAMREADER 412 #ifndef QT_NO_XMLSTREAMWRITER 418 QDOC_PROPERTY(
bool autoFormatting READ autoFormatting WRITE setAutoFormatting)
419 QDOC_PROPERTY(
int autoFormattingIndent READ autoFormattingIndent WRITE setAutoFormattingIndent)
430 #ifndef QT_NO_TEXTCODEC 432 void setCodec(
const char *codecName);
436 void setAutoFormatting(
bool);
437 bool autoFormatting()
const;
439 void setAutoFormattingIndent(
int spacesOrTabs);
440 int autoFormattingIndent()
const;
448 void writeCharacters(
const QString &text);
449 void writeComment(
const QString &text);
451 void writeDTD(
const QString &dtd);
453 void writeEmptyElement(
const QString &qualifiedName);
454 void writeEmptyElement(
const QString &namespaceUri,
const QString &name);
456 void writeTextElement(
const QString &qualifiedName,
const QString &text);
459 void writeEndDocument();
460 void writeEndElement();
462 void writeEntityReference(
const QString &name);
464 void writeDefaultNamespace(
const QString &namespaceUri);
467 void writeStartDocument();
468 void writeStartDocument(
const QString &version);
469 void writeStartDocument(
const QString &version,
bool standalone);
470 void writeStartElement(
const QString &qualifiedName);
471 void writeStartElement(
const QString &namespaceUri,
const QString &name);
473 #ifndef QT_NO_XMLSTREAMREADER 477 bool hasError()
const;
484 #endif // QT_NO_XMLSTREAMWRITER 490 #endif // QT_NO_XMLSTREAM 491 #endif // QXMLSTREAM_H
The QXmlStreamWriter class provides an XML writer with a simple streaming API.
bool isEndDocument() const
Returns true if tokenType() equals EndDocument ; otherwise returns false.
#define QT_END_NAMESPACE
This macro expands to.
QVector< QXmlStreamNamespaceDeclaration > QXmlStreamNamespaceDeclarations
#define QDOC_PROPERTY(text)
bool operator==(const QXmlStreamEntityDeclaration &other) const
Compares this entity declaration with other and returns true if they are equal; otherwise returns fal...
QStringRef systemId() const
Returns the system identifier.
The QXmlStreamEntityDeclaration class represents a DTD entity declaration.
bool operator!=(const QXmlStreamNamespaceDeclaration &other) const
Compares this namespace declaration with other and returns true if they are not equal; otherwise retu...
The QByteArray class provides an array of bytes.
The QXmlStreamNotationDeclaration class represents a DTD notation declaration.
static qreal position(QGraphicsObject *item, QDeclarativeAnchorLine::AnchorLine anchorLine)
QStringRef value() const
Returns the attribute's value.
static void clear(QVariant::Private *d)
bool isEndElement() const
Returns true if tokenType() equals EndElement ; otherwise returns false.
static bool isWhitespace(char c)
#define Q_DISABLE_COPY(Class)
Disables the use of copy constructors and assignment operators for the given Class.
const QString * string() const
The QString class provides a Unicode character string.
bool isStartDocument() const
Returns true if tokenType() equals StartDocument ; otherwise returns false.
The QVector class is a template class that provides a dynamic array.
TokenType
This enum specifies the type of token the reader just read.
bool isCharacters() const
Returns true if tokenType() equals Characters ; otherwise returns false.
QStringRef qualifiedName() const
Returns the attribute's qualified name.
bool operator==(const QXmlStreamAttribute &other) const
Compares this attribute with other and returns true if they are equal; otherwise returns false...
QXmlStreamStringRef m_value
bool operator==(const QXmlStreamNamespaceDeclaration &other) const
Compares this namespace declaration with other and returns true if they are equal; otherwise returns ...
bool hasAttribute(const QString &qualifiedName) const
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
bool operator!=(const QXmlStreamNotationDeclaration &other) const
Compares this notation declaration with other and returns true if they are not equal; otherwise retur...
The QScopedPointer class stores a pointer to a dynamically allocated object, and deletes it upon dest...
QStringRef value(const QString &namespaceUri, const QString &name) const
Returns the value of the attribute name in the namespace described with namespaceUri, or an empty string reference if the attribute is not defined.
Q_GUI_EXPORT QString errorString(EGLint code=eglGetError())
bool isComment() const
Returns true if tokenType() equals Comment ; otherwise returns false.
The QXmlStreamAttribute class represents a single XML attribute.
#define QT_BEGIN_NAMESPACE
This macro expands to.
QStringRef publicId() const
Returns the public identifier.
QStringRef systemId() const
Returns the system identifier.
bool operator!=(const QXmlStreamAttribute &other) const
Compares this attribute with other and returns true if they are not equal; otherwise returns false...
The QXmlStreamEntityResolver class provides an entity resolver for a QXmlStreamReader.
QXmlStreamStringRef(const QStringRef &aString)
T value(int i) const
Returns the value at index position i in the vector.
QXmlStreamStringRef m_systemId
ReadElementTextBehaviour
This enum specifies the different behaviours of readElementText().
bool hasError() const
Returns true if an error has occurred, otherwise false.
bool isEntityReference() const
Returns true if tokenType() equals EntityReference ; otherwise returns false.
void append(const T &t)
Inserts value at the end of the vector.
static const char * data(const QByteArray &arr)
The QLatin1String class provides a thin wrapper around an US-ASCII/Latin-1 encoded string literal...
static QTextCodec * codec(MYSQL *mysql)
QStringRef namespaceUri() const
Returns the namespaceUri.
QStringRef prefix() const
Returns the prefix.
QXmlStreamStringRef(const QString &aString)
QVector< QXmlStreamAttribute > & operator=(const QVector< QXmlStreamAttribute > &v)
Assigns other to this vector and returns a reference to this vector.
QStringRef name() const
Returns the attribute's local name.
bool hasAttribute(const QLatin1String &qualifiedName) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
handler setDevice(device)
QVector< QXmlStreamNotationDeclaration > QXmlStreamNotationDeclarations
bool operator!=(const QXmlStreamEntityDeclaration &other) const
Compares this entity declaration with other and returns true if they are not equal; otherwise returns...
The QStringRef class provides a thin wrapper around QString substrings.
bool isStartElement() const
Returns true if tokenType() equals StartElement ; otherwise returns false.
QStringRef name() const
Returns the notation name.
static QChar resolveEntity(const QString &entity)
The QXmlStreamNamespaceDeclaration class represents a namespace declaration.
bool isDTD() const
Returns true if tokenType() equals DTD ; otherwise returns false.
The QXmlStreamAttributes class represents a vector of QXmlStreamAttribute.
void clear()
Clears the contents of the string and makes it empty.
bool operator==(const QXmlStreamNotationDeclaration &other) const
Compares this notation declaration with other and returns true if they are equal; otherwise returns f...
bool isDefault() const
Returns true if the parser added this attribute with a default value following an ATTLIST declaration...
QStringRef notationName() const
Returns the notation name.
Error
This enum specifies different error cases.
QVector< QXmlStreamEntityDeclaration > QXmlStreamEntityDeclarations
QXmlStreamStringRef m_value
QStringRef prefix() const
Returns the attribute's namespace prefix.
QStringRef name() const
Returns the entity name.
QStringRef publicId() const
Returns the public identifier.
QXmlStreamStringRef m_prefix
#define Q_DECLARE_PRIVATE(Class)
QStringRef value() const
Returns the entity's value.
The QXmlStreamReader class provides a fast parser for reading well-formed XML via a simple streaming ...
Q_DECLARE_TYPEINFO(QXmlStreamAttribute, Q_MOVABLE_TYPE)
The QTextCodec class provides conversions between text encodings.
The QIODevice class is the base interface class of all I/O devices in Qt.
bool hasAttribute(const QString &namespaceUri, const QString &name) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
#define Q_XMLSTREAM_EXPORT
bool operator==(QBool b1, bool b2)
bool isProcessingInstruction() const
Returns true if tokenType() equals ProcessingInstruction ; otherwise returns false.
QStringRef namespaceUri() const
Returns the attribute's resolved namespaceUri, or an empty string reference if the attribute does not...