-
Notifications
You must be signed in to change notification settings - Fork 4
/
content_base.ipp
69 lines (55 loc) · 1.21 KB
/
content_base.ipp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
//
// content_base.ipp
// ~~~~~~~~~~
//
// Provide common function for HTTP body make
//
#ifndef BOOSTCONNECT_CONTENT_BASE_IPP
#define BOOSTCONNECT_CONTENT_BASE_IPP
#include <string>
#include <vector>
#include <boost/foreach.hpp>
#include "../content_base.hpp"
namespace bstcon{
namespace content{
content_base::content_base(const std::string& type, const std::map<std::string, std::string>& attr)
: type_(type), attr_(attr)
{
}
content_base::~content_base() // = default;
{
}
std::string content_base::get_content_type() const
{
std::string content_type = type_;
typedef std::pair<std::string, std::string> AttrType;
BOOST_FOREACH(const AttrType& item, attr_)
{
content_type += "; ";
content_type += item.first;
content_type += "=";
content_type += item.second;
}
return content_type;
}
std::string content_base::get_type() const
{
return type_;
}
std::map<std::string, std::string> content_base::get_attribute() const
{
return attr_;
}
void content_base::set_type(const std::string& type)
{
type_ = type;
return;
}
void content_base::set_attribute(const std::map<std::string, std::string>& attr)
{
attr_ = attr;
return;
}
}
}
#endif