提交 db63e79fcb963ceab35d6f38e96a975e31f608c6

作者 LJH 李佳桓
1 个父辈 6137ea0f

add

正在显示 1 个修改的文件 包含 78 行增加0 行删除
  1 +/**************************************************************************
  2 + * file: dmpserverparameters.cpp
  3 +
  4 + * Author: wanzhongping
  5 + * Date: 2021-01-26 16:26:48
  6 + * Email: zhongpingw@chinadci.com
  7 + * copyright: 广州城市信息研究所有限公司
  8 + ***************************************************************************/
  9 +
  10 +#include "dmpserverparameters.h"
  11 +#include <boost/regex.hpp>
  12 +#include "dmplogger.h"
  13 +
  14 +DmpServerParameters::DmpServerParameters()
  15 +{
  16 +}
  17 +
  18 +DmpServerParameters::DmpServerParameters(const std::string &query_string)
  19 +{
  20 + SetQueryString(query_string);
  21 +}
  22 +
  23 +void DmpServerParameters::SetQueryString(const std::string &query_string)
  24 +{
  25 + params_ = QueryString::parse(query_string);
  26 +}
  27 +
  28 +std::string DmpServerParameters::Service() const
  29 +{
  30 + std::map<std::string, std::string>::const_iterator iter = params_.find("Service");
  31 + if (iter != params_.end()) {
  32 + return iter->second;
  33 + } else {
  34 + LOGGER_WARN("参数service为空");
  35 + return "";
  36 + }
  37 +}
  38 +
  39 +std::string DmpServerParameters::Request() const
  40 +{
  41 + std::map<std::string, std::string>::const_iterator iter = params_.find("request");
  42 + if (iter != params_.end()) {
  43 + return iter->second;
  44 + } else {
  45 + LOGGER_WARN("参数request为空");
  46 + return "";
  47 + }
  48 +}
  49 +
  50 +std::string DmpServerParameters::Version() const
  51 +{
  52 + std::map<std::string, std::string>::const_iterator iter = params_.find("version");
  53 + if (iter != params_.end()) {
  54 + return iter->second;
  55 + } else {
  56 + LOGGER_WARN("参数version为空");
  57 + return "";
  58 + }
  59 +}
  60 +
  61 +void DmpServerParameters::Clear()
  62 +{
  63 + params_.clear();
  64 +}
  65 +
  66 +void DmpServerParameters::Add(const std::string &key, const std::string &value)
  67 +{
  68 + params_[key] = value;
  69 +}
  70 +
  71 +void DmpServerParameters::Remove(const std::string &key)
  72 +{
  73 + std::map<std::string, std::string>::iterator iter;
  74 + iter = params_.find(key);
  75 + if (iter != params_.end()) {
  76 + params_.erase (iter);
  77 + }
  78 +}
... ...
注册登录 后发表评论