// // This file is part of the Marble Desktop Globe. // // This program is free software licensed under the GNU LGPL. You can // find a copy of this license in LICENSE.txt in the top directory of // the source code. // // Copyright 2009 Bastian Holst // #ifndef BBCPARSER_H #define BBCPARSER_H // Marble #include "AbstractWorkerThread.h" #include "WeatherData.h" // Qt #include #include #include #include #include #include class QObject; namespace Marble { class BBCWeatherItem; struct ScheduleEntry { QString path; QPointer item; QString type; }; class BBCParser : public AbstractWorkerThread, public QXmlStreamReader { Q_OBJECT public: BBCParser( QObject *parent = 0 ); ~BBCParser(); static BBCParser *instance(); void scheduleRead( const QString& path, BBCWeatherItem *item, const QString& type ); protected: bool workAvailable(); void work(); Q_SIGNALS: void parsedFile(); private: QList read( QIODevice *device ); void readUnknownElement(); void readBBC(); void readChannel(); void readItem(); void readDescription( WeatherData *data ); void readTitle( WeatherData *data ); void readPubDate( WeatherData *data ); void setupHashes(); QList m_list; QStack m_schedule; static QHash dayConditions; static QHash nightConditions; static QHash windDirections; static QHash pressureDevelopments; static QHash visibilityStates; static QHash monthNames; }; } // Marble namespace #endif // BBCPARSER_H