Template Struct multipart_

Nested Relationships

Struct Documentation

template<typename Iterator = std::string::const_iterator>
struct udho::forms::drivers::multipart_

Form accessor for multipart forms

Public Types

typedef Iterator iterator_type
typedef std::iterator_traits<iterator_type>::value_type value_type
typedef std::basic_string<value_type> string_type
typedef bounded_str<iterator_type> bounded_string_type
typedef std::map<string_type, bounded_string_type> header_map_type
typedef bounded_string_type bounded_string

Public Functions

void parse(const std::string &boundary, iterator_type begin, iterator_type end)
void parse_part(iterator_type begin, iterator_type end)
std::size_t count() const

number of fields in the form

bool exists(const std::string name) const

checks whether the form has any field with the given name

bool empty(const std::string name) const
const form_part &part(const std::string &name) const

returns the part associated with the given name

template<typename T, typename ParserT = udho::forms::parser<T>, typename ...ArgsT>
bool parsable(const std::string &name, const ArgsT&... args) const
template<typename T, typename ParserT = udho::forms::parser<T>, typename ...ArgsT>
const T parsed(const std::string &name, const ArgsT&... args) const

returns the value of the field with the name provided lexically casted to type T

Public Members

std::string _boundary
std::map<string_type, form_part> _parts
struct form_part

A part in the multipart form data

Public Functions

form_part(iterator_type begin, iterator_type end)
void set_header(const header_map_type &headers)
const bounded_string_type &header(const std::string &key) const

returns the value associated with the key in the header of the part

header("Content-Disposition").copied<std::string>();

bounded_string_type header(const std::string &key, const std::string &sub) const

returns the value associated with the key and sub key in the header of the part

header("Content-Disposition", "name").copied<std::string>();

bounded_string_type name() const

name of the part

name().copied<std::string>();

bounded_string_type filename() const

filename of the part

name().copied<std::string>();

const bounded_string_type &body() const

body of the part returned as a pair of string iterators

body().copied<std::string>();

template<typename StrT>
StrT copied() const
std::string str() const

returns the body of the part as string

template<typename T, typename ParserT = udho::forms::parser<T>, typename ...ArgsT>
bool parsable(const ArgsT&... args) const
bool empty() const
template<typename T, typename ParserT = udho::forms::parser<T>, typename ...ArgsT>
const T parsed(const ArgsT&... args) const

returns the value of the field with the name provided lexically casted to type T

Public Members

header_map_type _headers
bounded_string_type _body