summaryrefslogtreecommitdiffstats
path: root/src/corelib/mimetypes/qmimetypeparser.cpp
diff options
context:
space:
mode:
authorKarsten Heimrich <karsten.heimrich@qt.io>2020-08-12 11:58:54 +0200
committerKarsten Heimrich <karsten.heimrich@qt.io>2020-08-19 19:48:03 +0200
commita8028a02df32355f4df4c036dbb82e9f8e8d527f (patch)
treeca5ae77f5de57a7828a526d85e702e053b63e727 /src/corelib/mimetypes/qmimetypeparser.cpp
parenta2cec17407b83aed23b01065f4e10d32008552e1 (diff)
Port the QXmlStream API from QStringRef to QStringView
This gives some source incompatibilities, most of them can be handled by using auto instead of QStringRef explicitly. [ChangeLog][Important API changes] QXmlStream now uses QStringView insteead of QStringRef in it's API. Using auto forvariables returning a QStringRef in Qt 5 should lead to code that can be used against both Qt versions. Fixes: QTBUG-84317 Change-Id: I6df3a9507276f5d16d044a6bdbe0e4810cf99440 Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
Diffstat (limited to 'src/corelib/mimetypes/qmimetypeparser.cpp')
-rw-r--r--src/corelib/mimetypes/qmimetypeparser.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/corelib/mimetypes/qmimetypeparser.cpp b/src/corelib/mimetypes/qmimetypeparser.cpp
index dc1c444c56..aa5427b16a 100644
--- a/src/corelib/mimetypes/qmimetypeparser.cpp
+++ b/src/corelib/mimetypes/qmimetypeparser.cpp
@@ -107,7 +107,7 @@ static const char matchMaskAttributeC[] = "mask";
Overwrite to process the sequence of parsed data
*/
-QMimeTypeParserBase::ParseState QMimeTypeParserBase::nextState(ParseState currentState, const QStringRef &startElement)
+QMimeTypeParserBase::ParseState QMimeTypeParserBase::nextState(ParseState currentState, QStringView startElement)
{
switch (currentState) {
case ParseBeginning:
@@ -174,7 +174,7 @@ struct CreateMagicMatchRuleResult {
QString errorMessage; // must be first
QMimeMagicRule rule;
- CreateMagicMatchRuleResult(const QStringRef &type, const QStringRef &value, const QStringRef &offsets, const QStringRef &mask)
+ CreateMagicMatchRuleResult(QStringView type, QStringView value, QStringView offsets, QStringView mask)
: errorMessage(), rule(type.toString(), value.toUtf8(), offsets.toString(), mask.toLatin1(), &errorMessage)
{
@@ -183,10 +183,10 @@ struct CreateMagicMatchRuleResult {
static CreateMagicMatchRuleResult createMagicMatchRule(const QXmlStreamAttributes &atts)
{
- const QStringRef type = atts.value(QLatin1String(matchTypeAttributeC));
- const QStringRef value = atts.value(QLatin1String(matchValueAttributeC));
- const QStringRef offsets = atts.value(QLatin1String(matchOffsetAttributeC));
- const QStringRef mask = atts.value(QLatin1String(matchMaskAttributeC));
+ const auto type = atts.value(QLatin1String(matchTypeAttributeC));
+ const auto value = atts.value(QLatin1String(matchValueAttributeC));
+ const auto offsets = atts.value(QLatin1String(matchOffsetAttributeC));
+ const auto mask = atts.value(QLatin1String(matchMaskAttributeC));
return CreateMagicMatchRuleResult(type, value, offsets, mask);
}
#endif
@@ -265,7 +265,7 @@ bool QMimeTypeParserBase::parse(QIODevice *dev, const QString &fileName, QString
break;
case ParseMagic: {
priority = 50;
- const QStringRef priorityS = atts.value(QLatin1String(priorityAttributeC));
+ const auto priorityS = atts.value(QLatin1String(priorityAttributeC));
if (!priorityS.isEmpty()) {
if (!parseNumber(priorityS, &priority, errorMessage))
return false;
@@ -301,7 +301,7 @@ bool QMimeTypeParserBase::parse(QIODevice *dev, const QString &fileName, QString
// continue switch QXmlStreamReader::Token...
case QXmlStreamReader::EndElement: // Finished element
{
- const QStringRef elementName = reader.name();
+ const auto elementName = reader.name();
if (elementName == QLatin1String(mimeTypeTagC)) {
if (!process(QMimeType(data), errorMessage))
return false;