loader.h

00001 /*
00002  * loader.h
00003  *
00004  * Copyright (c) 2001, 2002, 2003 Frerich Raabe <raabe@kde.org>
00005  *
00006  * This program is distributed in the hope that it will be useful, but WITHOUT
00007  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00008  * FOR A PARTICULAR PURPOSE. For licensing and distribution details, check the
00009  * accompanying file 'COPYING'.
00010  */
00011 #ifndef SYNDICATION_LOADER_H
00012 #define SYNDICATION_LOADER_H
00013 
00014 #include <syndication/global.h>
00015 #include <boost/shared_ptr.hpp>
00016 
00017 #include "ksyndication_export.h"
00018 
00019 #include <QtCore/QObject>
00020 
00021 class KUrl;
00022 
00023 namespace Syndication {
00024 
00025 class DataRetriever;
00026 class Feed;
00027 //@cond PRIVATE
00028 typedef boost::shared_ptr<Feed> FeedPtr;
00029 //@endcond
00030 
00075 class SYNDICATION_EXPORT Loader : public QObject
00076 {
00077     Q_OBJECT
00078 
00079 
00080     public:
00081 
00090         static Loader* create();
00091 
00099         static Loader* create(QObject* object, const char* slot);
00100 
00116         void loadFrom(const KUrl& url, DataRetriever* retriever);
00117 
00124         void loadFrom(const KUrl& url);
00125 
00129         ErrorCode errorCode() const;
00130 
00136         int retrieverError() const;
00137 
00141         KUrl discoveredFeedURL() const;
00142 
00146         void abort();
00147 
00148     Q_SIGNALS:
00149 
00150 
00163         void loadingComplete(Syndication::Loader* loader,
00164                              Syndication::FeedPtr feed,
00165                              Syndication::ErrorCode error);
00166 
00167     private Q_SLOTS:
00168 
00169         void slotRetrieverDone(const QByteArray& data, bool success);
00170 
00171     private:
00172 
00173         Loader();
00174         Loader(const Loader& other);
00175         Loader& operator=(const Loader& other);
00176         ~Loader();
00177         void discoverFeeds(const QByteArray& data);
00178 
00179         struct LoaderPrivate;
00180         LoaderPrivate* const d;
00181 };
00182 
00183 
00184 } // namespace Syndication
00185 
00186 #endif // SYNDICATION_LOADER_H
KDE Home | KDE Accessibility Home | Description of Access Keys