2 #include "location_p.h"
4 #include <QXmlStreamReader>
8 LocationPrivate::LocationPrivate( const QString &x, const QString &y, const QString &label ) :
17 LocationPrivate::LocationPrivate( const QString &label ) :
26 LocationPrivate::~LocationPrivate()
35 void LocationPrivate::parseReply( const QByteArray &reply )
37 qDebug() << "parsing";
38 QXmlStreamReader xml( reply );
40 while ( !xml.atEnd() ) {
42 if ( xml.isStartElement() && xml.name() == "LOC" ) {
43 QXmlStreamAttributes attributes( xml.attributes() );
44 QStringRef xAttribute( attributes.value("x") );
45 QStringRef yAttribute( attributes.value("y") );
46 QString newX( xAttribute.toString() );
47 QString newY( yAttribute.toString() );
54 if ( xml.hasError() ) {
55 qDebug() << "xml error";
58 qDebug() << "(" << m_x << "," << m_y << ")";
59 if ( m_x.isEmpty() || m_y.isEmpty() ) {
60 qDebug() << "is NOT valid";
63 qDebug() << "is now valid";
69 void LocationPrivate::setLabel( const QString &label)
74 QString LocationPrivate::label() const
79 void LocationPrivate::setAddress( const QString &address)
84 QString LocationPrivate::address() const
89 void LocationPrivate::setX( uint x )
91 m_x = QString( "%1" ).arg( x );
94 void LocationPrivate::setX( const QString &x )
99 QString LocationPrivate::x() const
104 void LocationPrivate::setY( uint y )
106 m_y = QString( "%1" ).arg( y );
109 void LocationPrivate::setY( const QString &y )
114 QString LocationPrivate::y() const
119 void LocationPrivate::setValid( bool valid )
124 bool LocationPrivate::isValid() const