File indexing completed on 2025-01-05 04:25:44

0001 /****************************************************************************************
0002  * Copyright (c) 2010 Rick W. Chen <stuffcorpse@archlinux.us>                           *
0003  *                                                                                      *
0004  * This program is free software; you can redistribute it and/or modify it under        *
0005  * the terms of the GNU General Public License as published by the Free Software        *
0006  * Foundation; either version 2 of the License, or (at your option) any later           *
0007  * version.                                                                             *
0008  *                                                                                      *
0009  * This program is distributed in the hope that it will be useful, but WITHOUT ANY      *
0010  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A      *
0011  * PARTICULAR PURPOSE. See the GNU General Public License for more details.             *
0012  *                                                                                      *
0013  * You should have received a copy of the GNU General Public License along with         *
0014  * this program.  If not, see <http://www.gnu.org/licenses/>.                           *
0015  ****************************************************************************************/
0016 
0017 #ifndef AMAROK_LASTFMEVENTXMLPARSER_H
0018 #define AMAROK_LASTFMEVENTXMLPARSER_H
0019 
0020 #include "LastFmEvent.h"
0021 
0022 #include <QString>
0023 #include <QXmlStreamReader>
0024 
0025 class LastFmEventXmlParser
0026 {
0027 public:
0028     explicit LastFmEventXmlParser( QXmlStreamReader &reader );
0029     ~LastFmEventXmlParser();
0030 
0031     bool read();
0032     LastFmEvent::List events() const { return m_events; }
0033     LastFmEvent::List events() { return m_events; }
0034 
0035 private:
0036     QHash<QString, QString> readEventArtists();
0037     QStringList readEventTags();
0038 
0039     QXmlStreamReader &m_xml;
0040     LastFmEvent::List m_events;
0041     Q_DISABLE_COPY( LastFmEventXmlParser )
0042 };
0043 
0044 class LastFmVenueXmlParser
0045 {
0046 public:
0047     explicit LastFmVenueXmlParser( QXmlStreamReader &reader );
0048     ~LastFmVenueXmlParser();
0049 
0050     bool read();
0051     LastFmVenuePtr venue() const { return m_venue; }
0052     LastFmVenuePtr venue() { return m_venue; }
0053 
0054 private:
0055     LastFmVenuePtr m_venue;
0056     QXmlStreamReader &m_xml;
0057     Q_DISABLE_COPY( LastFmVenueXmlParser )
0058 };
0059 
0060 class LastFmLocationXmlParser
0061 {
0062 public:
0063     explicit LastFmLocationXmlParser( QXmlStreamReader &reader );
0064     ~LastFmLocationXmlParser();
0065 
0066     bool read();
0067 
0068     LastFmLocationPtr location() const { return m_location; }
0069     LastFmLocationPtr location() { return m_location; }
0070 
0071 private:
0072     void readGeoPoint();
0073 
0074     LastFmLocationPtr m_location;
0075     QXmlStreamReader &m_xml;
0076     Q_DISABLE_COPY( LastFmLocationXmlParser )
0077 };
0078 
0079 #endif /* AMAROK_LASTFMEVENTXMLPARSER_H */