OSDN Git Service

Rename boardmanager.cpp and boardmanager.h
[kita/kita.git] / kita / src / libkita / boarddata.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 KITABOARDDATA_H
11 #define KITABOARDDATA_H
12
13 #include <QtCore/QList>
14 #include <QtCore/QStringList>
15
16 #include <kurl.h>
17
18 namespace Kita
19 {
20     /* type of board */
21     enum {
22         Board_MachiBBS,
23         Board_JBBS,
24         Board_2ch,
25         Board_FlashCGI,
26         Board_Unknown
27     };
28
29
30     /* return value of BoardManager::enrollBoard */
31     enum {
32         Board_enrollNew,
33         Board_enrollEnrolled,
34         Board_enrollMoved,
35         Board_enrollFailed
36     };
37
38     /*---------------------------------*/
39
40     /* Data Base of board */
41     class BoardData
42     {
43         QString m_boardName;
44         bool m_readIdx; /* If true, idx file has been read. */
45
46         QString m_hostname;    /* latest host name */
47         QString m_rootPath;
48         QString m_delimiter;   /* "/test/read.cgi", "/bbs/read.pl", etc. */
49         QString m_bbsPath;
50         QString m_ext;         /* ".dat", ".cgi", etc.  */
51         int m_type;
52
53         QString m_basePath;  /* = (hostname)/(rootPath)/(bbsPath)/ */
54         QString m_cgiBasePath;  /* = (hostname)/(rootPath)/(delimiter)/(bbsPath)/ */
55
56         /* SETTING.TXT */
57         bool m_settingLoaded;
58         QString m_defaultName;
59         int m_linenum;
60         int m_msgCount;
61         KUrl m_titleImgUrl;
62
63         /* keys */
64         QStringList m_keyHostList; /* list of host names. They are keys of DB. */
65         QStringList m_keyBasePathList;
66         QStringList m_keyCgiBasePathList;
67
68     public:
69         BoardData(const QString& boardName, const QString& hostname,
70                    const QString& rootPath, const QString& delimiter,
71                    const QString& bbsPath, const QString& ext, int boardtype);
72         ~BoardData();
73
74         void setHostName(const QString& hostname);
75
76         /* information */
77         bool readIdx() const;
78         void setReadIdx(bool idx);
79         const QString& boardName() const;
80         const QString& hostName() const;
81         const QString& rootPath() const;
82         const QString& delimiter() const;
83         const QString& bbsPath() const;
84         const QString& ext() const;
85         int type() const;
86
87         const QString& basePath() const;
88         const QString& cgiBasePath() const;
89
90         /* SETTING.TXT */
91         const QString settingUrl() const;
92         bool settingLoaded() const;
93         const QString& defaultName() const;
94         int lineNum() const;
95         int msgCount() const;
96         const KUrl& titleImgUrl() const;
97         void setSettingLoaded(bool set);
98         void setDefaultName(const QString& newName);
99         void setLineNum(int newLine);
100         void setMsgCount(int msgCount);
101         void setTitleImgUrl(const KUrl& url);
102
103         /* keys */
104         void createKeys(const QStringList& keyHostList);
105         const QStringList& keyHostList() const;
106         const QStringList& keyBasePathList() const;
107         const QStringList& keyCgiBasePathList() const;
108     };
109
110
111     /*--------------------------------------*/
112
113     typedef QList<BoardData*> BoardDataList;
114 }
115
116 #endif