OSDN Git Service

c6954bf4fefd2f2fd57d983a0c43cdf60d114c74
[kita/kita.git] / src / libkita / boarddatabase.h
1 /***************************************************************************
2 *   Copyright (C) 2010 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 KITABOARDDATABASE_H
11 #define KITABOARDDATABASE_H
12
13 #include "boarddata.h"
14
15 namespace Kita {
16     class Thread;
17
18     class KDE_EXPORT BoardDatabase
19     {
20         static BoardDataList m_boardDataList;
21         static BoardData* m_previousBoardData;
22         static QString m_previousBoardUrl;
23         static QTextCodec* m_cp932Codec;
24         static QTextCodec* m_eucJpCodec;
25         KUrl m_url;
26
27     public:
28         explicit BoardDatabase(const KUrl& url = KUrl());
29
30         void setUrl(const KUrl& url);
31         QString boardUrl();
32         QStringList allBoardUrlList();
33         QString boardRoot();
34         QString boardPath();
35         QString ext();
36         QString boardId();
37         QString subjectUrl();
38         QString boardName();
39         int type();
40
41         /* ThreadList */
42         void getThreadList(bool oldLogs, bool online,
43                 QList<Thread*>& threadList, QList<Thread*>& oldLogList);
44
45         /* BoardData */
46         void clearBoardData();
47         int enrollBoard(const QString& boardName, QString& oldUrl,
48                                 int type = Board_Unknown, bool test = false);
49         bool isEnrolled();
50         BoardData* getBoardData();
51
52         /* BBSHISTORY */
53         bool loadBBSHistory();
54         bool moveBoard(const KUrl& fromUrl, const KUrl& toUrl);
55
56     private:
57         /* BoardData */
58         BoardData* getBoardData(const KUrl& url);
59         int parseBoardUrl(int type, QString& hostname,
60                                   QString& rootPath, QString& delimiter,
61                                   QString& bbsPath, QString& ext);
62
63
64         /* ThreadList */
65         void getCachedThreadList(const KUrl& url, QList<Thread*>& threadList);
66         bool readSubjectTxt(BoardData* bdata, QList<Thread*>& threadList);
67
68
69         /* SETTING.TXT */
70         BoardData* openSettingTxt();
71     };
72 }
73
74 #endif