| Line | |
|---|
| 1 | |
|---|
| 2 | |
|---|
| 3 | |
|---|
| 4 | |
|---|
| 5 | |
|---|
| 6 | |
|---|
| 7 | |
|---|
| 8 | |
|---|
| 9 | |
|---|
| 10 | |
|---|
| 11 | |
|---|
| 12 | |
|---|
| 13 | |
|---|
| 14 | |
|---|
| 15 | |
|---|
| 16 | |
|---|
| 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 | |
|---|
| 29 | namespace 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 |
|---|