root/msg/multipart.hh
| Revision 11cf105fe323361072281747558cb61752f33fa8, 2.1 KB (checked in by Antti-Juhani Kaijanaho <antti-juhani@…>, 20 months ago) | |
|---|---|
|
|
| Line | |
|---|---|
| 1 | /* This file is part of Alue, the multiprotocol Internet discussion daemon |
| 2 | |
| 3 | Copyright © 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_MULTIPART_HH |
| 21 | #define GUARD_MSG_MULTIPART_HH |
| 22 | |
| 23 | #include "entity.hh" |
| 24 | #include <vector> |
| 25 | |
| 26 | namespace msg |
| 27 | { |
| 28 | class multipart : public entity |
| 29 | { |
| 30 | std::vector<entity::ptr> parts; |
| 31 | std::string preamble, trailer; |
| 32 | |
| 33 | multipart(const multipart &o) |
| 34 | : entity(o) |
| 35 | , preamble(o.preamble) |
| 36 | , trailer(o.trailer) { |
| 37 | for (size_t i = 0; i < o.parts.size(); i++) { |
| 38 | parts.push_back(o.parts[i]->clone()); |
| 39 | } |
| 40 | } |
| 41 | |
| 42 | public: |
| 43 | typedef boost::shared_ptr<multipart> ptr; |
| 44 | typedef boost::shared_ptr<const multipart> const_ptr; |
| 45 | |
| 46 | multipart(entity_header::ptr hdr, std::string body); |
| 47 | |
| 48 | entity::ptr clone() const { |
| 49 | multipart::ptr rv(new multipart(*this)); |
| 50 | return rv; |
| 51 | } |
| 52 | |
| 53 | std::string get_body() const; |
| 54 | |
| 55 | boost::shared_ptr<tlate::value> get_tlate_value(bool) const; |
| 56 | |
| 57 | void append_part(entity::const_ptr p) { |
| 58 | entity::ptr np = p->clone(); // FIXME default_ct |
| 59 | parts.push_back(np); |
| 60 | } |
| 61 | }; |
| 62 | } |
| 63 | |
| 64 | #endif /* GUARD_MSG_MULTIPART_HH */ |
Note: See TracBrowser
for help on using the browser.
