2008-12-10 05:42:49 +01:00
|
|
|
/*
|
2010-02-28 01:08:10 +01:00
|
|
|
* This file is a part of Winix
|
2008-12-10 05:42:49 +01:00
|
|
|
* and is not publicly distributed
|
|
|
|
*
|
2010-02-28 22:33:06 +01:00
|
|
|
* Copyright (c) 2008-2010, Tomasz Sowa
|
2008-12-10 05:42:49 +01:00
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2009-04-21 22:50:55 +02:00
|
|
|
#ifndef headerfilecmslucoregetparser
|
|
|
|
#define headerfilecmslucoregetparser
|
2008-12-10 05:42:49 +01:00
|
|
|
|
|
|
|
#include "httpsimpleparser.h"
|
|
|
|
#include "requesttypes.h"
|
|
|
|
|
|
|
|
|
|
|
|
class GetParser : public HttpSimpleParser
|
|
|
|
{
|
|
|
|
|
|
|
|
const char * get_string;
|
2010-08-12 21:10:12 +02:00
|
|
|
GetTab * get_tab;
|
2008-12-10 05:42:49 +01:00
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
virtual int GetChar()
|
|
|
|
{
|
|
|
|
if( !get_string || *get_string == 0 )
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
return (int)(unsigned char)*(get_string++);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
virtual void Parameter(std::string &, std::string & value)
|
|
|
|
{
|
2010-08-12 21:10:12 +02:00
|
|
|
get_tab->push_back(value);
|
2008-12-10 05:42:49 +01:00
|
|
|
log << log2 << "Get, value: \"" << value << "\"" << logend;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
2010-08-12 21:10:12 +02:00
|
|
|
|
|
|
|
GetParser()
|
2008-12-10 05:42:49 +01:00
|
|
|
{
|
|
|
|
HttpSimpleParser::separator = '/';
|
|
|
|
HttpSimpleParser::read_name = false;
|
2010-08-12 21:10:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// get_string_ can be null
|
|
|
|
void Parse(const char * get_string_, GetTab & get_tab_)
|
|
|
|
{
|
|
|
|
get_string = get_string_;
|
|
|
|
get_tab = &get_tab_;
|
|
|
|
|
|
|
|
if( get_string && *get_string == separator )
|
|
|
|
{
|
|
|
|
// skipping one '/' at the beginning
|
2008-12-10 05:42:49 +01:00
|
|
|
++get_string;
|
2010-08-12 21:10:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
HttpSimpleParser::Parse();
|
2008-12-10 05:42:49 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|