Qt 4.8
Functions
qscriptxmlparser.cpp File Reference
#include "qscriptxmlparser_p.h"
#include <QtCore/qstringlist.h>
#include <QtCore/qxmlstream.h>
#include <QtCore/qdebug.h>

Go to the source code of this file.

Functions

static void tokenUntil (QXmlStreamReader &reader, QXmlStreamReader::TokenType target, QList< int > &lineNumbers)
 

Function Documentation

◆ tokenUntil()

static void tokenUntil ( QXmlStreamReader reader,
QXmlStreamReader::TokenType  target,
QList< int > &  lineNumbers 
)
static

Definition at line 50 of file qscriptxmlparser.cpp.

Referenced by QScriptXmlParser::parse().

52 {
53  int level = 0;
54  while (!reader.atEnd()) {
56  if ((t == target) && (level == 0))
57  return;
59  ++level;
60  QString line = reader.attributes().value(QLatin1String("line")).toString();
61  if (!line.isEmpty())
62  lineNumbers.append(line.toInt());
63  } else if (t == QXmlStreamReader::EndElement) {
64  --level;
65  }
66  }
67 // Q_ASSERT_X(false, "QScriptXmlParser", "premature end of file");
68 }
QString toString() const
Returns a copy of the string reference as a QString object.
Definition: qstring.cpp:8653
int toInt(bool *ok=0, int base=10) const
Returns the string converted to an int using base base, which is 10 by default and must be between 2 ...
Definition: qstring.cpp:6090
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
bool atEnd() const
Returns true if the reader has read until the end of the XML document, or if an error() has occurred ...
Definition: qxmlstream.cpp:590
The QString class provides a Unicode character string.
Definition: qstring.h:83
TokenType
This enum specifies the type of token the reader just read.
Definition: qxmlstream.h:293
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.
void append(const T &t)
Inserts value at the end of the list.
Definition: qlist.h:507
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
Definition: qstring.h:704
TokenType readNext()
Reads the next token and returns its type.
Definition: qxmlstream.cpp:623
QXmlStreamAttributes attributes() const
Returns the attributes of a StartElement.