root/msg/content_type.hh

Revision 99057e4d73dbb905f06f5ccc4ea49708b8aaa0a8, 2.1 KB (checked in by Antti-Juhani Kaijanaho <antti-juhani@…>, 20 months ago)

Rework entity handling

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_CONTENT_TYPE_HH
21#define GUARD_MSG_CONTENT_TYPE_HH
22
23#include <map>
24#include <string>
25
26namespace msg
27{
28        class content_type
29        {
30        public:
31                enum types { UNKNOWN,
32                             APPLICATION,
33                             AUDIO,
34                             IMAGE,
35                             MESSAGE,
36                             MODEL,
37                             MULTIPART,
38                             TEXT,
39                             VIDEO };
40
41                content_type(std::string field_body);
42
43                types get_type() const { return type; }
44
45                std::string get_subtype() const { return subtype; }
46
47                std::string get_param(std::string name) const {
48                        std::map<std::string,std::string>::const_iterator it
49                                = params.find(name);
50                        if (it == params.end()) return "";
51                        return it->second;
52                }
53                void set_param(std::string name, std::string value) {
54                        params[name] = value;
55                }
56
57                std::string to_string() const;
58
59        private:
60                types type;
61                std::string subtype;
62                std::map<std::string,std::string> params;
63        };
64}
65
66#endif /* GUARD_MSG_CONTENT_TYPE_HH */
Note: See TracBrowser for help on using the browser.