Template Struct form_

Struct Documentation

template<typename RequestT>
struct udho::form_

unified form accessor that can extract field from both urlencoded as well as multipart forms.

Public Types

typedef RequestT request_type
typedef request_type::body_type::value_type body_type
typedef std::map<std::string, std::string> fields_map_type

Public Functions

form_(const request_type &request)
void parse_urlencoded()

parse the beast request body as urlencoded form data

void parse_multipart()

parse the beast request body as multipart form data

bool is_urlencoded() const

check whether the submitted form is urlencoded

bool is_multipart() const

check whether the submitted form is multipart

const urlencoded_form<std::string::const_iterator> &urlencoded() const

return the urlencoded specific form accessor

const multipart_form<std::string::const_iterator> &multipart() const

return the multipart specific form accessor

bool parsed() const

returns true once the form is parsed

bool has(const std::string &name) const

checks whether the form contains any field with matching name

Parameters
  • name: name of the form field

template<typename V>
V field(const std::string &name) const

returns a form field object for a given field

fields_map_type::size_type count() const

returns number of fields in the form

Public Members

const request_type &_request
form_type _type
urlencoded_form<std::string::const_iterator> _urlencoded
multipart_form<std::string::const_iterator> _multipart