Commit 8b247490 authored by Friedrich W. H. Kossebau's avatar Friedrich W. H. Kossebau
Browse files

Use QLatin1String with QXmlStreamAttributes::value

parent 468adca6
......@@ -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;
}
......
......@@ -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();
......
......@@ -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 );
}
......
......@@ -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));
}
......
......@@ -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
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment