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()
30 void LocationPrivate::parseReply( const QByteArray &reply )
32 qDebug() << "parsing";
33 QXmlStreamReader xml( reply );
35 while ( !xml.atEnd() ) {
37 if ( xml.isStartElement() && xml.name() == "LOC" ) {
38 QXmlStreamAttributes attributes( xml.attributes() );
39 QStringRef xAttribute( attributes.value("x") );
40 QStringRef yAttribute( attributes.value("y") );
41 QString newX( xAttribute.toString() );
42 QString newY( yAttribute.toString() );
49 if ( xml.hasError() ) {
50 qDebug() << "xml error";
53 qDebug() << "(" << m_x << "," << m_y << ")";
54 if ( m_x.isEmpty() || m_y.isEmpty() ) {
55 qDebug() << "is NOT valid";
58 qDebug() << "is now valid";
64 void LocationPrivate::setLabel( const QString &label)
69 QString LocationPrivate::label() const
74 void LocationPrivate::setAddress( const QString &address)
79 QString LocationPrivate::address() const
84 void LocationPrivate::setX( uint x )
86 m_x = QString( "%1" ).arg( x );
89 void LocationPrivate::setX( const QString &x )
94 QString LocationPrivate::x() const
99 void LocationPrivate::setY( uint y )
101 m_y = QString( "%1" ).arg( y );
104 void LocationPrivate::setY( const QString &y )
109 QString LocationPrivate::y() const
114 void LocationPrivate::setValid( bool valid )
119 bool LocationPrivate::isValid() const