OSDN Git Service

History menus are organized by boards.
[fukui-no-namari/dialektos.git] / src / bbs_detail_base.hxx
1 /*
2  * Copyright (C) 2009 by Aiwota Programmer
3  * aiwotaprog@tetteke.tk
4  *
5  * This file is part of Dialektos.
6  *
7  * Dialektos is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * Dialektos is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with Dialektos.  If not, see <http://www.gnu.org/licenses/>.
19  */
20
21 #ifndef BBS_DETAIL_BASE_HXX
22 #define BBS_DETAIL_BASE_HXX
23
24 #include <string>
25 #include <vector>
26 #include "board_subject_item.hxx"
27 #include "http_header.hxx"
28
29
30 namespace dialektos {
31
32 namespace text_view {
33   class Layoutable;
34 }
35
36 namespace bbs_detail {
37
38
39 class Base {
40 public:
41   Base(const std::string& uri, const std::string& host,
42       const std::string& board, const std::string& thread);
43   Base* clone() const;
44   virtual ~Base();
45   virtual std::string get_board_dir_path() const;
46   virtual std::string get_thread_file_path() const;
47   virtual std::string get_thread_idx_path() const;
48   virtual std::string get_thread_state_path() const;
49   virtual std::string get_thread_dat_uri() const;
50   virtual std::string get_thread_uri() const;
51   virtual std::string get_another_thread_uri(const std::string& thread) const;
52   virtual std::string get_board_subject_path() const;
53   virtual std::string get_board_state_path() const;
54   virtual std::string get_board_subject_uri() const;
55   virtual std::string get_board_uri() const;
56   virtual std::string get_board_subject_idx_path() const;
57   virtual std::string get_board_idx_dir_path() const;
58   virtual std::string get_board_id() const;
59   virtual http::Header get_board_subject_request_header() const;
60   virtual http::Header get_thread_dat_request_header() const;
61   virtual std::string get_title_from_string(const std::string& dat) const;
62   virtual bool belongs_to(const Base& rhs) const;
63   virtual std::string get_thread_id() const;
64
65   virtual const std::string& get_encoding() const;
66
67   virtual void load_thread(text_view::Layoutable& output) const;
68   virtual void load_thread_from_string(
69       const std::string& dat, text_view::Layoutable& output) const;
70   virtual void load_subject(std::vector<SubjectItem>& output) const;
71   virtual void load_subject_from_string(
72       const std::string&, std::vector<SubjectItem>& output) const;
73
74   bool is_board() const;
75   bool is_thread() const;
76 //  static Base* judge(const std::string& uri);
77
78   bool operator==(const bbs_detail::Base& rhs) const;
79
80 protected:
81   explicit Base(const Base& rhs);
82 private:
83   virtual Base* do_clone() const;
84
85 protected:
86   virtual const std::string& get_bbs_name() const;
87
88   const std::string uri_;
89   const std::string host_;
90   const std::string board_;
91   const std::string thread_;
92
93   static const std::string bbs_name;
94   static const std::string encoding;
95 };
96
97
98 } // namespace bbs_detail
99
100 } // namespace dialektos
101
102 #endif