dmpserverparameters.cpp
2.2 KB
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
/**************************************************************************
* file: dmpserverparameters.cpp
* Author: wanzhongping
* Date: 2021-01-26 16:26:48
* Email: zhongpingw@chinadci.com
* copyright: 广州城市信息研究所有限公司
***************************************************************************/
#include "dmpserverparameters.h"
#include <boost/regex.hpp>
#include "dmplogger.h"
DmpServerParameters::DmpServerParameters()
{
}
DmpServerParameters::DmpServerParameters(const std::string &queryString)
{
setQueryString(queryString);
}
void DmpServerParameters::setQueryString(const std::string &queryString)
{
params_ = QueryString::parse(queryString);
}
std::string DmpServerParameters::service() const
{
std::map<std::string, std::string>::const_iterator iter = params_.find("Service");
if (iter != params_.end()) {
return iter->second;
} else {
return "";
}
}
std::string DmpServerParameters::request() const
{
std::map<std::string, std::string>::const_iterator iter = params_.find("request");
if (iter != params_.end()) {
return iter->second;
} else {
LOGGER_WARN("参数request为空");
return "";
}
}
std::string DmpServerParameters::version() const
{
std::map<std::string, std::string>::const_iterator iter = params_.find("version");
if (iter != params_.end()) {
return iter->second;
} else {
LOGGER_WARN("参数version为空");
return "";
}
}
void DmpServerParameters::clear()
{
params_.clear();
}
void DmpServerParameters::add(const std::string &key, const std::string &value)
{
params_[key] = value;
}
void DmpServerParameters::remove(const std::string &key)
{
std::map<std::string, std::string>::iterator iter;
iter = params_.find(key);
if (iter != params_.end()) {
params_.erase (iter);
}
}
void DmpServerParameters::getValue(const std::string &key, std::string &value)
{
std::map<std::string, std::string>::iterator iter;
iter = params_.find(key);
if (iter != params_.end()) {
value = iter->second;
}
}