mirror of
https://bitbucket.org/smil3y/katie.git
synced 2025-02-25 03:12:56 +00:00
simplify XML stream reader token string table
Signed-off-by: Ivailo Monev <xakepa10@laimg.moc>
This commit is contained in:
parent
fbe2c7227b
commit
86c8276b8e
1 changed files with 14 additions and 50 deletions
|
@ -671,56 +671,21 @@ void QXmlStreamReader::skipCurrentElement()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
// order must be the same as the enums
|
||||||
* Use the following Perl script to generate the error string index list:
|
static const QLatin1String QXmlStreamReader_tokenTypeString[11] = {
|
||||||
===== PERL SCRIPT ====
|
QLatin1String("NoToken\0"),
|
||||||
print "static const char QXmlStreamReader_tokenTypeString_string[] =\n";
|
QLatin1String("Invalid\0"),
|
||||||
$counter = 0;
|
QLatin1String("StartDocument\0"),
|
||||||
$i = 0;
|
QLatin1String("EndDocument\0"),
|
||||||
while (<STDIN>) {
|
QLatin1String("StartElement\0"),
|
||||||
chomp;
|
QLatin1String("EndElement\0"),
|
||||||
print " \"$_\\0\"\n";
|
QLatin1String("Characters\0"),
|
||||||
$sizes[$i++] = $counter;
|
QLatin1String("Comment\0"),
|
||||||
$counter += length 1 + $_;
|
QLatin1String("DTD\0"),
|
||||||
}
|
QLatin1String("EntityReference\0"),
|
||||||
print " \"\\0\";\n\nstatic const short QXmlStreamReader_tokenTypeString_indices[] = {\n ";
|
QLatin1String("ProcessingInstruction\0")
|
||||||
for ($j = 0; $j < $i; ++$j) {
|
|
||||||
printf "$sizes[$j], ";
|
|
||||||
}
|
|
||||||
print "0\n};\n";
|
|
||||||
===== PERL SCRIPT ====
|
|
||||||
|
|
||||||
* The input data is as follows (copied from qxmlstream.h):
|
|
||||||
NoToken
|
|
||||||
Invalid
|
|
||||||
StartDocument
|
|
||||||
EndDocument
|
|
||||||
StartElement
|
|
||||||
EndElement
|
|
||||||
Characters
|
|
||||||
Comment
|
|
||||||
DTD
|
|
||||||
EntityReference
|
|
||||||
ProcessingInstruction
|
|
||||||
*/
|
|
||||||
static const char QXmlStreamReader_tokenTypeString_string[] =
|
|
||||||
"NoToken\0"
|
|
||||||
"Invalid\0"
|
|
||||||
"StartDocument\0"
|
|
||||||
"EndDocument\0"
|
|
||||||
"StartElement\0"
|
|
||||||
"EndElement\0"
|
|
||||||
"Characters\0"
|
|
||||||
"Comment\0"
|
|
||||||
"DTD\0"
|
|
||||||
"EntityReference\0"
|
|
||||||
"ProcessingInstruction\0";
|
|
||||||
|
|
||||||
static const short QXmlStreamReader_tokenTypeString_indices[] = {
|
|
||||||
0, 8, 16, 30, 42, 55, 66, 77, 85, 89, 105, 0
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\property QXmlStreamReader::namespaceProcessing
|
\property QXmlStreamReader::namespaceProcessing
|
||||||
the namespace-processing flag of the stream reader
|
the namespace-processing flag of the stream reader
|
||||||
|
@ -752,8 +717,7 @@ bool QXmlStreamReader::namespaceProcessing() const
|
||||||
QString QXmlStreamReader::tokenString() const
|
QString QXmlStreamReader::tokenString() const
|
||||||
{
|
{
|
||||||
Q_D(const QXmlStreamReader);
|
Q_D(const QXmlStreamReader);
|
||||||
return QLatin1String(QXmlStreamReader_tokenTypeString_string +
|
return QXmlStreamReader_tokenTypeString[d->type];
|
||||||
QXmlStreamReader_tokenTypeString_indices[d->type]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // QT_NO_XMLSTREAMREADER
|
#endif // QT_NO_XMLSTREAMREADER
|
||||||
|
|
Loading…
Add table
Reference in a new issue