OSDN Git Service

Rename boardmanager.cpp and boardmanager.h
[kita/kita.git] / kita / src / libkita / access.h
1 /***************************************************************************
2 *   Copyright (C) 2004 by Kita Developers                                 *
3 *   ikemo@users.sourceforge.jp                                            *
4 *                                                                         *
5 *   This program is free software; you can redistribute it and/or modify  *
6 *   it under the terms of the GNU General Public License as published by  *
7 *   the Free Software Foundation; either version 2 of the License, or     *
8 *   (at your option) any later version.                                   *
9 ***************************************************************************/
10 #ifndef KITAACCESS_H
11 #define KITAACCESS_H
12
13 #include <QtCore/QObject>
14
15 #include <kurl.h>
16
17 class KJob;
18 namespace KIO
19 {
20     class Job;
21 }
22
23 namespace Kita
24 {
25     class Thread;
26
27     /**
28     @author Hideki Ikemoto
29     */
30     class Access : public QObject
31     {
32         Q_OBJECT
33
34     public:
35         Access(const KUrl& datUrl);
36         virtual ~Access() {};
37
38         void init();
39         QString get();
40         void killJob();
41         void stopJob();
42         int serverTime();
43         void getcache();
44         bool getupdate(int readNum);
45         int responseCode();
46         int dataSize() const;
47         bool invalidDataReceived() const;
48
49     protected:
50         void writeCacheData();
51         void emitDatLineList(const QByteArray& dataStream);
52
53         const KUrl m_datUrl;
54         KIO::Job* m_currentJob;
55         QByteArray m_threadData;
56         QString m_header;
57         int m_dataSize;
58         bool m_firstReceive;
59         bool m_invalidDataReceived;
60         int m_bbstype;
61         int m_readNum;
62         QByteArray m_lastLine;
63
64     private slots:
65         void slotReceiveThreadData(KIO::Job* job, const QByteArray& data);
66         void slotThreadResult(KJob* job);
67
68     signals:
69         void redirection(const QString&);
70         void receiveData(const QStringList&);
71         void finishLoad();
72     private:
73         Access(const Access&);
74         Access& operator=(const Access&);
75     };
76
77     class OfflawAccess : public Access
78     {
79         Q_OBJECT
80
81     public:
82         OfflawAccess(const KUrl& datUrl) : Access(datUrl) {};
83         virtual ~OfflawAccess() {};
84
85         QString get();
86
87     private slots:
88         void slotReceiveThreadData(KIO::Job* job, const QByteArray& data);
89         void slotThreadResult(KIO::Job* job);
90     };
91 }
92
93 #endif