CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CgiReader.cc
Go to the documentation of this file.
2 
3 /************************************************/
4 // Read any form and return a multimap with the elements
5 
6 void CgiReader::read_form(std::multimap<std::string, std::string> &form_info)
7 {
8  cgicc::Cgicc reader(in);
9 
10  std::vector<cgicc::FormEntry> entries = reader.getElements();
11 
12  // std::cout << "Trying to read a form of " << entries.size() << " elements!" << std::endl;
13 
14  form_info.clear();
15 
16  for (unsigned int i = 0; i < entries.size(); i++)
17  {
18  std::string name = entries[i].getName();
19  std::string value = entries[i].getValue();
20 
21  // std::cout << "Read " << name << " = " << value << std::endl;
22 
23  std::pair<std::string, std::string> map_entry(name, value);
24  form_info.insert(map_entry);
25  }
26 }
27 
28 std::string CgiReader::read_cookie(std::string name)
29 {
30  cgicc::Cgicc reader(in);
31  std::string value;
32 
33  const cgicc::CgiEnvironment& env = reader.getEnvironment();
34 
35  cgicc::const_cookie_iterator it;
36  for (it = env.getCookieList().begin();
37  it != env.getCookieList().end();
38  it ++)
39  {
40  if (name == it->getName())
41  {
42  value = it->getValue();
43  }
44  }
45  return value;
46 }
47 
int i
Definition: DBlmapReader.cc:9
void read_form(std::multimap< std::string, std::string > &form_info)
Definition: CgiReader.cc:6
std::string read_cookie(std::string name)
Definition: CgiReader.cc:28
xgi::Input * in
Definition: CgiReader.h:23