Web framework C++
2.0.0
Simple web framework on c++ designed to easily create web pages, etc
|
Template methods pattern for parsing form. More...
#include <form_parser.h>
Public Member Functions | |
KeyEntityStorage * | parseForm (std::string &httpRequest, KeyValueStorage *KVPStorage=nullptr) |
virtual | ~FormParser () |
Protected Member Functions | |
void | selectFormBody () |
virtual void | actionBeforeSelectingBody () |
virtual void | parseNextKey (size_t startPosition, size_t endPosition)=0 |
virtual void | parseNextValue (size_t startPosition, size_t endPosition)=0 |
virtual void | actionBeforeValueParsing (size_t keyStart, size_t keyEnd) |
KeyValueStorage | getKeyValuePairs () |
void | setCurrentValue (FormEntity *valueCurrent) |
Protected Attributes | |
KeyEntityStorage * | values = nullptr |
FormEntity * | valueCurrent = nullptr |
std::string | keyCurrent |
std::string | formBody |
std::string | valuesDelimiter |
std::string | pairsDelimiter |
Template methods pattern for parsing form.
This abstract class is intend to parse html form with different encodings. Template method is parseForm, which consists of abstracts methods, that could be implemented. There are FormMultipartData and FormUrlencoded concrete template methods in framework
|
virtual |
delete internal values
|
inlineprotectedvirtual |
not required method to perform actions before finding body of form. By default do nothing
Reimplemented in FormMultipart.
|
inlineprotectedvirtual |
not required method to perform actions before parsing key of form. By default do nothing
keyStart | start position of key in form body |
keyEnd | end position of key in form body, exclusive |
Reimplemented in FormMultipart.
|
protected |
generate key value (string, string) pairs from from
KeyEntityStorage* FormParser::parseForm | ( | std::string & | httpRequest, |
KeyValueStorage * | KVPStorage = nullptr |
||
) |
Template method to parse html forms
httpRequest | serialized http request |
KVPStorage | out parameter. If not null, write key value pairs (string, string) to out parameter |
|
protectedpure virtual |
Parse key of html form
startPosition | start position of key in form body |
endPosition | end position of key in form body, exclusive |
Implemented in FormMultipart, and FormUrlEncoded.
|
protectedpure virtual |
Parse value of html form
startPosition | start position of value in form body |
endPosition | end position of value in form body, exclusive |
Implemented in FormMultipart, and FormUrlEncoded.
|
protected |
Parse http request to find body of form and then store it in parser
|
protected |
valueCurrent |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |