1 #include "otsdaq/CgiDataUtilities/CgiDataUtilities.h"
2 #include "otsdaq/Macros/CoutMacros.h"
27 std::string
postData =
"&" + cgi.getEnvironment().getPostData();
32 if(start_pos == std::string::npos)
35 size_t end_pos =
postData.find(
'=', start_pos);
36 if(end_pos == std::string::npos)
39 start_pos += needle.length() + 2;
40 end_pos =
postData.find(
'&', start_pos);
41 if(end_pos == std::string::npos)
46 return postData.substr(start_pos, end_pos - start_pos);
55 std::string
getData =
"&" + cgi.getEnvironment().getQueryString();
58 size_t start_pos =
getData.find(
61 if(start_pos == std::string::npos)
64 size_t end_pos =
getData.find(
'=', start_pos);
65 if(end_pos == std::string::npos)
68 start_pos += needle.length() + 2;
69 end_pos =
getData.find(
'&', start_pos);
70 if(end_pos != std::string::npos)
77 return getData.substr(start_pos, end_pos);
81 int CgiDataUtilities::getOrPostDataAsInt(cgicc::Cgicc& cgi,
const std::string& needle)
85 int CgiDataUtilities::postDataAsInt(cgicc::Cgicc& cgi,
const std::string& needle)
87 return atoi(
postData(cgi, needle).c_str());
89 int CgiDataUtilities::getDataAsInt(cgicc::Cgicc& cgi,
const std::string& needle)
91 return atoi(
getData(cgi, needle).c_str());
static std::string postData(cgicc::Cgicc &cgi, const std::string &needle)
static std::string getOrPostData(cgicc::Cgicc &cgi, const std::string &needle)
static std::string getData(cgicc::Cgicc &cgi, const std::string &needle)