root/msg/text_plain.hh

Revision 11cf105fe323361072281747558cb61752f33fa8, 2.5 KB (checked in by Antti-Juhani Kaijanaho <antti-juhani@…>, 20 months ago)

#60: Add a footer to email distributed posts

Signed-off-by: Antti-Juhani Kaijanaho <antti-juhani@…>

  • Property mode set to 100644
Line 
1/*  This file is part of Alue, the multiprotocol Internet discussion daemon
2
3    Copyright © 2009, 2010 Antti-Juhani Kaijanaho
4
5    Alue is free software: you can redistribute it and/or modify it
6    under the terms of the GNU General Public License as published by
7    the Free Software Foundation, either version 3 of the License, or
8    (at your option) any later version.
9
10    Alue is distributed in the hope that it will be useful, but
11    WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13    General Public License for more details.
14
15    You should have received a copy of the GNU General Public License
16    along with Alue.  If not, see <http://www.gnu.org/licenses/>.
17
18 */
19
20#ifndef GUARD_MSG_TEXT_PLAIN_HH
21#define GUARD_MSG_TEXT_PLAIN_HH
22
23#include "content_type.hh"
24#include "entity.hh"
25
26#include <string>
27#include <vector>
28
29namespace msg
30{
31        class text_plain : public entity
32        {
33        public:
34                typedef boost::shared_ptr<text_plain> ptr;
35                typedef boost::shared_ptr<const text_plain> const_ptr;
36
37                class para
38                {
39                        size_t qd;
40                        std::vector<std::string> lines;
41                public:
42                        explicit para(size_t qd) : qd(qd) {}
43                        void push_back(std::string li) { lines.push_back(li); }
44
45                        size_t quote_depth() const { return qd; }
46                        size_t num_lines() const { return lines.size(); }
47                        std::string get_line(size_t i) const 
48                                { return lines[i]; }
49                };
50
51                explicit text_plain(std::string body, content_type);
52                explicit text_plain(entity_header::ptr hdr, std::string body);
53                explicit text_plain(entity::const_ptr e);
54
55                size_t num_paras() const { return paras.size(); }
56                const para &get_para(size_t i) const { return paras[i]; }
57
58                boost::shared_ptr<tlate::value>
59                get_tlate_value(bool hide_addreses) const;
60
61                std::string get_body() const { return raw_body; }
62
63                entity::ptr clone() const {
64                        entity::ptr rv(new text_plain(*this));
65                        return rv;
66                }
67        private:
68                std::string raw_body;
69                std::vector<para> paras;
70
71                void init(std::string body);
72        };
73}
74
75#endif /* GUARD_MSG_TEXT_PLAIN_HH */
Note: See TracBrowser for help on using the browser.