summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFriedrich W. H. Kossebau <kossebau@kde.org>2016-08-31 14:34:03 (GMT)
committerFriedrich W. H. Kossebau <kossebau@kde.org>2016-08-31 14:34:03 (GMT)
commit8b24749079ec9981c617f861cb7f3811e01d2cd2 (patch)
tree997fac2a658f2b77a5a8259e376e2e30d96e9957
parent468adca632813265130a7e37399ff20a7b6b0a41 (diff)
Use QLatin1String with QXmlStreamAttributes::value
-rw-r--r--src/lib/marble/osm/OsmPlacemarkData.cpp16
-rw-r--r--src/plugins/render/photo/CoordinatesParser.cpp6
-rw-r--r--src/plugins/render/photo/FlickrParser.cpp18
-rw-r--r--src/plugins/runner/osm/OsmNode.cpp4
-rw-r--r--src/plugins/runner/osm/OsmParser.cpp7
5 files changed, 26 insertions, 25 deletions
diff --git a/src/lib/marble/osm/OsmPlacemarkData.cpp b/src/lib/marble/osm/OsmPlacemarkData.cpp
index 09b7906..13f0204 100644
--- a/src/lib/marble/osm/OsmPlacemarkData.cpp
+++ b/src/lib/marble/osm/OsmPlacemarkData.cpp
@@ -294,14 +294,14 @@ bool OsmPlacemarkData::isEmpty() const
OsmPlacemarkData OsmPlacemarkData::fromParserAttributes( const QXmlStreamAttributes &attributes )
{
OsmPlacemarkData osmData;
- osmData.setId( attributes.value( "id" ).toLongLong() );
- osmData.setVersion( attributes.value( "version" ).toString() );
- osmData.setChangeset( attributes.value( "changeset" ).toString() );
- osmData.setUser( attributes.value( "user" ).toString() );
- osmData.setUid( attributes.value( "uid" ).toString() );
- osmData.setVisible( attributes.value( "visible" ).toString() );
- osmData.setTimestamp( attributes.value( "timestamp" ).toString() );
- osmData.setAction( attributes.value( "action" ).toString() );
+ osmData.setId(attributes.value(QLatin1String("id")).toLongLong());
+ osmData.setVersion(attributes.value(QLatin1String("version")).toString());
+ osmData.setChangeset(attributes.value(QLatin1String("changeset")).toString());
+ osmData.setUser(attributes.value(QLatin1String("user")).toString());
+ osmData.setUid(attributes.value(QLatin1String("uid")).toString());
+ osmData.setVisible(attributes.value(QLatin1String("visible")).toString());
+ osmData.setTimestamp(attributes.value(QLatin1String("timestamp")).toString());
+ osmData.setAction(attributes.value(QLatin1String("action")).toString());
return osmData;
}
diff --git a/src/plugins/render/photo/CoordinatesParser.cpp b/src/plugins/render/photo/CoordinatesParser.cpp
index fe3b63a..ba3adf7 100644
--- a/src/plugins/render/photo/CoordinatesParser.cpp
+++ b/src/plugins/render/photo/CoordinatesParser.cpp
@@ -30,7 +30,7 @@ bool CoordinatesParser::read( QIODevice *device )
if( isStartElement() ) {
if (name() == QLatin1String("rsp")) {
- if (attributes().value("stat") == QLatin1String("ok")) {
+ if (attributes().value(QLatin1String("stat")) == QLatin1String("ok")) {
readRsp();
} else {
raiseError(QObject::tr("Query failed"));
@@ -104,8 +104,8 @@ void CoordinatesParser::readLocation()
Q_ASSERT( isStartElement()
&& name() == QLatin1String("location"));
- m_coordinates->setLatitude( attributes().value( "latitude" ).toString().toDouble() * DEG2RAD );
- m_coordinates->setLongitude( attributes().value( "longitude" ).toString().toDouble() * DEG2RAD );
+ m_coordinates->setLatitude(attributes().value(QLatin1String("latitude")).toString().toDouble() * DEG2RAD);
+ m_coordinates->setLongitude(attributes().value(QLatin1String("longitude")).toString().toDouble() * DEG2RAD);
while( !atEnd() ) {
readNext();
diff --git a/src/plugins/render/photo/FlickrParser.cpp b/src/plugins/render/photo/FlickrParser.cpp
index 0af9c2f..94fbbf5 100644
--- a/src/plugins/render/photo/FlickrParser.cpp
+++ b/src/plugins/render/photo/FlickrParser.cpp
@@ -37,7 +37,7 @@ bool FlickrParser::read( QByteArray data )
if (isStartElement()) {
if (name() == QLatin1String("rsp")) {
- if (attributes().value("stat") == QLatin1String("ok")) {
+ if (attributes().value(QLatin1String("stat")) == QLatin1String("ok")) {
readFlickr();
} else {
raiseError(QObject::tr("Query failed"));
@@ -70,7 +70,7 @@ void FlickrParser::readFlickr()
{
Q_ASSERT( isStartElement()
&& name() == QLatin1String("rsp")
- && attributes().value( "stat" ) == QLatin1String("ok"));
+ && attributes().value(QLatin1String("stat")) == QLatin1String("ok"));
while( !atEnd() ) {
readNext();
@@ -112,14 +112,14 @@ void FlickrParser::readPhoto()
Q_ASSERT( isStartElement()
&& name() == QLatin1String("photo"));
- if( attributes().hasAttribute( "id" ) ) {
+ if( attributes().hasAttribute(QLatin1String("id")) ) {
PhotoPluginItem *item = new PhotoPluginItem( m_marbleWidget, m_parent );
- item->setId( attributes().value( "id" ).toString() );
- item->setServer( attributes().value( "server" ).toString() );
- item->setFarm( attributes().value( "farm" ).toString() );
- item->setSecret( attributes().value( "secret" ).toString() );
- item->setOwner( attributes().value( "owner" ).toString() );
- item->setTitle( attributes().value( "title" ).toString() );
+ item->setId( attributes().value(QLatin1String("id")).toString() );
+ item->setServer( attributes().value(QLatin1String("server")).toString() );
+ item->setFarm( attributes().value(QLatin1String("farm")).toString() );
+ item->setSecret( attributes().value(QLatin1String("secret")).toString() );
+ item->setOwner( attributes().value(QLatin1String("owner")).toString() );
+ item->setTitle( attributes().value(QLatin1String("title")).toString() );
m_list->append( item );
}
diff --git a/src/plugins/runner/osm/OsmNode.cpp b/src/plugins/runner/osm/OsmNode.cpp
index f0e18e0..db37dc1 100644
--- a/src/plugins/runner/osm/OsmNode.cpp
+++ b/src/plugins/runner/osm/OsmNode.cpp
@@ -23,8 +23,8 @@ namespace Marble {
void OsmNode::parseCoordinates(const QXmlStreamAttributes &attributes)
{
- qreal const lon = attributes.value( "lon" ).toDouble();
- qreal const lat = attributes.value( "lat" ).toDouble();
+ qreal const lon = attributes.value(QLatin1String("lon")).toDouble();
+ qreal const lat = attributes.value(QLatin1String("lat")).toDouble();
setCoordinates(GeoDataCoordinates(lon, lat, 0, GeoDataCoordinates::Degree));
}
diff --git a/src/plugins/runner/osm/OsmParser.cpp b/src/plugins/runner/osm/OsmParser.cpp
index 01a8ec8..69a0311 100644
--- a/src/plugins/runner/osm/OsmParser.cpp
+++ b/src/plugins/runner/osm/OsmParser.cpp
@@ -149,7 +149,7 @@ GeoDataDocument* OsmParser::parseXml(const QString &filename, QString &error)
QStringRef const tagName = parser.name();
if (tagName == osm::osmTag_node || tagName == osm::osmTag_way || tagName == osm::osmTag_relation) {
parentTag = parser.name().toString();
- parentId = parser.attributes().value("id").toLongLong();
+ parentId = parser.attributes().value(QLatin1String("id")).toLongLong();
if (tagName == osm::osmTag_node) {
m_nodes[parentId].osmData() = OsmPlacemarkData::fromParserAttributes(parser.attributes());
@@ -164,9 +164,10 @@ GeoDataDocument* OsmParser::parseXml(const QString &filename, QString &error)
osmData = &m_relations[parentId].osmData();
}
} else if (tagName == osm::osmTag_tag) {
- osmData->addTag(parser.attributes().value("k").toString(), parser.attributes().value("v").toString());
+ osmData->addTag(parser.attributes().value(QLatin1String("k")).toString(),
+ parser.attributes().value(QLatin1String("v")).toString());
} else if (tagName == osm::osmTag_nd && parentTag == osm::osmTag_way) {
- m_ways[parentId].addReference(parser.attributes().value("ref").toLongLong());
+ m_ways[parentId].addReference(parser.attributes().value(QLatin1String("ref")).toLongLong());
} else if (tagName == osm::osmTag_member && parentTag == osm::osmTag_relation) {
m_relations[parentId].parseMember(parser.attributes());
} // other tags like osm, bounds ignored