OSDN Git Service

Move the directories
[kita/kita.git] / src / libkita / access.h
diff --git a/src/libkita/access.h b/src/libkita/access.h
new file mode 100644 (file)
index 0000000..43d06d7
--- /dev/null
@@ -0,0 +1,93 @@
+/***************************************************************************
+*   Copyright (C) 2004 by Kita Developers                                 *
+*   ikemo@users.sourceforge.jp                                            *
+*                                                                         *
+*   This program is free software; you can redistribute it and/or modify  *
+*   it under the terms of the GNU General Public License as published by  *
+*   the Free Software Foundation; either version 2 of the License, or     *
+*   (at your option) any later version.                                   *
+***************************************************************************/
+#ifndef KITAACCESS_H
+#define KITAACCESS_H
+
+#include <QtCore/QObject>
+
+#include <kurl.h>
+
+class KJob;
+namespace KIO
+{
+    class Job;
+}
+
+namespace Kita
+{
+    class Thread;
+
+    /**
+    @author Hideki Ikemoto
+    */
+    class Access : public QObject
+    {
+        Q_OBJECT
+
+    public:
+        Access(const KUrl& datUrl);
+        virtual ~Access() {};
+
+        void init();
+        QString get();
+        void killJob();
+        void stopJob();
+        int serverTime();
+        void getcache();
+        bool getupdate(int readNum);
+        int responseCode();
+        int dataSize() const;
+        bool invalidDataReceived() const;
+
+    protected:
+        void writeCacheData();
+        void emitDatLineList(const QByteArray& dataStream);
+
+        const KUrl m_datUrl;
+        KIO::Job* m_currentJob;
+        QByteArray m_threadData;
+        QString m_header;
+        int m_dataSize;
+        bool m_firstReceive;
+        bool m_invalidDataReceived;
+        int m_bbstype;
+        int m_readNum;
+        QByteArray m_lastLine;
+
+    private slots:
+        void slotReceiveThreadData(KIO::Job* job, const QByteArray& data);
+        void slotThreadResult(KJob* job);
+
+    signals:
+        void redirection(const QString&);
+        void receiveData(const QStringList&);
+        void finishLoad();
+    private:
+        Access(const Access&);
+        Access& operator=(const Access&);
+    };
+
+    class OfflawAccess : public Access
+    {
+        Q_OBJECT
+
+    public:
+        OfflawAccess(const KUrl& datUrl) : Access(datUrl) {};
+        virtual ~OfflawAccess() {};
+
+        QString get();
+
+    private slots:
+        void slotReceiveThreadData(KIO::Job* job, const QByteArray& data);
+        void slotThreadResult(KIO::Job* job);
+    };
+}
+
+#endif