Welcome to udho’s documentation!

Udho API

Class Hierarchy

Full API

Namespaces

Namespace udho
Classes
Functions
Namespace udho::cache::storage

Contents

Namespace udho::compositors
Detailed Description

compositors for content

Namespace udho::forms
Namespace udho::forms::drivers::detail

Contents

Namespace udho::loggers

Contents

Namespace udho::logging::features

Contents

Classes and Structs

Template Struct accessor
Inheritance Relationships
Base Type
Struct Documentation
template<typename ...T>
struct udho::activities::accessor : public udho::activities::fixed_key_accessor<udho::cache::shadow<std::string, T::result_type...>>

Access a subset of data from the collector

Public Types

typedef fixed_key_accessor<udho::cache::shadow<std::string, typename T::result_type...>> base_type
typedef udho::cache::shadow<std::string, typename T::result_type...> shadow_type

Public Functions

template<typename ContextT, typename ...U>
accessor(std::shared_ptr<collector<ContextT, dataset<U...>>> collector)
template<typename ...U>
accessor(accessor<U...> accessor)
std::string name() const
shadow_type &shadow()
const shadow_type &shadow() const
template<typename V>
bool exists() const

Whether there exists any data for activity V

Template Parameters
  • V: Activity Type

template<typename V>
const V::result_type &get() const

get data associated with activity V

Template Parameters
  • V: activity type

template<typename V>
bool completed() const

Check whether activity V has completed.

Template Parameters
  • V: activity type

template<typename V>
bool canceled() const

Check whether activity V has been canceled.

Template Parameters
  • V: activity type

template<typename V>
bool failed() const

Check whether activity V has failed (only the failure data of V is valid).

Template Parameters
  • V: activity type

template<typename V>
bool okay() const

Check whether activity V is okay.

Template Parameters
  • V: activity type

template<typename V>
V::result_type::success_type success() const

get success data for activity V

Template Parameters
  • V: activity type

template<typename V>
V::result_type::failure_type failure() const

get failure data for activity V

Template Parameters
  • V: activity type

template<typename V>
void set(const typename V::result_type &value)
template<typename V, typename F>
void apply(F f) const

Apply a callback on result of V

Template Parameters
  • V: activity type

Parameters
  • f: callback

Public Members

shadow_type _shadow
Template Struct activity
Inheritance Relationships
Base Types
  • public std::enable_shared_from_this< DerivedT >

  • public udho::activities::result< SuccessDataT, FailureDataT > (Template Struct result)

Struct Documentation
template<typename DerivedT, typename SuccessDataT = void, typename FailureDataT = void>
struct udho::activities::activity : public std::enable_shared_from_this<DerivedT>, public udho::activities::result<SuccessDataT, FailureDataT>

An activity A must subclass from activity<A, SuccessA, FailureA> assuming SuccessA and FailureA are the types that contains the relevant information regarding its success or failure. The activity A must overload a no argument operator()() which initiates the activity. After the activity is initiated either success() or failure() methods must be called in order to signal its completion. The activity A must take the collector as the first argument to its constructor, which is passed to the base class activity<A, SuccessA, FailureA>. Hence its prefered to take the first parameter to the constructor as template parameter.

Template Parameters
  • DerivedT: Activity Class

  • SuccessDataT: data associated to the activity if the activity succeeds

  • FailureDataT: data associated to the activity if the activity fails

Public Types

typedef std::shared_ptr<DerivedT> derived_ptr_type

Public Functions

template<typename StoreT>
activity(StoreT &store)
derived_ptr_type self()

shared_ptr to this

Template Struct after
Inheritance Relationships
Base Type
Struct Documentation
template<typename HeadT, typename ...TailT>
struct udho::activities::after : public udho::activities::detail::after<HeadT>

Public Functions

after(HeadT &head, TailT&... tail)
template<typename ActivityT, typename ...Args>
subtask<ActivityT, typename HeadT::activity_type, typename TailT::activity_type...> perform(Args&&... args)
template<typename ActivityT, typename ...DependenciesT>
void attach(subtask<ActivityT, DependenciesT...> &sub)
template<typename CallbackT, typename StartT>
subtask<joined<CallbackT, typename StartT::collector_type>, typename HeadT::activity_type, typename TailT::activity_type...> finish(StartT &starter, CallbackT callback)
Template Struct after< HeadT >
Inheritance Relationships
Base Type
Struct Documentation
template<typename HeadT>
struct udho::activities::after<HeadT> : public udho::activities::detail::after<HeadT>

Public Functions

after(HeadT &head)
template<typename ActivityT, typename ...Args>
subtask<ActivityT, typename HeadT::activity_type> perform(Args&&... args)
template<typename ActivityT, typename ...DependenciesT>
void attach(subtask<ActivityT, DependenciesT...> &sub)
template<typename CallbackT, typename StartT>
subtask<joined<CallbackT, typename StartT::collector_type>, typename HeadT::activity_type> finish(StartT &starter, CallbackT callback)
Struct after_none
Struct Documentation
struct udho::activities::after_none

Public Functions

template<typename ActivityT, typename ...Args>
subtask<ActivityT> perform(Args&&... args)
Template Struct apply_helper
Inheritance Relationships
Base Types
Struct Documentation
template<typename FunctorT, typename SuccessT, typename FailureT>
struct udho::activities::apply_helper : public udho::activities::detail::apply_helper_<FunctorT>, public udho::activities::detail::apply_helper_<FunctorT, SuccessT>, public udho::activities::detail::apply_helper_<FunctorT, FailureT>, public udho::activities::detail::apply_helper_<FunctorT, SuccessT, FailureT>

Public Functions

apply_helper(FunctorT &f)
void operator()()
void operator()(const SuccessT &s)
void operator()(const FailureT &f)
void operator()(const SuccessT &s, const FailureT &f)

Public Members

FunctorT &_ftor
Template Struct collector
Struct Documentation
template<typename ContextT, typename DatasetT>
struct collector
Template Struct collector< ContextT, dataset< T… > >
Inheritance Relationships
Base Types
  • public udho::activities::dataset< T... > (Template Struct dataset)

  • public std::enable_shared_from_this< collector< ContextT, dataset< T... > > >

Struct Documentation
template<typename ContextT, typename ...T>
struct udho::activities::collector<ContextT, dataset<T...>> : public udho::activities::dataset<T...>, public std::enable_shared_from_this<collector<ContextT, dataset<T...>>>

Collects data associated with all activities involved in the subtask graph

Public Types

typedef dataset<T...> base_type
typedef ContextT context_type

Public Functions

collector(context_type ctx, const std::string &name)
context_type &context()
const context_type &context() const

Public Members

context_type _context
Template Struct combinator
Inheritance Relationships
Base Type
Struct Documentation
template<typename NextT, typename ...DependenciesT>
struct udho::activities::combinator : public udho::activities::junction<DependenciesT::result_type>

A combinator combines multiple activities and proceeds towards the next activity

Template Parameters
  • NextT: next activity

  • DependenciesT: dependencies

Public Types

typedef std::shared_ptr<NextT> next_type
typedef boost::signals2::signal<void(NextT&)> signal_type

Public Functions

combinator(next_type &next)
template<typename U>
void operator()(const U &u)

whenever a subtask finishes the operator() of the combinator is called. which doesn’t start the next subtask untill all the dependencies have completed. Before starting the next activity the next activity is prepared if any preparator is passed through the prepare() function

void cancel()
void propagate()
template<typename PreparatorT>
void prepare(PreparatorT prep)

set a preparator callback which will be called with a reference to teh next activity. The preparator callback is supposed to prepare the next activity by using the data callected till that time.

Public Members

next_type _next
std::atomic<std::size_t> _counter
std::mutex _mutex
signal_type _preparators
std::atomic<bool> _canceled
Template Struct combinator< NextT, start< ContextT, T… > >
Struct Documentation
template<typename NextT, typename ContextT, typename ...T>
struct udho::activities::combinator<NextT, start<ContextT, T...>>

Public Types

typedef std::shared_ptr<NextT> next_type

Public Functions

combinator(next_type &next)
void operator()()
void propagate()

Public Members

next_type _next
Template Struct dataset
Inheritance Relationships
Base Type
Struct Documentation
template<typename ...T>
struct udho::activities::dataset : public udho::activities::fixed_key_accessor<udho::cache::shadow<std::string, T::result_type...>>

Public Types

typedef fixed_key_accessor<udho::cache::shadow<std::string, typename T::result_type...>> base_type
typedef udho::cache::store<udho::cache::storage::memory, std::string, typename T::result_type...> store_type
typedef store_type::shadow_type shadow_type
typedef accessor<T...> accessor_type

Public Functions

dataset(const udho::configuration_type &config, const std::string &name)
std::string name() const
shadow_type &shadow()
const shadow_type &shadow() const

Public Members

store_type _store
shadow_type _shadow
std::string _name
Template Struct after
Inheritance Relationships
Derived Type
Struct Documentation
template<typename T>
struct after

Subclassed by udho::activities::after< HeadT, TailT >

Template Struct after< subtask< ActivityT, DependenciesT… > >
Struct Documentation
template<typename ActivityT, typename ...DependenciesT>
struct udho::activities::detail::after<subtask<ActivityT, DependenciesT...>>

Public Functions

after(subtask<ActivityT, DependenciesT...> &before)
template<typename OtherActivityT, typename ...OtherDependenciesT>
void attach(subtask<OtherActivityT, OtherDependenciesT...> &sub)

Public Members

subtask<ActivityT, DependenciesT...> &_before
Template Struct after< udho::start_< ContextT, T… > >
Struct Documentation
template<typename ContextT, typename ...T>
struct udho::activities::detail::after<udho::start_<ContextT, T...>>

Public Functions

after(udho::start_<ContextT, T...> &before)
template<typename OtherActivityT, typename ...OtherDependenciesT>
void attach(subtask<OtherActivityT, OtherDependenciesT...> &sub)

Public Members

udho::start_<ContextT, T...> &_before
Template Struct apply_helper_
Inheritance Relationships
Derived Types
Struct Documentation
template<bool invocable, typename FunctorT, typename ...TargetsT>
struct udho::activities::detail::apply_helper_

Subclassed by udho::activities::apply_helper< FunctorT, SuccessT, FailureT >, udho::activities::apply_helper< FunctorT, SuccessT, FailureT >, udho::activities::apply_helper< FunctorT, SuccessT, FailureT >, udho::activities::apply_helper< FunctorT, SuccessT, FailureT >

Public Functions

void operator()(FunctorT &f, const TargetsT&... t)
Template Struct apply_helper_< false, FunctorT, TargetsT… >
Struct Documentation
template<typename FunctorT, typename ...TargetsT>
struct udho::activities::detail::apply_helper_<false, FunctorT, TargetsT...>

Public Functions

void operator()(FunctorT&, const TargetsT&...)
Template Struct final_intermediate
Struct Documentation
template<typename CollectorT, typename ...DependenciesT>
struct udho::activities::detail::final_intermediate

Public Functions

final_intermediate(std::shared_ptr<CollectorT> collector)
template<typename CallbackT>
subtask<joined<CallbackT, CollectorT>, DependenciesT...> exec(CallbackT callback)

Public Members

std::shared_ptr<CollectorT> _collector
Template Struct fixed_key_accessor
Struct Documentation
template<typename StoreT>
struct udho::activities::fixed_key_accessor

Public Types

typedef StoreT::key_type key_type

Public Functions

fixed_key_accessor(StoreT &store, const key_type &key)
std::string key() const
template<typename V>
bool exists() const
template<typename V>
V get() const
template<typename V>
V at()
template<typename V>
void set(const V &value)
std::size_t size() const

Public Members

StoreT &_shadow
key_type _key
Template Struct joined
Struct Documentation
template<typename CallbackT, typename CollectorT>
struct joined
Template Struct joined< CallbackT, activities::collector< ContextT, dataset< T… > > >
Struct Documentation
template<typename CallbackT, typename ...T, typename ContextT>
struct udho::activities::joined<CallbackT, activities::collector<ContextT, dataset<T...>>>

Public Types

typedef activities::collector<ContextT, dataset<T...>> collector_type
typedef collector_type::accessor_type accessor_type
typedef CallbackT callback_type
typedef joined<callback_type, activities::collector<ContextT, dataset<T...>>> self_type
typedef int cancel_if_ftor

Public Functions

joined(std::shared_ptr<collector_type> collector, CallbackT callback)
void operator()()
void cancel()
template<typename U>
void cancel_if(U&)
Template Struct junction
Struct Documentation
template<typename DependencyT>
struct udho::activities::junction

Public Functions

void operator()(const DependencyT&)
Template Struct perform
Nested Relationships
Struct Documentation
template<typename ActivityT>
struct udho::activities::perform

create a subtask to perform activity ActivityT

Template Parameters
  • ActivityT: the activity to perform

Public Static Functions

template<typename ...U>
subtask<ActivityT> with(U&&... u)

arguments for the activity constructor

template<typename ...DependenciesT>
struct require

mention the activities that has to be performed before executing this subtask.

Template Parameters
  • DependenciesT: dependencies

Public Static Functions

template<typename ...U>
subtask<ActivityT, DependenciesT...> with(U&&... u)

arguments for the activity constructor

Template Struct perform::require
Nested Relationships

This struct is a nested type of Template Struct perform.

Struct Documentation
template<typename ...DependenciesT>
struct udho::activities::perform::require

mention the activities that has to be performed before executing this subtask.

Template Parameters
  • DependenciesT: dependencies

Public Static Functions

template<typename ...U>
subtask<ActivityT, DependenciesT...> with(U&&... u)

arguments for the activity constructor

Template Struct require
Struct Documentation
template<typename ...DependenciesT>
struct udho::activities::require

Public Static Functions

template<typename CollectorT>
detail::final_intermediate<CollectorT, DependenciesT...> with(std::shared_ptr<CollectorT> collector)
Template Struct result
Inheritance Relationships
Base Type
Struct Documentation
template<typename SuccessT, typename FailureT>
struct udho::activities::result : public udho::activities::result_data<SuccessT, FailureT>

Completion handler for an activity.

Template Parameters
  • SuccessT: success data associated with the activity

  • FailureT: failure data associated with the activity

Public Types

typedef result_data<SuccessT, FailureT> data_type
typedef accessor<data_type> accessor_type
typedef data_type::success_type success_type
typedef data_type::failure_type failure_type
typedef boost::signals2::signal<void(const data_type&)> signal_type
typedef boost::signals2::signal<void()> cancelation_signal_type
typedef boost::function<bool(const success_type&)> cancel_if_ftor
typedef boost::function<bool(const success_type&)> abort_error_ftor
typedef boost::function<bool(const failure_type&)> abort_failure_ftor

Public Functions

template<typename StoreT>
result(StoreT &store)

Parameters
  • store: collector

template<typename CombinatorT>
void done(CombinatorT cmb)

attach another subtask as done callback which will be executed once this subtask finishes

Parameters
  • cmb: next subtask

void required(bool flag)

mark the activity as required or optional

Parameters
  • flag:

void cancel_if(cancel_if_ftor f)

Force cancelation of the activity even after it is successful to stop propagating to the next activities

Parameters
  • f: callback which should return true to signal cancelation

void if_errored(abort_error_ftor ftor)
void if_failed(abort_failure_ftor ftor)

Public Members

accessor_type _shadow
signal_type _signal
bool _required
cancelation_signal_type _cancelation_signals
cancel_if_ftor _cancel_if
abort_error_ftor _abort_error
abort_failure_ftor _abort_failure

Protected Functions

void success(const success_type &data)

signal successful completion of the activity with success data of type SuccessT

Parameters
  • data: success data

void failure(const failure_type &data)

signal failed completion of the activity with failure data of type FailureT

Parameters
  • data: failure data

Friends

friend struct combinator
Template Struct result_data
Inheritance Relationships
Derived Type
Struct Documentation
template<typename SuccessT, typename FailureT>
struct udho::activities::result_data

Contains Copiable Success or Failure data for an activity.

Template Parameters
  • SuccessT: success data type

  • FailureT: failure data type

Subclassed by udho::activities::result< SuccessT, FailureT >

Public Types

typedef SuccessT success_type
typedef FailureT failure_type
typedef result_data<SuccessT, FailureT> self_type
typedef self_type result_type

Public Functions

result_data()
bool completed() const

either success or failure data set

bool failed() const

whether the activity has failed

bool canceled() const

check whether the activity has been canceled

bool okay() const
const success_type &success_data() const

Success data

const failure_type &failure_data() const

Failure data

template<typename CallableT>
void apply(CallableT callback)

Apply a callable to the result data which will be invoked exactly once with appropriate arguments. The invocation of the callback depends on the state as shown below.

  • Incomplete: callback()

  • Canceled: callback(const SuccessT&, const FailureT&)

  • Failed: callback(const FailureT&)

  • Successful: callback(const SuccessT&)

The callback may not have all the overloads.

Parameters
  • callback:

Public Members

bool _completed
bool _success
bool _canceled
success_type _sdata
failure_type _fdata

Protected Functions

void success(const success_type &data)

Set Success Data

void failure(const failure_type &data)

Set Failure Data

void cancel()

mark as canceled

Template Struct start
Struct Documentation
template<typename ContextT, typename ...T>
struct udho::activities::start

Public Types

typedef activities::collector<ContextT, activities::dataset<T...>> collector_type
typedef activities::accessor<T...> accessor_type
typedef std::shared_ptr<collector_type> collector_ptr
typedef boost::signals2::signal<void()> signal_type

Public Functions

start(ContextT &ctx, const std::string &name)
collector_ptr collector() const
const accessor_type &accessor() const
accessor_type &accessor()
void operator()()
template<typename CombinatorT>
void done(CombinatorT cmb)
void success()

Public Members

signal_type _signal
collector_ptr _collector
accessor_type _accessor
Template Struct subtask
Struct Documentation
template<typename ActivityT, typename ...DependenciesT>
struct udho::activities::subtask

A subtask is an instantiation of an activity. The subtask reuses an activity to model different use cases by attaching dependencies. A subtask contains two shared pointers, one to the activity and another one to the combinator. The subtask cannot be instantiated directly by calling the subtask constructor. Instead call the static with method to instantiate.

Template Parameters
  • ActivityT: The activity

  • DependenciesT: The activities that has to be performed before performing ActivityT

Public Types

typedef ActivityT activity_type
typedef combinator<ActivityT, DependenciesT...> combinator_type
typedef subtask<ActivityT, DependenciesT...> self_type

Public Functions

subtask(const self_type &other)
std::shared_ptr<activity_type> activity()

shared pointer to the activity

template<typename V, typename ...DependenciesV>
self_type &done(subtask<V, DependenciesV...> &next)

execute task next after the current one

Parameters
  • next: the next subtask

template<typename V, typename ...DependenciesV>
self_type &after(subtask<V, DependenciesV...> &previous)

t2.after(t1) is equivalent to t1.done(t2)

Parameters
  • previous: the previous subtask

template<typename PreparatorT>
self_type &prepare(PreparatorT prep)

attach a callback which will be called with a reference to the activity after it has been instantiated and all its dependencies have completed.

self_type &required(bool flag)

Set required flag on or off. If a required subtask fails then all intermediate subtask that depend on it fails and the final callback is called immediately. By default all subtasks are required

self_type &cancel_if(typename activity_type::cancel_if_ftor cancelor)

Force cancelation of the activity even after it is successful to stop propagating to the next activities

Parameters
  • f: callback which should return true to signal cancelation

std::shared_ptr<activity_type> operator->()

returns the shared pointer to the actiivity

template<typename FunctionT>
self_type &if_errored(FunctionT ftor)

abort if canceled if ftor returns false. f will be called with the success if it has been canceled due to error

template<typename FunctionT>
self_type &if_failed(FunctionT ftor)

abort if canceled if ftor returns false. f will be called with the failue data if it has been canceled due to failure

template<typename FunctionT>
self_type &if_canceled(FunctionT ftor)

Public Static Functions

template<typename CollectorT, typename ...U>
self_type with(CollectorT collector, U&&... u)

Arguments for the constructor of the Activity

Friends

friend struct subtask
Template Struct subtask< ActivityT >
Struct Documentation
template<typename ActivityT>
struct udho::activities::subtask<ActivityT>

Spetialization for the root subtask in the task graph

Template Parameters
  • ActivityT: The activity

Public Types

typedef ActivityT activity_type
typedef subtask<ActivityT> self_type

Public Functions

subtask(const self_type &other)
std::shared_ptr<activity_type> activity()
template<typename V, typename ...DependenciesV>
self_type &done(subtask<V, DependenciesV...> &next)

execute task next after the current one

Parameters
  • next: the next subtask

template<typename ...U>
void operator()(U&&... u)

calls the operator()() of the activity and starts executing the graph

self_type &required(bool flag)

Set required flag on or off. If a required subtask fails then all intermediate subtask that depend on it fails and the final callback is called immediately. By default all subtasks are required

self_type &cancel_if(typename activity_type::cancel_if_ftor cancelor)

Force cancelation of the activity even after it is successful to stop propagating to the next activities

Parameters
  • f: callback which should return true to signal cancelation

std::shared_ptr<activity_type> operator->()

returns the shared pointer to the actiivity

template<typename FunctionT>
self_type &if_errored(FunctionT ftor)

abort if canceled if ftor returns false. f will be called with the success if it has been canceled due to error

template<typename FunctionT>
self_type &if_failed(FunctionT ftor)

abort if canceled if ftor returns false. f will be called with the failue data if it has been canceled due to failure

template<typename FunctionT>
self_type &if_canceled(FunctionT ftor)

Public Static Functions

template<typename CollectorT, typename ...U>
self_type with(CollectorT collector, U&&... u)

Arguments for the constructor of the Activity

Friends

friend struct subtask
Template Struct subtask< start< ContextT, T… > >
Struct Documentation
template<typename ContextT, typename ...T>
struct udho::activities::subtask<start<ContextT, T...>>

Public Types

typedef start<ContextT, T...> activity_type
typedef subtask<start<ContextT, T...>> self_type

Public Functions

subtask(const self_type &other)
std::shared_ptr<activity_type> activity()
template<typename V, typename ...DependenciesV>
self_type &done(subtask<V, DependenciesV...> &next)

execute task next after the current one

Parameters
  • next: the next subtask

void operator()()

calls the operator()() of the activity and starts executing the graph

std::shared_ptr<activity_type> operator->()

returns the shared pointer to the actiivity

Public Static Functions

self_type with(ContextT ctx, const std::string &name = "")

Arguments for the constructor of the Activity

Protected Functions

subtask(ContextT ctx, const std::string &name = "")

Protected Attributes

std::shared_ptr<activity_type> _activity

Friends

friend struct subtask
Template Struct app_
Struct Documentation
template<typename AppT, bool Ref = false>
struct udho::app_

Public Types

typedef app_<AppT, Ref> self_type
typedef self_type application_type

Public Functions

template<typename ...T>
app_(T... args)
std::string name() const
self_type &operator=(const std::string &path)
template<typename ContextT, typename Lambda>
int serve(ContextT &ctx, boost::beast::http::verb request_method, const std::string &subject, Lambda send)
void summary(std::vector<module_info> &stack) const
template<typename F>
void eval(F &fnc)

Public Members

std::string _path
AppT _app
Template Struct app_< AppT, true >
Struct Documentation
template<typename AppT>
struct udho::app_<AppT, true>

Public Types

typedef app_<AppT, true> self_type
typedef self_type application_type

Public Functions

app_(AppT &app)
std::string name() const
self_type &operator=(const std::string &path)
template<typename ContextT, typename Lambda>
int serve(ContextT &ctx, boost::beast::http::verb request_method, const std::string &subject, Lambda send)
void summary(std::vector<module_info> &stack) const
template<typename F>
void eval(F &fnc)

Public Members

std::string _path
AppT &_app
Struct assoc
Inheritance Relationships
Base Type
Struct Documentation
struct udho::assoc : public udho::detail::association_group<detail::association_leaf, void>

Public Functions

assoc()
Template Struct attachment
Inheritance Relationships
Base Types
  • public AuxT

  • public CacheT

  • public LoggerT

Struct Documentation
template<typename AuxT, typename LoggerT = void, typename CacheT = void>
struct udho::attachment : public AuxT, public CacheT, public LoggerT

logged stateful

Public Types

typedef attachment<AuxT, LoggerT, CacheT> self_type
typedef AuxT auxiliary_type
typedef LoggerT logger_type
typedef CacheT cache_type
typedef auxiliary_type::configuration_type configuration_type
typedef cache_type::shadow_type shadow_type

Public Functions

attachment(boost::asio::io_service &io, LoggerT &logger)
shadow_type &shadow()
AuxT &aux()
boost::asio::io_service &io()

Public Members

boost::asio::io_service &_io
shadow_type _shadow
Template Struct attachment< AuxT, LoggerT, void >
Inheritance Relationships
Base Types
  • public AuxT

  • public LoggerT

Struct Documentation
template<typename AuxT, typename LoggerT>
struct udho::attachment<AuxT, LoggerT, void> : public AuxT, public LoggerT

logged stateless

Public Types

typedef attachment<AuxT, LoggerT, void> self_type
typedef AuxT auxiliary_type
typedef LoggerT logger_type
typedef auxiliary_type::configuration_type configuration_type
typedef void shadow_type

Public Functions

attachment(boost::asio::io_service &io, LoggerT &logger)
int shadow()
AuxT &aux()
boost::asio::io_service &io()

Public Members

boost::asio::io_service &_io
Template Struct attachment< AuxT, void, CacheT >
Inheritance Relationships
Base Types
  • public AuxT

  • public CacheT

Struct Documentation
template<typename AuxT, typename CacheT>
struct udho::attachment<AuxT, void, CacheT> : public AuxT, public CacheT

quiet stateful

Public Types

typedef attachment<AuxT, void, CacheT> self_type
typedef AuxT auxiliary_type
typedef void logger_type
typedef CacheT cache_type
typedef auxiliary_type::configuration_type configuration_type
typedef cache_type::shadow_type shadow_type

Public Functions

attachment(boost::asio::io_service &io)
template<udho::logging::status Status>
self_type &operator()(const udho::logging::message<Status>&)
shadow_type &shadow()
AuxT &aux()
boost::asio::io_service &io()

Public Members

boost::asio::io_service &_io
shadow_type _shadow
Template Struct attachment< AuxT, void, void >
Inheritance Relationships
Base Type
  • public AuxT

Struct Documentation
template<typename AuxT>
struct udho::attachment<AuxT, void, void> : public AuxT

quiet stateless

Public Types

typedef attachment<AuxT, void, void> self_type
typedef AuxT auxiliary_type
typedef void logger_type
typedef void cache_type
typedef void shadow_type
typedef auxiliary_type::configuration_type configuration_type

Public Functions

attachment(boost::asio::io_service &io)
template<udho::logging::status Status>
self_type &operator()(const udho::logging::message<Status>&)
int shadow()
AuxT &aux()
boost::asio::io_service &io()

Public Members

boost::asio::io_service &_io
Template Struct basic_router
Inheritance Relationships
Base Type
Struct Documentation
template<typename AuxT = void>
struct udho::basic_router : public udho::overload_group<void, overload_terminal<AuxT>>

router maps HTTP requests with the callbacks

auto router = udho::router()
     | (udho::get(add).plain()   = "^/add/(\\d+)/(\\d+)$")
     | (udho::get(hello).plain() = "^/hello$");

Public Types

typedef overload_group<void, overload_terminal<AuxT>> base_type

Public Functions

template<typename ...Args>
basic_router(Args... args)

cnstructs a router

Friends

template<typename U, typename V, typename F>
friend overload_group<overload_group<U, V>, F> operator|(const overload_group<U, V> &group, const F &method)

adds a callback url mapping to the router by conjugating an overload in the overload meta-chain. The url mapping is provided by content wrappers like content_wrapper0 content_wrapper1 which attaches feasibility criteria like http resource path, http verb with a callback function. The url mapping can be built using get post put head etc.. See router for an example

Parameters
  • group: the overload group (which is actually the router or router attached with some url mappings)

  • method: url mapping

Template Struct bounded_str
Struct Documentation
template<typename Iterator>
struct udho::bounded_str

Public Types

typedef bounded_str<Iterator> self_type
typedef std::pair<Iterator, Iterator> pair_type

Public Functions

bounded_str(Iterator begin, Iterator end)
bounded_str(const self_type &other)
self_type &operator=(const self_type &other)
Iterator begin() const
Iterator end() const
bool invalid() const
bool valid() const
template<typename Itarator>
void copy(Itarator it) const
template<typename ContainerT>
ContainerT copied() const
std::size_t size() const

Public Members

pair_type _pair
Template Struct bridge
Struct Documentation
template<typename ConfigT>
struct udho::bridge

Todo:

write docs

Public Types

typedef ConfigT configuration_type
typedef bridge<ConfigT> self_type

Public Functions

bridge(boost::asio::io_service &io)
configuration_type &config()
const configuration_type &config() const
boost::filesystem::path docroot() const
boost::filesystem::path tmplroot() const
std::string contents(const boost::filesystem::path &local_path) const
boost::beast::http::response<boost::beast::http::file_body> file(const std::string &path, const ::udho::defs::request_type &req, std::string mime = "") const
template<typename RequestT, typename GroupT>
std::string render(const std::string &path, const udho::detail::context_common<self_type, RequestT> &ctx, ::udho::lookup_table<GroupT> &scope) const
template<typename RequestT, typename DataT>
std::string render(const std::string &path, const udho::detail::context_common<self_type, RequestT> &ctx, ::udho::prepared<DataT> &data) const
template<typename RequestT, typename U, typename V>
std::string render(const std::string &path, const udho::detail::context_common<self_type, RequestT> &ctx, ::udho::prepared_group<U, V> &group) const
template<typename RequestT, typename ...DataT>
std::string render(const std::string &path, const udho::detail::context_common<self_type, RequestT> &ctx, const DataT&... data) const
std::string render(const std::string &path) const
template<typename ContextT>
detail::client_connection_wrapper<ContextT> client(ContextT ctx, udho::config<udho::client_options> options)

Public Members

boost::asio::io_service &_io
configuration_type _config
Template Struct abstract_engine
Struct Documentation
template<typename KeyT, typename ValueT = void>
struct udho::cache::abstract_engine

Public Types

typedef KeyT key_type
typedef ValueT value_type
typedef content<ValueT> content_type
typedef abstract_engine<KeyT, ValueT> self_type

Public Functions

std::size_t size() const = 0
bool exists(const key_type &key) const = 0
void create(const key_type &key, const content_type &content) = 0
content_type retrieve(const key_type &key) const = 0
bool update(const key_type &key, const content_type &content) = 0
bool remove(const key_type &key) = 0
boost::posix_time::ptime created(const key_type &key) const
boost::posix_time::ptime updated(const key_type &key) const
boost::posix_time::time_duration age(const key_type &key) const
boost::posix_time::time_duration idle(const key_type &key) const
template<typename U = value_type>
std::enable_if<!std::is_same<U, void>::value>::type insert(const key_type &key, const U &value)
template<typename U = value_type>
std::enable_if<std::is_same<U, void>::value>::type insert(const key_type &key)
template<typename U = value_type>
std::enable_if<!std::is_same<U, void>::value, bool>::type update(const key_type &key, const U &value)
bool update(const key_type &key)
Template Struct content
Struct Documentation
template<typename T = void>
struct udho::cache::content

Public Types

typedef T value_type
typedef content<T> self_type

Public Functions

content()
content(const value_type &value)
boost::posix_time::ptime created() const
boost::posix_time::ptime updated() const
boost::posix_time::time_duration age() const
boost::posix_time::time_duration idle() const
const value_type &value() const
void update(const self_type &other)
void update(const value_type &value)
void update()
template<class Archive>
void serialize(Archive &ar, const unsigned int version)

Public Members

boost::posix_time::ptime _created
boost::posix_time::ptime _updated
value_type _value

Friends

friend class boost::serialization::access
Template Struct content< void >
Struct Documentation
template<>
struct udho::cache::content<void>

Public Types

typedef void value_type
typedef content self_type

Public Functions

content()
template<typename U>
content(U)
boost::posix_time::ptime created() const
boost::posix_time::ptime updated() const
boost::posix_time::time_duration age() const
boost::posix_time::time_duration idle() const
void update()
void update(const self_type&)
template<class Archive>
void serialize(Archive &ar, const unsigned int version)

Public Members

boost::posix_time::ptime _created
boost::posix_time::ptime _updated

Friends

friend class boost::serialization::access
Template Struct driver
Struct Documentation
template<typename KeyT, typename ValueT = void>
struct udho::cache::driver

Public Types

typedef KeyT key_type
typedef ValueT value_type
typedef content<ValueT> content_type
typedef abstract_engine<KeyT, ValueT> abstract_engine_type

Public Functions

driver(abstract_engine_type &e)
std::size_t size() const
bool exists(const key_type &key) const
template<typename U = value_type>
std::enable_if<!std::is_same<U, void>::value>::type insert(const key_type &key, const U &value)
template<typename U = value_type>
std::enable_if<std::is_same<U, void>::value>::type insert(const key_type &key)
content_type retrieve(const key_type &key) const
bool update(const key_type &key, const content_type &content)
bool update(const key_type &key)
template<typename U = value_type>
std::enable_if<std::is_same<U, ValueT>::value, bool>::type update(const key_type &key, const U &value)
bool remove(const key_type &key)
boost::posix_time::ptime created(const key_type &key) const
boost::posix_time::ptime updated(const key_type &key) const
boost::posix_time::time_duration age(const key_type &key) const
boost::posix_time::time_duration idle(const key_type &key) const

Public Members

abstract_engine_type &_engine
Template Struct engine
Inheritance Relationships
Base Types
Struct Documentation
template<typename StorageT>
struct udho::cache::engine : private StorageT, public udho::cache::abstract_engine<StorageT::key_type, StorageT::value_type>

Public Types

typedef StorageT storage_type
typedef abstract_engine<typename StorageT::key_type, typename StorageT::value_type> abstract_engine_type
typedef StorageT::key_type key_type
typedef StorageT::value_type value_type
typedef StorageT::content_type content_type
typedef engine<StorageT> self_type
typedef StorageT::config_type config_type

Public Functions

engine(const config_type &config)
std::size_t size() const final
bool exists(const key_type &key) const final
void create(const key_type &key, const content_type &content) final
content_type retrieve(const key_type &key) const final
bool update(const key_type &key, const content_type &content) final
bool remove(const key_type &key) final
Template Struct flake
Inheritance Relationships
Derived Type
Struct Documentation
template<typename KeyT, typename T>
struct udho::cache::flake

copiable flake containes a reference to the actual registry object

Subclassed by udho::cache::shadow< KeyT, T >

Public Types

typedef KeyT key_type
typedef T value_type
typedef registry<key_type, T> registry_type
typedef flake<KeyT, T> flake_type
typedef flake_type self_type

Public Functions

template<template<typename, typename> class StorageT, typename ...X>
flake(store<StorageT, KeyT, X...> &store)
bool exists(const key_type &key) const
value_type at(const key_type &key) const
void insert(const key_type &key, const value_type &value)
void update(const key_type &key, const value_type &value)
std::size_t size(const key_type &key) const
bool remove(const key_type &key)
boost::posix_time::ptime created(const key_type &key) const
boost::posix_time::ptime updated(const key_type &key) const
boost::posix_time::time_duration age(const key_type &key) const
boost::posix_time::time_duration idle(const key_type &key) const
Template Struct generator
Struct Documentation
template<typename KeyT>
struct generator
Template Struct generator< boost::uuids::uuid >
Struct Documentation
template<>
struct udho::cache::generator<boost::uuids::uuid>

Public Functions

boost::uuids::uuid parse(const std::string &key)
boost::uuids::uuid generate()
Template Struct master
Inheritance Relationships
Base Type
Derived Type
Struct Documentation
template<typename KeyT>
struct udho::cache::master : public udho::cache::driver<KeyT>

Subclassed by udho::cache::store< StorageT, KeyT, T >

Public Types

typedef KeyT key_type
typedef driver<KeyT> storage_type
typedef abstract_engine<KeyT> abstract_engine_type
typedef master<KeyT> self_type

Public Functions

master(abstract_engine_type &e)
master(const self_type&) = delete
master(self_type&&) = default
bool issued(const key_type &key) const
void issue(const key_type &key)
Template Struct registry
Inheritance Relationships
Base Type
Derived Type
Struct Documentation
template<typename KeyT, typename T>
struct udho::cache::registry : public udho::cache::driver<KeyT, T>

Subclassed by udho::cache::store< StorageT, KeyT, T >

Public Types

typedef registry<KeyT, T> self_type
typedef KeyT key_type
typedef T value_type
typedef abstract_engine<KeyT, T> abstract_engine_type

Public Functions

registry(abstract_engine_type &e)
registry(const self_type&) = delete
registry(self_type&&) = default
value_type at(const key_type &key) const
Template Struct shadow
Inheritance Relationships
Base Type
Struct Documentation
template<typename KeyT, typename ...T>
struct udho::cache::shadow : public udho::cache::flake<KeyT, T>

copiable shadow of a store reference.

user u("Neel");
appearence a("red");
udho::cache::store<std::string, user, appearence> store;
udho::cache::shadow<std::string, user, appearence> shadow_ua(store);
shadow_ua.insert("x", u);
shadow_ua.insert("x", a);
std::cout << std::boolalpha << shadow_ua.exists<user>("x") << std::endl; // true
std::cout << std::boolalpha << shadow_ua.exists<appearence>("x") << std::endl; // true
std::cout << shadow_ua.get<user>("x").name << std::endl; // Neel
std::cout << shadow_ua.get<appearence>("x").color << std::endl; // red
udho::cache::shadow<std::string, user> shadow_u(store); 
std::cout << std::boolalpha << shadow_u.exists<user>("x") << std::endl; // true
std::cout << std::boolalpha << shadow_u.get<user>("x").name << std::endl; // true
std::cout << shadow_u.exists<appearence>("x") << std::endl; // won't compile
udho::cache::shadow<std::string, user> shadow_u2(shadow_u); // copiable
udho::cache::shadow<std::string, user> shadow_u3(shadow_ua); // narrowable
udho::cache::shadow<std::string, appearence> shadow_a(store); // unordered
std::cout << shadow_a.exists<appearence>("x") << std::endl; // true
std::cout << shadow_a.get<appearence>("x").color << std::endl; // red
udho::cache::shadow<std::string> shadow_none(shadow_ua);

Public Types

typedef KeyT key_type
typedef shadow<key_type, T...> self_type
typedef self_type shadow_type
typedef master<key_type> master_type

Public Functions

template<template<typename, typename> class StorageT, typename ...X>
shadow(store<StorageT, key_type, X...> &store)
template<typename ...X>
shadow(shadow<key_type, X...> &other)
bool issued(const key_type &key) const
void issue(const key_type &key)
template<typename V>
bool exists(const key_type &key) const
template<typename V>
V at(const key_type &key) const
template<typename V>
V get(const key_type &key, const V &def = V()) const
template<typename V>
void set(const key_type &key, const V &value)
template<typename V>
void insert(const key_type &key, const V &value)
std::size_t size() const
template<typename V>
std::size_t size(const key_type &key) const
bool remove(const key_type &key)
template<typename V>
bool remove(const key_type &key)
boost::posix_time::ptime created(const key_type &key) const
boost::posix_time::ptime updated(const key_type &key) const
boost::posix_time::time_duration age(const key_type &key) const
boost::posix_time::time_duration idle(const key_type &key) const
template<typename V>
boost::posix_time::ptime created(const key_type &key) const
template<typename V>
boost::posix_time::ptime updated(const key_type &key) const
template<typename V>
boost::posix_time::time_duration age(const key_type &key) const
template<typename V>
boost::posix_time::time_duration idle(const key_type &key) const

Public Members

master_type &_master
Template Struct disk
Struct Documentation
template<typename KeyT, typename ValueT = void>
struct udho::cache::storage::disk

Public Types

typedef KeyT key_type
typedef ValueT value_type
typedef content<ValueT> content_type
typedef std::map<key_type, content_type> map_type
typedef storage::disk<KeyT, ValueT> self_type
typedef udho::config<udho::configs::session> session_config_type
typedef session_config_type config_type

Public Functions

disk(const session_config_type &config)
disk(const self_type&) = delete
disk(self_type&&) = default
std::size_t size() const
bool exists(const key_type &key) const
void create(const key_type &key, const content_type &content)
content_type retrieve(const key_type &key) const
bool update(const key_type &key, const content_type &content)
bool remove(const key_type &key)

Protected Functions

boost::filesystem::path storage() const
udho::configs::session::format format() const
std::string extension() const
std::string filename(const key_type &key) const
boost::filesystem::path path(const key_type &key) const
void save(udho::configs::session::format format, std::ofstream &file, const content_type &content)
void load(udho::configs::session::format format, std::ifstream &file, content_type &content) const
void save(std::ofstream &file, const content_type &content)
void load(std::ifstream &file, content_type &content) const

Protected Attributes

const session_config_type &_config
std::string _name
boost::mutex _mutex
Template Struct memory
Struct Documentation
template<typename KeyT, typename ValueT = void>
struct udho::cache::storage::memory

Public Types

typedef KeyT key_type
typedef ValueT value_type
typedef content<ValueT> content_type
typedef std::map<key_type, content_type> map_type
typedef storage::memory<KeyT, ValueT> self_type
typedef udho::config<udho::configs::session> session_config_type
typedef session_config_type config_type

Public Functions

memory(const session_config_type &config)
memory(const self_type&) = delete
memory(self_type&&) = default
std::size_t size() const
bool exists(const key_type &key) const
void create(const key_type &key, const content_type &content)
content_type retrieve(const key_type &key) const
bool update(const key_type &key, const content_type &content)
bool remove(const key_type &key)

Protected Attributes

const session_config_type &_config
map_type _storage
boost::mutex _mutex
Struct redis
Struct Documentation
struct redis
Template Struct store
Inheritance Relationships
Base Types
Struct Documentation
template<template<typename, typename> class StorageT, typename KeyT, typename ...T>
struct udho::cache::store : private udho::cache::engine<StorageT<KeyT, void>>, private udho::cache::engine<StorageT<KeyT, T>>, protected udho::cache::master<KeyT>, public udho::cache::registry<KeyT, T>

A type safe non-copiable storage

user u("Neel");
appearence a("red");
udho::cache::store<std::string, user, appearence> store;
store.insert("x", u);
store.insert("x", a);
store.exists<user>();

Public Types

typedef KeyT key_type
typedef master<KeyT> master_type
typedef shadow<KeyT, T...> shadow_type
typedef store<StorageT, KeyT, T...> self_type
typedef engine<StorageT<KeyT, void>>::config_type config_type

Public Functions

store(const config_type &config)
store(const self_type&) = delete
template<typename V>
bool exists(const key_type &key) const
template<typename V>
V get(const key_type &key, const V &def = V()) const
template<typename V>
V at(const key_type &key)
template<typename V>
void insert(const key_type &key, const V &value)
template<typename V>
std::size_t size(const key_type &key) const
template<typename V>
bool remove(const key_type &key)
boost::posix_time::ptime created(const key_type &key) const
boost::posix_time::ptime updated(const key_type &key) const
boost::posix_time::time_duration age(const key_type &key) const
boost::posix_time::time_duration idle(const key_type &key) const

Friends

friend struct shadow< KeyT, T… >
Template Struct client_options_
Inheritance Relationships
Derived Type
Struct Documentation
template<typename T = void>
struct udho::client_options_

Subclassed by udho::config< udho::client_options >

Public Functions

client_options_()
void set(verify_certificate_t, bool v)
bool get(verify_certificate_t) const
void set(follow_redirect_t, bool v)
bool get(follow_redirect_t) const
void set(http_version_t, int v)
int get(http_version_t) const

Public Members

bool _verify_certificate
bool _follow_redirect
int _http_version

Public Static Attributes

const struct udho::client_options_::verify_certificate_t verify_certificate
const struct udho::client_options_::follow_redirect_t follow_redirect
const struct udho::client_options_::http_version_t http_version
struct follow_redirect_t

Public Types

typedef client_options_<T> component
struct http_version_t

Public Types

typedef client_options_<T> component
struct verify_certificate_t

Public Types

typedef client_options_<T> component
Struct client_options_::follow_redirect_t
Nested Relationships

This struct is a nested type of Template Struct client_options_.

Struct Documentation
struct udho::client_options_::follow_redirect_t

Public Types

typedef client_options_<T> component
Struct client_options_::http_version_t
Nested Relationships

This struct is a nested type of Template Struct client_options_.

Struct Documentation
struct udho::client_options_::http_version_t

Public Types

typedef client_options_<T> component
Struct client_options_::verify_certificate_t
Nested Relationships

This struct is a nested type of Template Struct client_options_.

Struct Documentation
struct udho::client_options_::verify_certificate_t

Public Types

typedef client_options_<T> component
Template Struct deferred
Struct Documentation
template<typename OutputT>
struct udho::compositors::deferred

No output will be returned. ctx.respond(...) will be used instead

See

udho::context::respond

Public Types

typedef OutputT response_type

Public Functions

template<typename ...T>
void operator()(T...)
std::string name() const
Template Struct mimed
Struct Documentation
template<typename OutputT>
struct udho::compositors::mimed

mimed content. The returned output will be sent with the given mime type

Public Types

typedef boost::beast::http::response<boost::beast::http::string_body> response_type

Public Functions

mimed(const std::string &mime)
template<typename ContextT>
response_type operator()(const ContextT &ctx, const OutputT &out)
std::string name() const

Public Members

std::string _mime
Template Struct transparent
Struct Documentation
template<typename OutputT>
struct udho::compositors::transparent

raw boost::beast HTTP response content

Public Types

typedef OutputT response_type

Public Functions

template<typename ContextT>
response_type &&operator()(const ContextT&, OutputT &&out)
std::string name() const
Template Struct config
Inheritance Relationships
Base Type
  • public T

Derived Types
Struct Documentation
template<typename T>
struct udho::config : public T

Subclassed by udho::configuration< detail::url_data >, udho::configuration< T >

Public Types

typedef config<T> self_type

Public Functions

template<typename K>
auto operator[](const K&) const
template<typename K>
proxy<K, self_type> operator[](const K&)
Template Struct config< configs::server_<> >
Inheritance Relationships
Base Type
Struct Documentation
template<>
struct udho::config<configs::server_<>> : public udho::configs::server_<>

Public Types

typedef config<configs::server_<>> self_type

Public Functions

template<typename K>
auto operator[](const K&) const
template<typename K>
proxy<K, self_type> operator[](const K&)
void mime(const std::string &extension, const std::string &type)
Template Struct form_
Struct Documentation
template<typename T = void>
struct form_
Template Struct logger_
Struct Documentation
template<typename T = void>
struct logger_
Template Struct router_
Struct Documentation
template<typename T = void>
struct router_
Template Struct server_
Struct Documentation
template<typename T = void>
struct udho::configs::server_

Public Types

typedef std::map<std::string, std::string> mime_map

Public Functions

server_()
void set(document_root_t, const boost::filesystem::path &v)
boost::filesystem::path get(document_root_t) const
void set(template_root_t, const boost::filesystem::path &v)
boost::filesystem::path get(template_root_t) const
void set(mime_default_t, std::string v)
std::string get(mime_default_t) const
const mime_map &get(mimes_t) const
std::string mime(const std::string &extension) const
void mime(const std::string &extension, const std::string &type)

Public Members

boost::filesystem::path _document_root
boost::filesystem::path _template_root
std::string _mime_default
mime_map _mimes

Public Static Attributes

const struct udho::configs::server_::document_root_t document_root
const struct udho::configs::server_::template_root_t template_root
const struct udho::configs::server_::mime_default_t mime_default
const struct udho::configs::server_::mimes_t mimes
struct document_root_t

Public Types

typedef server_<T> component
struct mime_default_t

Public Types

typedef server_<T> component
struct mimes_t

Public Types

typedef server_<T> component
struct template_root_t

Public Types

typedef server_<T> component
Struct server_::document_root_t
Nested Relationships

This struct is a nested type of Template Struct server_.

Struct Documentation
struct udho::configs::server_::document_root_t

Public Types

typedef server_<T> component
Struct server_::mime_default_t
Nested Relationships

This struct is a nested type of Template Struct server_.

Struct Documentation
struct udho::configs::server_::mime_default_t

Public Types

typedef server_<T> component
Struct server_::mimes_t
Nested Relationships

This struct is a nested type of Template Struct server_.

Struct Documentation
struct udho::configs::server_::mimes_t

Public Types

typedef server_<T> component
Struct server_::template_root_t
Nested Relationships

This struct is a nested type of Template Struct server_.

Struct Documentation
struct udho::configs::server_::template_root_t

Public Types

typedef server_<T> component
Template Struct session_
Struct Documentation
template<typename T = void>
struct udho::configs::session_

Public Types

enum format

Values:

enumerator text
enumerator binary
enumerator xml

Public Functions

session_()
void set(extension_t, const std::string &e)
std::string get(extension_t) const
void set(serialization_t, format v)
format get(serialization_t) const
void set(path_t, const boost::filesystem::path &p)
boost::filesystem::path get(path_t) const
void set(id_t, std::string v)
std::string get(id_t) const

Public Members

std::string _extension
format _serialization
boost::filesystem::path _path
std::string _id

Public Static Attributes

const struct udho::configs::session_::extension_t extension
const struct udho::configs::session_::serialization_t serialization
const struct udho::configs::session_::path_t path
const struct udho::configs::session_::id_t id
struct extension_t

Public Types

typedef session_<T> component
struct id_t

Public Types

typedef session_<T> component
struct path_t

Public Types

typedef session_<T> component
struct serialization_t

Public Types

typedef session_<T> component
Struct session_::extension_t
Nested Relationships

This struct is a nested type of Template Struct session_.

Struct Documentation
struct udho::configs::session_::extension_t

Public Types

typedef session_<T> component
Struct session_::id_t
Nested Relationships

This struct is a nested type of Template Struct session_.

Struct Documentation
struct udho::configs::session_::id_t

Public Types

typedef session_<T> component
Struct session_::path_t
Nested Relationships

This struct is a nested type of Template Struct session_.

Struct Documentation
struct udho::configs::session_::path_t

Public Types

typedef session_<T> component
Struct session_::serialization_t
Nested Relationships

This struct is a nested type of Template Struct session_.

Struct Documentation
struct udho::configs::session_::serialization_t

Public Types

typedef session_<T> component
Template Struct configuration
Inheritance Relationships
Base Type
Struct Documentation
template<typename ...T>
struct udho::configuration : public udho::config<T>

typedef udho::configuration<udho::config::server, udho::config::router, udho::config::logging, udho::config::view> configuration; configuration config; config[udho::configs::server::document_root] = “/path/to/document/root”;

Public Functions

template<typename K>
auto operator[](const K &k) const
template<typename K>
auto operator[](const K &k)
Struct connection::send_lambda
Nested Relationships

This struct is a nested type of Template Class connection.

Struct Documentation
struct udho::connection::send_lambda

Public Functions

send_lambda(self_type &self)
template<bool isRequest, class Body, class Fields>
void operator()(http::message<isRequest, Body, Fields> &msg) const
template<bool isRequest, class Body, class Fields>
void operator()(http::message<isRequest, Body, Fields> &&msg) const

Public Members

self_type &self_
Template Struct content_wrapper0
Struct Documentation
template<typename F>
struct udho::content_wrapper0

mapping of an url with a http request defined by http method and the url pattern

A content wrapper is defined by a HTTP verb, a callback and a url pattern. A content wrapper uses a compositor that prepares a HTTP response based on the callbacks return

Template Parameters
  • F: callback type

Public Types

typedef content_wrapper0<F> self_type

Public Functions

content_wrapper0(boost::beast::http::verb method, F ftor)
template<template<typename> class CompositorT = compositors::transparent>
auto unwrap(CompositorT<typename internal::function_signature<F>::return_type> compositor = CompositorT<typename internal::function_signature<F>::return_type>())
auto deferred()
auto raw()

raw content delivery using transparent compositor

auto operator=(const std::string &pattern)

attach an url pattern

auto mimed(std::string mime)

applies a mimed compositor on the return

Parameters
  • mime: returned mime type

auto html()

shorthand for html mime type

auto plain()

shorthand for plain text mime type

auto json()

shorthand for json mime type

Public Members

F _ftor
boost::beast::http::verb _method
Template Struct content_wrapper1
Struct Documentation
template<typename F, typename A1>
struct udho::content_wrapper1

mapping of an url with a http request defined by http method and the url pattern

A content wrapper is defined by a HTTP verb, a callback and a url pattern. A content wrapper uses a compositor that prepares a HTTP response based on the callbacks return

Note

binds a variable by reference with the mapping, which might be a database connection or some persistent stateful object

Template Parameters
  • F: callback type

  • A1: type of the passed value which will be passed by reference

Public Types

typedef content_wrapper1<F, A1> self_type

Public Functions

content_wrapper1(boost::beast::http::verb method, F ftor, A1 &a1)
template<template<typename> class CompositorT = compositors::transparent>
auto unwrap(CompositorT<typename internal::function_signature<F>::return_type> compositor = CompositorT<typename internal::function_signature<F>::return_type>())
auto raw()

raw content delivery using transparent compositor

auto operator=(const std::string &pattern)

attach an url pattern

auto mimed(std::string mime)

applies a mimed compositor on the return

Parameters
  • mime: returned mime type

auto html()

shorthand for html mime type

auto plain()

shorthand for plain text mime type

auto json()

shorthand for json mime type

Public Members

F _ftor
A1 &_a1
boost::beast::http::verb _method
Template Struct context
Inheritance Relationships
Base Type
Struct Documentation
template<typename AuxT, typename RequestT, typename ShadowT>
struct udho::context : public udho::detail::context_common<AuxT, RequestT>

A Stateful context passed to all callables along with the arguments. The context is always the first argument to the callable. Even if the callable takes no arguments, it must take the context as the first argument. A stateful context should be used in callables that need to use session states.

Note

instead of instantiating this template directly use udho::contexts::stateful

Template Parameters
  • AuxT: bridge between the server and the callable

  • RequestT: HTTP request type

  • ShadowT: the session data structure

Public Types

typedef detail::context_common<AuxT, RequestT> base_type
typedef RequestT request_type
typedef ShadowT shadow_type
typedef shadow_type::key_type key_type
typedef context<AuxT, request_type, shadow_type> self_type
typedef udho::session_<request_type, shadow_type> session_type

Public Functions

template<typename ...V>
context(AuxT &aux, const RequestT &request, udho::cache::shadow<key_type, V...> &shadow)
template<typename OtherShadowT>
context(context<AuxT, RequestT, OtherShadowT> &other)
session_type &session()

access the HTTP Session

See

udho::session_

Public Members

session_type _session
Template Struct context< AuxT, RequestT, void >
Inheritance Relationships
Base Type
Struct Documentation
template<typename AuxT, typename RequestT>
struct udho::context<AuxT, RequestT, void> : public udho::detail::context_common<AuxT, RequestT>

A Stateless context passed to all callables along with the arguments. he context is always the first argument to the callable. Even if the callable takes no arguments, it must take the context as the first argument. A stateless context should be used in callables that need not to use session states.

Note

instead of instantiating this template directly use udho::contexts::stateless

Template Parameters
  • AuxT: bridge between the server and the callable

  • RequestT: HTTP request type

Public Types

typedef void shadow_type
typedef context<AuxT, RequestT, void> self_type
typedef detail::context_common<AuxT, RequestT> base_type

Public Functions

template<typename OtherShadowT>
context(context<AuxT, RequestT, OtherShadowT> &other)
Template Struct cookies_
Struct Documentation
template<typename RequestT>
struct udho::cookies_

Public Types

typedef RequestT request_type
typedef boost::beast::http::header<true> headers_type
typedef std::map<std::string, std::string> cookie_jar_type

Public Functions

cookies_(const request_type &request, headers_type &headers)
void collect()
template<typename V>
void add(const cookie_<V> &c)
template<typename V>
void add(const std::string &key, const V &value)
bool exists(const std::string &key) const
template<typename V>
V get(const std::string &key) const

Public Members

const request_type &_request
headers_type &_headers
cookie_jar_type _jar
Template Struct data_helper
Struct Documentation
template<typename H, typename T, bool IsPrepared = detail::is_prepared<H>::value>
struct data_helper
Template Struct data_helper< H, T, false >
Struct Documentation
template<typename H, typename T>
struct udho::data_helper<H, T, false>

Public Types

typedef prepared_group<udho::prepared<T>, prepared_group<H, void>> result_type

Public Static Functions

result_type data(const H &head, const T &tail)
Template Struct data_helper< H, T, true >
Struct Documentation
template<typename H, typename T>
struct udho::data_helper<H, T, true>

Public Types

typedef prepared_group<udho::prepared<T>, prepared_group<udho::prepared<H>, void>> result_type

Public Static Functions

result_type data(const H &head, const T &tail)
Struct declaration
Struct Documentation
struct udho::declaration

Public Functions

declaration(const std::string &key, std::size_t depth)
bool operator<(const declaration &decl) const

Public Members

std::string _id
std::string _ref
std::size_t _depth
Template Struct association
Inheritance Relationships
Base Type
Struct Documentation
template<typename F>
struct udho::detail::association : public udho::detail::responder<F, F::result_type>

Public Types

typedef F callback_type
typedef responder<F, typename F::result_type> responder_type
typedef responder_type::result_type result_type

Public Functions

association(const std::string &key, callback_type callback)
bool matched(const std::string &key) const

Public Members

std::string _key
Template Struct association_group
Struct Documentation
template<typename U, typename V = void>
struct udho::detail::association_group

association_group<X, void> | Y                                             => association_group<Y, association_group<X, void>>
association_group<Y, association_group<X, void>> | Z                       => association_group<Z, association_group<Y, association_group<X, void>>>
association_group<Z, association_group<Y, association_group<X, void>>> | T => association_group<T, association_group<Z, association_group<Y, association_group<X, void>>>>

Public Types

typedef U head_type
typedef V tail_type
typedef head_type::result_type result_type
typedef association_group<U, V> self_type

Public Functions

association_group(const head_type &head, const tail_type &tail)
bool matched(const std::string &key) const
bool exists(const std::string &key) const
auto call(const std::string &key) const
auto call(const std::string &key)
bool iterable() const
bool leaf() const
std::size_t count() const
std::vector<std::string> keys() const

Public Members

head_type _head
tail_type _tail
Template Struct association_group< U, void >
Struct Documentation
template<typename U>
struct udho::detail::association_group<U, void>

Public Types

typedef U head_type
typedef void tail_type
typedef head_type::result_type result_type
typedef association_group<U, void> self_type

Public Functions

association_group(const head_type &head)
bool matched(const std::string &key) const
bool exists(const std::string &key) const
auto call(const std::string &key) const
auto call(const std::string &key)
bool iterable() const
bool leaf() const
std::size_t count() const
std::vector<std::string> keys() const

Public Members

head_type _head
Template Struct association_group_visitor
Struct Documentation
template<typename GroupT, bool IsPrepared = is_prepared<typename GroupT::head_type::result_type>::value>
struct association_group_visitor

An association group visitor visits the association group returned by T::index() where T is a subclass of udho::prepare

Template Struct association_group_visitor< association_group< U, V >, false >
Struct Documentation
template<typename U, typename V>
struct udho::detail::association_group_visitor<association_group<U, V>, false>

not the last association, does not have nested objects

Public Types

typedef association_group<U, V> group_type
typedef V tail_type
typedef association_group_visitor<tail_type> tail_visitor_type

Public Functions

association_group_visitor(const group_type &group)
template<typename CallbackT>
bool find(CallbackT &callback, const std::string &key) const
std::size_t count(const std::string &key) const
std::vector<std::string> keys(const std::string &key) const

Public Members

const group_type &_group
tail_visitor_type _tail_visitor
Template Struct association_group_visitor< association_group< U, V >, true >
Struct Documentation
template<typename U, typename V>
struct udho::detail::association_group_visitor<association_group<U, V>, true>

not the last association, have nested objects

Public Types

typedef association_group<U, V> group_type
typedef group_type::result_type result_type
typedef V tail_type
typedef association_group_visitor<tail_type> tail_visitor_type

Public Functions

association_group_visitor(const group_type &group)
template<typename CallbackT>
bool find(CallbackT &callback, const std::string &key) const
std::size_t count(const std::string &key) const
std::vector<std::string> keys(const std::string &key) const

Public Members

const group_type &_group
tail_visitor_type _tail_visitor
Template Struct association_group_visitor< association_group< U, void >, false >
Struct Documentation
template<typename U>
struct udho::detail::association_group_visitor<association_group<U, void>, false>

last association, does not have nested object

Public Types

typedef association_group<U, void> group_type

Public Functions

association_group_visitor(const group_type &group)
template<typename CallbackT>
bool find(CallbackT &callback, const std::string &key) const
std::size_t count(const std::string&) const
std::vector<std::string> keys(const std::string&) const

Public Members

const group_type &_group
Struct association_leaf
Struct Documentation
struct udho::detail::association_leaf

Public Types

typedef void result_type

Public Functions

bool matched(const std::string&) const
bool call(const std::string&) const
template<typename C>
bool invoke(const std::string&, C) const
Template Struct association_lexical_extractor
Struct Documentation
template<typename ValueT>
struct udho::detail::association_lexical_extractor

Public Functions

association_lexical_extractor()
void operator()(ValueT value)
template<typename T>
std::enable_if<!std::is_same<ValueT, T>::value && is_streamable<std::stringstream, T>::value>::type operator()(const T &value)
template<typename T>
std::enable_if<!std::is_same<ValueT, T>::value && !is_streamable<std::stringstream, T>::value>::type operator()(const T &value)
ValueT value() const
void clear()

Public Members

ValueT _value
bool _success
Template Struct association_value_extractor
Struct Documentation
template<typename ValueT>
struct udho::detail::association_value_extractor

Public Functions

association_value_extractor()
void operator()(ValueT value)
template<typename T>
std::enable_if<!std::is_same<ValueT, T>::value>::type operator()(const T&)
ValueT value() const
void clear()

Public Members

ValueT _value
bool _success
Template Struct async_result
Inheritance Relationships
Derived Types
Struct Documentation
template<typename ContextT>
struct udho::detail::async_result

Subclassed by udho::detail::http_client_connection< ContextT >, udho::detail::https_client_connection< ContextT >

Public Types

typedef ContextT context_type
typedef async_result<ContextT> self_type
typedef udho::config<udho::client_options> options_type
typedef boost::function<void(ContextT, const boost::beast::http::response<boost::beast::http::string_body>&)> success_callback_type
typedef boost::function<void(ContextT, const boost::beast::error_code&)> error_callback_type
typedef boost::function<void(const boost::beast::error_code&)> error_callback_type_aux
typedef boost::function<void(const boost::beast::http::response<boost::beast::http::string_body>&)> success_callback_type_aux_r
typedef boost::function<void(ContextT, boost::beast::http::status, const std::string&)> success_callback_type_aux_xsc
typedef boost::function<void(ContextT, const std::string&)> success_callback_type_aux_xc
typedef boost::function<void(boost::beast::http::status, const std::string&)> success_callback_type_aux_sc
typedef boost::function<void(const std::string&)> success_callback_type_aux_c
typedef boost::function<void()> finally_callback_type

Public Functions

async_result() = delete
async_result(const context_type &ctx, options_type options)
async_result(const self_type &other) = delete
template<typename KeyT, typename ValueT>
self_type &option(KeyT key, ValueT value)
template<typename KeyT>
auto option(KeyT key) const
void success(const boost::beast::http::response<boost::beast::http::string_body> &res)
void failure(const boost::beast::error_code &ec)
void finish()
self_type &then(success_callback_type cb)
self_type &failed(error_callback_type cb)
self_type &finally(finally_callback_type f)
self_type &error(error_callback_type_aux cb)
self_type &fetch(success_callback_type_aux_xsc cb)
self_type &body(success_callback_type_aux_xc cb)
self_type &after(success_callback_type_aux_r cb)
self_type &done(success_callback_type_aux_sc cb)
self_type &content(success_callback_type_aux_c cb)
context_type &context()

Public Members

context_type _ctx
success_callback_type _callback
error_callback_type _ecallback
finally_callback_type _fcallback
options_type _options
Template Struct client_connection_wrapper
Struct Documentation
template<typename ContextT>
struct udho::detail::client_connection_wrapper

Public Types

typedef client_connection_wrapper<ContextT> self_type
typedef udho::detail::async_result<ContextT> result_type
typedef udho::config<udho::client_options> options_type

Public Functions

client_connection_wrapper(boost::asio::io_service &io, ContextT ctx, options_type options)
result_type &request(boost::beast::http::verb method, udho::url url)
result_type &get(udho::url url)
result_type &post(udho::url url)
result_type &put(udho::url url)
result_type &get(const std::string &url)
result_type &post(const std::string &url)
result_type &put(const std::string &url)

Public Members

boost::asio::io_service &_io
ContextT _context
options_type _options
Template Struct context_common
Inheritance Relationships
Derived Types
Struct Documentation
template<typename AuxT, typename RequestT>
struct udho::detail::context_common

Subclassed by udho::context< AuxT, RequestT, ShadowT >, udho::context< AuxT, RequestT, void >

Public Types

typedef RequestT request_type
typedef context_common<AuxT, request_type> self_type
typedef detail::context_impl<request_type> impl_type
typedef boost::shared_ptr<impl_type> pimple_type
typedef udho::forms::form_<RequestT> form_type
typedef udho::cookies_<RequestT> cookies_type
typedef udho::forms::query_ query_parser_type

Public Functions

template<typename C>
context_common(AuxT &aux, const RequestT &request, const C&)
template<typename ShadowT>
context_common(self_type &other)
interaction_ &interaction()
const request_type &request() const

returns the boost beast HTTP request

template<class Body, class Fields>
void patch(boost::beast::http::message<false, Body, Fields> &res) const

patches the response with the headers added in the context from inside the callable

form_type &form()

returns the form handler object.

See

udho::form_

See

udho::urlencoded_form

See

udho::multipart_form

cookies_type &cookies()

accesses the HTTP cookies

See

udho::cookies_

operator request_type() const

conversion operator to convert to the corresponding beast request type

template<udho::logging::status Status>
void log(const udho::logging::message<Status> &msg) const

Logs a message to the logger attached with the server. A logging message can be passed to the log method or the operator<< can be used to log a message.

ctx << udho::logging::messages::formatted::debug("data", "testing log functionality of %1% Hi %2%") % "Neel Basu" % 42;
ctx << udho::logging::messages::formatted::info("data", "testing log functionality of %1% Hi %2%") % "Neel Basu" % 42;
ctx << udho::logging::messages::formatted::warning("data", "testing log functionality of %1% Hi %2%") % "Neel Basu" % 42;
ctx << udho::logging::messages::formatted::error("data", "testing log functionality of %1% Hi %2%") % "Neel Basu" % 42;
See

udho::logging::message

template<typename AttachmentT>
void attach(AttachmentT &attachment)

attaches a context with its server counter part

AuxT &aux()

returns a reference to the bridge between the callable and the server

void respond(udho::defs::response_type &response)

respond with a http status. The responded output will be put inside a beast HTTP response object and a content type header of type mime will be attached

template<typename OutputT>
void respond(const OutputT &output, const std::string &mime)

the responded output will be put inside a beast HTTP response object and a content type header of type mime will be attached

template<typename OutputT>
void respond(boost::beast::http::status s, const OutputT &output, const std::string &mime)

respond with a http status. The responded output will be put inside a beast HTTP response object and a content type header of type mime will be attached

void status(boost::beast::http::status s)

set a status code for the HTTP response

std::string target() const

target of the HTTP request including the ? if the request includes get parameters

// https://localhost/user/profile?id=245
ctx.target() // /user/profile?id=245

std::string path() const

path of the HTTP request before ? if any

// https://localhost/user/profile?id=245
ctx.path() // /user/profile

const query_parser_type &query() const

The get query of the HTTP request.

if(!ctx.query().has("type") || ctx.query().field<std::string>("type") == "json"){
    // respond with JSON content
}else if(ctx.query().field<std::string>("type") == "xml")
    // respond with xml content
}
See

udho::urlencoded_form

void clear()
void reroute(const std::string &path)

Internally reroute an HTTP request to another request

bool rerouted() const

check whether this is a rerouted request or not

std::string alt_path() const
std::string render(const std::string &path) const

render a file in path

template<typename ...DataT>
std::string render(const std::string &path, const DataT&... data) const

render a template in path

void push(const udho::detail::route &r)
udho::detail::route top() const
udho::detail::route pop()
std::size_t reroutes() const
detail::client_connection_wrapper<self_type> client(udho::config<udho::client_options> options = udho::config<udho::client_options>())
boost::asio::io_service &io()

Public Members

pimple_type _pimpl
AuxT &_aux
Template Struct context_impl
Inheritance Relationships
Base Type
Struct Documentation
template<typename RequestT>
struct udho::detail::context_impl : public udho::detail::interaction_

Public Types

typedef RequestT request_type
typedef context_impl<request_type> self_type
typedef udho::forms::form_<request_type> form_type
typedef udho::cookies_<request_type> cookies_type
typedef boost::beast::http::header<true> headers_type
typedef udho::forms::query_ query_parser_type
typedef std::stack<udho::detail::route> route_stack_type

Public Functions

context_impl(const request_type &request)
context_impl(const self_type &other) = delete
interaction_ &interaction()
const request_type &request() const
cookies_type &cookies()
template<class Body, class Fields>
void patch(boost::beast::http::message<false, Body, Fields> &res) const
void status(boost::beast::http::status status)
void clear()
void reroute(const std::string &path)
bool rerouted() const
std::string alt_path() const
std::string target() const
std::string path() const
std::string query_string() const
const query_parser_type &query() const
void push(const udho::detail::route &r)
udho::detail::route top() const
udho::detail::route pop()
std::size_t reroutes() const

Public Members

const request_type &_request
form_type _form
std::string _query_string
query_parser_type _query
headers_type _headers
cookies_type _cookies
route_stack_type _routes
boost::beast::http::status _status
Template Struct http_client_connection
Inheritance Relationships
Base Types
  • public std::enable_shared_from_this< http_client_connection< ContextT > >

  • public udho::detail::async_result< ContextT > (Template Struct async_result)

Struct Documentation
template<typename ContextT>
struct udho::detail::http_client_connection : public std::enable_shared_from_this<http_client_connection<ContextT>>, public udho::detail::async_result<ContextT>

Todo:

write docs

Public Types

typedef std::enable_shared_from_this<http_client_connection<ContextT>> base
typedef async_result<ContextT> result_type
typedef http_client_connection<ContextT> self_type
typedef ContextT context_type
typedef udho::config<udho::client_options> options_type
typedef boost::function<void(const std::string&)> redirector_type

Public Functions

http_client_connection(ContextT context, const udho::url &u, boost::asio::executor ex, options_type options)
void start(boost::beast::http::verb method = boost::beast::http::verb::get)
void on_resolve(boost::beast::error_code ec, boost::asio::ip::tcp::resolver::results_type results)
void on_connect(boost::beast::error_code ec)
void on_write(boost::beast::error_code ec, std::size_t)
void on_read(boost::beast::error_code ec, std::size_t)
void on_shutdown(boost::beast::error_code ec)
result_type &result()

Public Members

udho::url _url
boost::asio::ip::tcp::resolver resolver
boost::asio::ip::tcp::socket socket
boost::beast::flat_buffer buffer
boost::beast::http::request<boost::beast::http::empty_body> req
boost::beast::http::response<boost::beast::http::string_body> res

Public Static Functions

std::shared_ptr<self_type> create(boost::asio::io_service &io, ContextT ctx, udho::url url, options_type options)
Template Struct https_client_connection
Inheritance Relationships
Base Types
  • public std::enable_shared_from_this< https_client_connection< ContextT > >

  • public udho::detail::async_result< ContextT > (Template Struct async_result)

Struct Documentation
template<typename ContextT>
struct udho::detail::https_client_connection : public std::enable_shared_from_this<https_client_connection<ContextT>>, public udho::detail::async_result<ContextT>

Todo:

write docs

Public Types

typedef std::enable_shared_from_this<https_client_connection<ContextT>> base
typedef async_result<ContextT> result_type
typedef https_client_connection<ContextT> self_type
typedef ContextT context_type
typedef udho::config<udho::client_options> options_type
typedef boost::function<void(const std::string&)> redirector_type

Public Functions

https_client_connection(ContextT context, const udho::url &u, boost::asio::executor ex, boost::asio::ssl::context &ssl_ctx, options_type options)
void start(boost::beast::http::verb method = boost::beast::http::verb::get)
void on_resolve(boost::beast::error_code ec, boost::asio::ip::tcp::resolver::results_type results)
void on_connect(boost::beast::error_code ec)
void on_handshake(boost::beast::error_code ec)
void on_write(boost::beast::error_code ec, std::size_t)
void on_read(boost::beast::error_code ec, std::size_t)
void on_shutdown(boost::beast::error_code ec)
result_type &result()

Public Members

udho::url _url
boost::asio::ip::tcp::resolver resolver
boost::asio::ssl::context &_ssl_ctx
boost::asio::ssl::stream<boost::asio::ip::tcp::socket> stream
boost::beast::flat_buffer buffer
boost::beast::http::request<boost::beast::http::empty_body> req
boost::beast::http::response<boost::beast::http::string_body> res

Public Static Functions

std::shared_ptr<self_type> create(boost::asio::io_service &io, ContextT ctx, udho::url url, options_type options)
Struct interaction_
Inheritance Relationships
Derived Type
Struct Documentation
struct udho::detail::interaction_

Subclassed by udho::detail::context_impl< RequestT >

Public Functions

template<typename AuxT, typename LoggerT, typename CacheT>
void attach(udho::attachment<AuxT, LoggerT, CacheT> &attachment)
void log(const udho::logging::messages::error &msg) const
void log(const udho::logging::messages::warning &msg) const
void log(const udho::logging::messages::info &msg) const
void log(const udho::logging::messages::debug &msg) const
void respond(udho::defs::response_type &response)

Public Members

boost::signals2::signal<void(const udho::logging::messages::error&)> _error
boost::signals2::signal<void(const udho::logging::messages::warning&)> _warning
boost::signals2::signal<void(const udho::logging::messages::info&)> _info
boost::signals2::signal<void(const udho::logging::messages::debug&)> _debug
boost::signals2::signal<void(udho::defs::response_type&)> _respond
Template Struct is_prepared
Struct Documentation
template<typename U>
struct udho::detail::is_prepared

Public Types

enum [anonymous]

Values:

enumerator value

Public Static Functions

template<typename V>
V::prepared_type test(int)
template<typename>
void test(...)
Template Struct responder
Struct Documentation
template<typename F, typename R>
struct udho::detail::responder

Public Types

typedef F callback_type
typedef R result_type
typedef responder<F, R> self_type

Public Functions

responder() = delete
responder(callback_type callback)
responder(const self_type &other)
result_type call(const std::string&) const
result_type call(const std::string&)
bool iterable() const
bool leaf() const
std::size_t count() const
std::vector<std::string> keys() const

Public Members

callback_type _callback
Template Struct responder< F, std::map< U, V > >
Struct Documentation
template<typename F, typename U, typename V>
struct udho::detail::responder<F, std::map<U, V>>

Public Types

typedef F callback_type
typedef V value_type
typedef U key_type
typedef std::map<U, V> container_type
typedef V result_type
typedef container_type::size_type size_type

Public Functions

responder(callback_type callback)
result_type call(const std::string &key) const
result_type call(const std::string &key)
bool iterable() const
bool leaf() const
std::size_t count() const
std::vector<std::string> keys() const

Public Members

callback_type _callback
Template Struct responder< F, std::vector< V > >
Struct Documentation
template<typename F, typename V>
struct udho::detail::responder<F, std::vector<V>>

Public Types

typedef F callback_type
typedef V value_type
typedef std::vector<V> container_type
typedef V result_type
typedef container_type::size_type size_type

Public Functions

responder(callback_type callback)
result_type call(const std::string &key) const
result_type call(const std::string &key)
bool iterable() const
bool leaf() const
std::size_t count() const
std::vector<std::string> keys() const

Public Members

callback_type _callback
Struct route
Struct Documentation
struct udho::detail::route

Public Functions

void reroute(const std::string &path)
bool rerouted() const
std::string rerouted_path() const

Public Members

std::string _path
std::string _subject
std::string _pattern
std::string _rerouted
Template Struct url_data_
Struct Documentation
template<typename T = void>
struct udho::detail::url_data_

Public Functions

url_data_()
void set(protocol_t, const std::string &v)
std::string get(protocol_t) const
void set(host_t, const std::string &v)
std::string get(host_t) const
void set(port_t, std::size_t v)
std::size_t get(port_t) const
void set(target_t, const std::string &v)
std::string get(target_t) const
void set(path_t, const std::string &v)
std::string get(path_t) const
void set(query_t, const std::string &v)
const std::string &get(query_t) const

Public Members

std::string _protocol
std::string _host
std::size_t _port
std::string _path
std::string _target
std::string _query

Public Static Attributes

const struct udho::detail::url_data_::protocol_t protocol
const struct udho::detail::url_data_::host_t host
const struct udho::detail::url_data_::port_t port
const struct udho::detail::url_data_::target_t target
const struct udho::detail::url_data_::path_t path
const struct udho::detail::url_data_::query_t query
struct host_t

Public Types

typedef url_data_<T> component
struct path_t

Public Types

typedef url_data_<T> component
struct port_t

Public Types

typedef url_data_<T> component
struct protocol_t

Public Types

typedef url_data_<T> component
struct query_t

Public Types

typedef url_data_<T> component
struct target_t

Public Types

typedef url_data_<T> component
Struct url_data_::host_t
Nested Relationships

This struct is a nested type of Template Struct url_data_.

Struct Documentation
struct udho::detail::url_data_::host_t

Public Types

typedef url_data_<T> component
Struct url_data_::path_t
Nested Relationships

This struct is a nested type of Template Struct url_data_.

Struct Documentation
struct udho::detail::url_data_::path_t

Public Types

typedef url_data_<T> component
Struct url_data_::port_t
Nested Relationships

This struct is a nested type of Template Struct url_data_.

Struct Documentation
struct udho::detail::url_data_::port_t

Public Types

typedef url_data_<T> component
Struct url_data_::protocol_t
Nested Relationships

This struct is a nested type of Template Struct url_data_.

Struct Documentation
struct udho::detail::url_data_::protocol_t

Public Types

typedef url_data_<T> component
Struct url_data_::query_t
Nested Relationships

This struct is a nested type of Template Struct url_data_.

Struct Documentation
struct udho::detail::url_data_::query_t

Public Types

typedef url_data_<T> component
Struct url_data_::target_t
Nested Relationships

This struct is a nested type of Template Struct url_data_.

Struct Documentation
struct udho::detail::url_data_::target_t

Public Types

typedef url_data_<T> component
Struct http_error
Inheritance Relationships
Base Type
  • public exception

Struct Documentation
struct udho::exceptions::http_error : public exception

throw HTTP error exception in order to send a HTTP response other than 200 OK. Uncaught exceptions are presented as html page with routing sumary

http_error(boost::beast::http::status::notfound)

Public Types

typedef boost::beast::http::header<false> headers_type

Public Functions

http_error(boost::beast::http::status status, const std::string &message = "")
void add_header(boost::beast::http::field key, const std::string &value)
void redirect(const std::string &url)
template<typename T>
boost::beast::http::response<boost::beast::http::string_body> response(const boost::beast::http::request<T> &request) const
template<typename AuxT, typename U, typename V>
boost::beast::http::response<boost::beast::http::string_body> response(const udho::context<AuxT, U, V> &ctx) const
template<typename T, typename RouterT>
boost::beast::http::response<boost::beast::http::string_body> response(const boost::beast::http::request<T> &request, RouterT &router) const
template<typename AuxT, typename U, typename V, typename RouterT>
boost::beast::http::response<boost::beast::http::string_body> response(const udho::context<AuxT, U, V> &ctx, RouterT &router) const
std::string page(const std::string &target, std::string content = "") const
template<typename RouterT>
std::string page(const std::string &target, RouterT &router) const
const char *what() const noexcept
boost::beast::http::status result() const

Public Members

boost::beast::http::status _status
std::string _message
headers_type _headers
Struct reroute
Inheritance Relationships
Base Type
  • public exception

Struct Documentation
struct udho::exceptions::reroute : public exception

Public Functions

reroute(const std::string &alt_path)
std::string alt_path() const

Public Members

std::string _alt_path
Template Struct field
Struct Documentation
template<typename T, bool Required>
struct field
Template Struct field< T, false >
Inheritance Relationships
Base Types
Struct Documentation
template<typename T>
struct udho::field<T, false> : public udho::field_common, public udho::field_value_extractor<T>

Public Types

typedef field<T, false> self_type
typedef field_common common_type
typedef boost::function<bool(const std::string&, std::string&)> function_type
typedef field_value_extractor<T> extractor_type
typedef std::vector<function_type> validators_collection_type

Public Functions

template<typename ...U>
field(const std::string &name, U... args)
T value() const
template<typename F>
self_type &constrain(F ftor)
template<typename FormT>
void validate(const FormT &form)
void check(const std::string &input)
self_type &operator()(const std::string &input)

validate the field when using a field without a form (e.g. JSON or XML document) if a value if provided in the document

self_type &unchecked(const T &input)
self_type &operator()()

validate the field when using a field without a form (e.g. JSON or XML document) if no value if provided in the document

Public Members

T _value
validators_collection_type _validators
Template Struct field< T, true >
Inheritance Relationships
Base Types
Struct Documentation
template<typename T>
struct udho::field<T, true> : public udho::field_common, public udho::field_value_extractor<T>

Public Types

typedef field<T, true> self_type
typedef field_common common_type
typedef boost::function<bool(const std::string&, std::string&)> function_type
typedef field_value_extractor<T> extractor_type
typedef std::vector<function_type> validators_collection_type

Public Functions

template<typename ...U>
field(const std::string &name, const std::string &message, U... args)
T value() const
template<typename F>
self_type &constrain(F ftor)
template<typename FormT>
void validate(const FormT &form)
void check(const std::string &input)
self_type &operator()(const std::string &input)

validate the field when using a field without a form (e.g. JSON or XML document) if a value if provided in the document

self_type &unchecked(const T &input)
self_type &operator()()

validate the field when using a field without a form (e.g. JSON or XML document) if no value if provided in the document

Public Members

T _value
validators_collection_type _validators
std::string _message_required
Struct field_common
Inheritance Relationships
Base Type
Derived Types
Struct Documentation
struct udho::field_common : public udho::prepare<field_common>

common meta parameters of a form field

Subclassed by udho::field< T, false >, udho::field< T, true >

Public Functions

field_common(const std::string &name)
bool validated() const
std::string name() const
bool valid() const
std::string error() const
void clear()
template<typename DictT>
auto dict(DictT assoc) const

Public Members

std::string _name
bool _is_valid
bool _validated
std::string _err
std::string _value
Template Struct field_value_extractor
Inheritance Relationships
Derived Types
Struct Documentation
template<typename T>
struct udho::field_value_extractor

Subclassed by udho::field< T, false >, udho::field< T, true >

Public Types

typedef T value_type

Public Functions

field_value_extractor(const std::string &message = "Extraction Failed")
bool operator()(const std::string &input, value_type &value) const
std::string message() const

Public Members

std::string _message
Template Struct field_value_extractor< std::chrono::time_point< std::chrono::system_clock, std::chrono::microseconds > >
Struct Documentation
template<>
struct udho::field_value_extractor<std::chrono::time_point<std::chrono::system_clock, std::chrono::microseconds>>

Public Types

typedef std::chrono::time_point<std::chrono::system_clock, std::chrono::microseconds> value_type

Public Functions

field_value_extractor(const std::string &format, const std::string &message = "Extraction Failed")
bool operator()(const std::string &input, value_type &value) const
std::string message() const

Public Members

std::string _format
std::string _message
Template Struct validated
Inheritance Relationships
Base Type
Struct Documentation
template<typename FormT = void>
struct udho::form::validated : public udho::prepare<validated<FormT>>

Public Types

typedef udho::prepare<validated<FormT>> base
typedef FormT form_type
typedef validated<FormT> self_type

Public Functions

validated(const form_type &form)
void add(const field_common &fld)
bool valid() const
const std::vector<std::string> &errors() const
const field_common &operator[](const std::string &name) const
template<typename DictT>
auto dict(DictT assoc) const

Public Members

const form_type &_form
bool _submitted
bool _valid
std::vector<std::string> _errors
std::map<std::string, field_common> _fields
Template Struct validated< void >
Inheritance Relationships
Base Type
Struct Documentation
template<>
struct udho::form::validated<void> : public udho::prepare<validated<void>>

Public Types

typedef udho::prepare<validated<>> base
typedef validated<void> self_type

Public Functions

validated()
void add(const field_common &fld)
bool valid() const
const std::vector<std::string> &errors() const
const field_common &operator[](const std::string &name) const
template<typename DictT>
auto dict(DictT assoc) const

Public Members

bool _submitted
bool _valid
std::vector<std::string> _errors
std::map<std::string, field_common> _fields
Struct all_digit
Struct Documentation
struct udho::form::validators::all_digit

Public Functions

all_digit(std::string custom = "")
bool operator()(const std::string &value, std::string &error) const

Public Members

std::string _custom
Struct date_time
Struct Documentation
struct udho::form::validators::date_time

Public Functions

date_time(std::string format, std::string custom = "")
bool operator()(const std::string &value, std::string &error) const

Public Members

std::string _format
std::string _custom
Struct exact_length
Struct Documentation
struct udho::form::validators::exact_length

Public Functions

exact_length(std::size_t length, std::string custom = "")
bool operator()(const std::string &value, std::string &error) const

Public Members

std::size_t _length
std::string _custom
Struct max_length
Struct Documentation
struct udho::form::validators::max_length

Public Functions

max_length(std::size_t length, std::string custom = "")
bool operator()(const std::string &value, std::string &error) const

Public Members

std::size_t _length
std::string _custom
Struct min_length
Struct Documentation
struct udho::form::validators::min_length

Public Functions

min_length(std::size_t length, std::string custom = "")
bool operator()(const std::string &value, std::string &error) const

Public Members

std::size_t _length
std::string _custom
Struct no_space
Struct Documentation
struct udho::form::validators::no_space

Public Functions

no_space(std::string custom = "")
bool operator()(const std::string &value, std::string &error) const

Public Members

std::string _custom
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
Struct accumulated
Inheritance Relationships
Base Type
Derived Type
Struct Documentation
struct udho::forms::accumulated : public udho::prepare<accumulated>

Subclassed by udho::forms::validated< form< DriverT > >

Public Types

typedef udho::prepare<accumulated> base
typedef accumulated self_type

Public Functions

accumulated()
template<typename ValidatorT, typename TailT>
self_type &add(const detail::constrained_field<ValidatorT, TailT> &cf)
self_type &add(const detail::field_common &common)
bool valid() const
void add_error(const std::string &err)
const std::vector<std::string> &errors() const
const detail::field_common &operator[](const std::string &name) const
template<typename DictT>
auto dict(DictT assoc) const
Struct all_digits
Inheritance Relationships
Base Type
Struct Documentation
struct udho::forms::constraints::all_digits : public udho::forms::constraints::basic_constrain<all_digits>

Public Types

typedef basic_constrain<all_digits> base

Public Functions

all_digits(std::string message = "")
bool operator()(const std::string &value) const
Template Struct basic_constrain
Struct Documentation
template<typename DerivedT>
struct udho::forms::constraints::basic_constrain

Public Types

typedef DerivedT derived_type

Public Functions

basic_constrain(const std::string &m)
derived_type &self()
derived_type &error(const std::string &m)
derived_type &message(const std::string &m)
const std::string &message() const
Template Struct eq
Inheritance Relationships
Base Type
Struct Documentation
template<typename T>
struct udho::forms::constraints::eq : public udho::forms::constraints::basic_constrain<eq<T>>

Public Types

typedef basic_constrain<eq<T>> base

Public Functions

eq(const T &value, const std::string &message = "")
bool operator()(const T &input) const

Public Members

T _value
Template Struct gt
Inheritance Relationships
Base Type
Struct Documentation
template<typename T>
struct udho::forms::constraints::gt : public udho::forms::constraints::basic_constrain<gt<T>>

Public Types

typedef basic_constrain<gt<T>> base

Public Functions

gt(const T &value, const std::string &message = "")
bool operator()(const T &input) const

Public Members

T _value
Template Struct gt< std::string >
Inheritance Relationships
Base Type
Struct Documentation
template<>
struct udho::forms::constraints::gt<std::string> : public udho::forms::constraints::basic_constrain<gt<std::string>>

Public Types

typedef basic_constrain<gt<std::string>> base

Public Functions

gt(const std::size_t &value, const std::string &message = "")
bool operator()(const std::string &input) const

Public Members

std::size_t _value
Template Struct gte
Inheritance Relationships
Base Type
Struct Documentation
template<typename T>
struct udho::forms::constraints::gte : public udho::forms::constraints::basic_constrain<gte<T>>

Public Types

typedef basic_constrain<gte<T>> base

Public Functions

gte(const T &value, const std::string &message = "")
bool operator()(const T &input) const

Public Members

T _value
Template Struct gte< std::string >
Inheritance Relationships
Base Type
Struct Documentation
template<>
struct udho::forms::constraints::gte<std::string> : public udho::forms::constraints::basic_constrain<gte<std::string>>

Public Types

typedef basic_constrain<gte<std::string>> base

Public Functions

gte(const std::size_t &value, const std::string &message = "")
bool operator()(const std::string &input) const

Public Members

std::size_t _value
Template Struct in
Inheritance Relationships
Base Type
Struct Documentation
template<typename T>
struct udho::forms::constraints::in : public udho::forms::constraints::basic_constrain<in<T>>

Public Types

typedef basic_constrain<in<T>> base

Public Functions

template<typename It>
in(const std::string &message, It begin, It end)
template<typename ...U>
in(const std::string &message, const U&... args)
template<typename ...U>
in(const U&... args)
bool operator()(const T &input) const

Public Members

std::set<T> _values
Struct length_eq
Inheritance Relationships
Base Type
Struct Documentation
struct udho::forms::constraints::length_eq : public udho::forms::constraints::basic_constrain<length_eq>

Public Types

typedef basic_constrain<length_eq> base

Public Functions

length_eq(std::size_t length, std::string message = "")
bool operator()(const std::string &value) const

Public Members

std::size_t _length
Template Struct lt
Inheritance Relationships
Base Type
Struct Documentation
template<typename T>
struct udho::forms::constraints::lt : public udho::forms::constraints::basic_constrain<lt<T>>

Public Types

typedef basic_constrain<lt<T>> base

Public Functions

lt(const T &value, const std::string &message = "")
bool operator()(const T &input) const

Public Members

T _value
Template Struct lt< std::string >
Inheritance Relationships
Base Type
Struct Documentation
template<>
struct udho::forms::constraints::lt<std::string> : public udho::forms::constraints::basic_constrain<lt<std::string>>

Public Types

typedef basic_constrain<lt<std::string>> base

Public Functions

lt(const std::size_t &value, const std::string &message = "")
bool operator()(const std::string &input) const

Public Members

std::size_t _value
Template Struct lte
Inheritance Relationships
Base Type
Struct Documentation
template<typename T>
struct udho::forms::constraints::lte : public udho::forms::constraints::basic_constrain<lte<T>>

Public Types

typedef basic_constrain<lte<T>> base

Public Functions

lte(const T &value, const std::string &message = "")
bool operator()(const T &input) const

Public Members

T _value
Template Struct lte< std::string >
Inheritance Relationships
Base Type
Struct Documentation
template<>
struct udho::forms::constraints::lte<std::string> : public udho::forms::constraints::basic_constrain<lte<std::string>>

Public Types

typedef basic_constrain<lte<std::string>> base

Public Functions

lte(const std::size_t &value, const std::string &message = "")
bool operator()(const std::string &input) const

Public Members

std::size_t _value
Template Struct neq
Inheritance Relationships
Base Type
Struct Documentation
template<typename T>
struct udho::forms::constraints::neq : public udho::forms::constraints::basic_constrain<neq<T>>

Public Types

typedef basic_constrain<neq<T>> base

Public Functions

neq(const T &value, const std::string &message = "")
bool operator()(const T &input) const

Public Members

T _value
Struct no_space
Inheritance Relationships
Base Type
Struct Documentation
struct udho::forms::constraints::no_space : public udho::forms::constraints::basic_constrain<no_space>

Public Types

typedef basic_constrain<no_space> base

Public Functions

no_space(std::string message = "")
bool operator()(const std::string &value) const
Template Struct deserializer
Struct Documentation
template<typename V, typename U>
struct deserializer
Template Struct deserializer< std::chrono::time_point< std::chrono::system_clock, DurationT >, std::string >
Struct Documentation
template<typename DurationT>
struct udho::forms::deserializer<std::chrono::time_point<std::chrono::system_clock, DurationT>, std::string>

Public Types

typedef std::chrono::time_point<std::chrono::system_clock, DurationT> time_type

Public Static Functions

bool check(const std::string &input, const std::string &format = default_datetime_format)
time_type deserialize(const std::string &input, const std::string &format = default_datetime_format)
Template Struct deserializer< std::string, std::chrono::time_point< std::chrono::system_clock, DurationT > >
Struct Documentation
template<typename DurationT>
struct udho::forms::deserializer<std::string, std::chrono::time_point<std::chrono::system_clock, DurationT>>

Public Types

typedef std::chrono::time_point<std::chrono::system_clock, DurationT> time_type

Public Static Functions

bool check(const std::chrono::time_point<std::chrono::system_clock, DurationT> &input, const std::string &format = default_datetime_format)
std::string deserialize(const std::chrono::time_point<std::chrono::system_clock, DurationT> &input, const std::string &format = default_datetime_format)
Template Struct deserializer< std::string, std::string >
Struct Documentation
template<>
struct udho::forms::deserializer<std::string, std::string>

Public Static Functions

bool check(const std::string&)
std::string deserialize(const std::string &input)
Template Struct deserializer< std::string, U >
Struct Documentation
template<typename U>
struct udho::forms::deserializer<std::string, U>

Public Static Functions

bool check(const U &input)
std::string deserialize(const U &input)
Template Struct deserializer< U, U >
Struct Documentation
template<typename U>
struct udho::forms::deserializer<U, U>

Public Static Functions

bool check(const U&)
std::string deserialize(const U &input)
Template Struct deserializer< V, std::string >
Struct Documentation
template<typename V>
struct udho::forms::deserializer<V, std::string>

Public Static Functions

bool check(const std::string &input)
V deserialize(const std::string &input)
Template Struct basic_field
Inheritance Relationships
Base Type
Struct Documentation
template<typename ValueT, typename DerivedT>
struct udho::forms::detail::basic_field : public udho::forms::detail::field_data<ValueT>

Public Types

typedef ValueT value_type
typedef DerivedT derived_type
typedef field_data<ValueT> data_type

Public Functions

basic_field(const std::string &name)
derived_type &absent(const std::string &message)
derived_type &unparsable(const std::string &message)
data_type &data()
const data_type &data() const
template<typename ValidatorT>
detail::constrained_field<ValidatorT, derived_type> constrain(const ValidatorT &validator)
template<template<typename> class ValidatorT, typename ...ArgsT>
detail::constrained_field<ValidatorT<value_type>, derived_type> constrain(ArgsT&&... args)

Protected Functions

template<typename ValidatorT>
bool validate(const ValidatorT &validator)
derived_type &self()
const derived_type &self() const

Protected Attributes

std::string _message_absent
std::string _message_unparsable
Template Struct constrained_field
Struct Documentation
template<typename ValidatorT, typename FieldT>
struct udho::forms::detail::constrained_field

Public Types

enum [anonymous]

Values:

enumerator depth
typedef FieldT field_type
typedef field_type::value_type value_type
typedef ValidatorT validator_type
typedef constrained_field<validator_type, field_type> self_type

Public Functions

constrained_field(const validator_type &validator, const FieldT &field)
template<typename FormT>
bool validate(const FormT &form)
template<typename FormT>
bool operator()(const FormT &form)
const field_type &field() const
field_type &field()
bool valid() const
value_type value() const
std::string message() const
value_type operator*() const
bool operator!() const
std::string name() const
template<typename ValidatorU>
detail::constrained_field<ValidatorU, self_type> constrain(const ValidatorU &validator)
template<template<typename> class ValidatorU, typename ...ArgsT>
detail::constrained_field<ValidatorU<value_type>, self_type> constrain(ArgsT&&... args)
template<unsigned Depth>
udho::forms::detail::constraint_visitor<self_type, Depth>::validator_type &constrain()

Public Members

validator_type _validator
FieldT _field
Template Struct constrained_field< ValidatorT, constrained_field< T… > >
Struct Documentation
template<typename ValidatorT, typename ...T>
struct udho::forms::detail::constrained_field<ValidatorT, constrained_field<T...>>

Public Types

enum [anonymous]

Values:

enumerator depth
typedef constrained_field<T...> head_type
typedef head_type::field_type field_type
typedef field_type::value_type value_type
typedef ValidatorT validator_type
typedef constrained_field<validator_type, head_type> self_type

Public Functions

constrained_field(const validator_type &validator, const head_type &head)
template<typename FormT>
bool validate(const FormT &form)
template<typename FormT>
bool operator()(const FormT &form)
field_type &field()
const field_type &field() const
bool valid() const
value_type value() const
std::string message() const
value_type operator*() const
bool operator!() const
std::string name() const
template<typename ValidatorU>
detail::constrained_field<ValidatorU, self_type> constrain(const ValidatorU &validator)
template<template<typename> class ValidatorU, typename ...ArgsT>
detail::constrained_field<ValidatorU<value_type>, self_type> constrain(ArgsT&&... args)
template<unsigned Depth>
udho::forms::detail::constraint_visitor<self_type, Depth>::validator_type &constrain()

Public Members

validator_type _validator
head_type _head
Template Struct constraint_visitor_
Struct Documentation
template<typename ConstrainedFieldT, unsigned Depth>
struct udho::forms::detail::constraint_visitor_

Public Types

typedef constraint_visitor_<typename ConstrainedFieldT::head_type, Depth - 1>::validator_type validator_type

Public Static Functions

validator_type &validator(ConstrainedFieldT &cf)
Template Struct constraint_visitor_< ConstrainedFieldT, 0 >
Struct Documentation
template<typename ConstrainedFieldT>
struct udho::forms::detail::constraint_visitor_<ConstrainedFieldT, 0>

Public Types

typedef ConstrainedFieldT::validator_type validator_type

Public Static Functions

validator_type &validator(ConstrainedFieldT &cf)
Struct field_common
Inheritance Relationships
Base Type
Derived Types
Struct Documentation
struct udho::forms::detail::field_common : public udho::prepare<field_common>

Subclassed by udho::forms::detail::field_data< std::chrono::time_point< std::chrono::system_clock, DurationT > >, udho::forms::detail::field_data< T >, udho::forms::detail::field_data< ValueT >

Public Functions

field_common(const std::string &name)
bool absent() const
bool unparsable() const
bool fetched() const
const std::string &name() const
std::string value_serialized() const
bool valid() const
const std::string &message() const
const std::string &error() const
bool operator!() const
template<typename DictT>
auto dict(DictT assoc) const

Protected Attributes

std::string _name
std::string _message
bool _absent
bool _unparsable
bool _fetched
bool _valid
std::string _value_str
Template Struct field_data
Inheritance Relationships
Base Type
Derived Type
Struct Documentation
template<typename ValueT>
struct udho::forms::detail::field_data : public udho::forms::detail::field_common

Subclassed by udho::forms::detail::basic_field< ValueT, DerivedT >

Public Types

typedef ValueT value_type
typedef field_data<ValueT> self_type

Public Functions

const value_type &value() const
const value_type &operator*() const
template<typename ...ArgsT>
void value(const value_type &v, const ArgsT&... args)
field_common &common()
const field_common &common() const
Template Struct combo
Inheritance Relationships
Base Types
Struct Documentation
template<typename RequestT>
struct udho::forms::drivers::combo : private udho::forms::drivers::urlencoded_<RequestT::body_type::value_type::const_iterator>, private udho::forms::drivers::multipart_<RequestT::body_type::value_type::const_iterator>

Public Types

enum types

Values:

enumerator unparsed
enumerator urlencoded
enumerator multipart
typedef RequestT request_type
typedef urlencoded_<typename request_type::body_type::value_type::const_iterator> urlencoded_type
typedef multipart_<typename request_type::body_type::value_type::const_iterator> multipart_type
typedef request_type::body_type::value_type body_type

Public Functions

combo(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_type &urlencoded() const
const multipart_type &multipart() const

return the multipart specific form accessor

bool empty(const std::string name) const

checks whether the value for the field is empty

bool exists(const std::string name) const

checks whether there exists any field with the name provided

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

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

Public Members

const request_type &_request
types _type
Template Struct extract_multipart_boundary
Struct Documentation
template<typename RequestT>
struct udho::forms::drivers::detail::extract_multipart_boundary

Public Types

typedef RequestT request_type

Public Functions

extract_multipart_boundary(const request_type &request)
const std::string &boundary() const
bool extract(const std::string &boundary_key = "boundary=")

Public Members

request_type _request
std::string _boundary
Template Struct multipart
Inheritance Relationships
Base Type
Struct Documentation
template<typename RequestT>
struct udho::forms::drivers::multipart : public udho::forms::drivers::multipart_<RequestT::body_type::value_type::const_iterator>

Public Types

typedef RequestT request_type
typedef request_type::body_type::value_type body_type
typedef multipart_<typename request_type::body_type::value_type::const_iterator> multipart_type

Public Functions

multipart(const request_type &request)

Public Members

const request_type &_request
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
Struct multipart_::form_part
Nested Relationships

This struct is a nested type of Template Struct multipart_.

Struct Documentation
struct udho::forms::drivers::multipart_::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
Template Struct urlencoded
Inheritance Relationships
Base Type
Struct Documentation
template<typename RequestT>
struct udho::forms::drivers::urlencoded : public udho::forms::drivers::urlencoded_<RequestT::body_type::value_type::const_iterator>

Public Types

typedef RequestT request_type
typedef request_type::body_type::value_type body_type
typedef urlencoded_<typename request_type::body_type::value_type::const_iterator> urlencoded_type

Public Functions

urlencoded(const request_type &request)

Public Members

const request_type &_request
Template Struct urlencoded_
Inheritance Relationships
Derived Type
Struct Documentation
template<typename Iterator = std::string::const_iterator>
struct udho::forms::drivers::urlencoded_

Form driver for urlencoded forms

Subclassed by udho::url

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(iterator_type begin, iterator_type end)
bool empty(const std::string &name) const

checks whether the value for the field is empty

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

checks whether there exists any field with the name provided

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

header_map_type _fields
std::string _query
Template Struct field
Struct Documentation
template<typename T, bool Required = false>
struct field
Template Struct field< std::chrono::time_point< std::chrono::system_clock, DurationT >, false >
Inheritance Relationships
Base Type
  • public udho::forms::detail::basic_field< std::chrono::time_point< std::chrono::system_clock, DurationT >, field< std::chrono::time_point< std::chrono::system_clock, DurationT >, false > > (Template Struct basic_field)

Struct Documentation
template<typename DurationT>
struct udho::forms::field<std::chrono::time_point<std::chrono::system_clock, DurationT>, false> : public udho::forms::detail::basic_field<std::chrono::time_point<std::chrono::system_clock, DurationT>, field<std::chrono::time_point<std::chrono::system_clock, DurationT>, false>>

Public Types

enum [anonymous]

Values:

enumerator is_required
typedef std::chrono::time_point<std::chrono::system_clock, DurationT> value_type
typedef field<std::chrono::time_point<std::chrono::system_clock, DurationT>, false> self_type
typedef detail::basic_field<std::chrono::time_point<std::chrono::system_clock, DurationT>, field<std::chrono::time_point<std::chrono::system_clock, DurationT>, false>> base

Public Functions

field(const std::string &name, const std::string &format = default_datetime_format, const value_type &def = value_type())
const value_type &def() const
template<typename FormT>
bool fetch(const FormT &form)
template<typename FormT, typename ValidatorT>
bool validate(const FormT &form, const ValidatorT &validator)

Public Members

std::string _format

Protected Attributes

value_type _def
Template Struct field< std::chrono::time_point< std::chrono::system_clock, DurationT >, true >
Inheritance Relationships
Base Type
  • public udho::forms::detail::basic_field< std::chrono::time_point< std::chrono::system_clock, DurationT >, field< std::chrono::time_point< std::chrono::system_clock, DurationT >, true > > (Template Struct basic_field)

Struct Documentation
template<typename DurationT>
struct udho::forms::field<std::chrono::time_point<std::chrono::system_clock, DurationT>, true> : public udho::forms::detail::basic_field<std::chrono::time_point<std::chrono::system_clock, DurationT>, field<std::chrono::time_point<std::chrono::system_clock, DurationT>, true>>

Public Types

enum [anonymous]

Values:

enumerator is_required
typedef std::chrono::time_point<std::chrono::system_clock, DurationT> value_type
typedef field<std::chrono::time_point<std::chrono::system_clock, DurationT>, true> self_type
typedef detail::basic_field<std::chrono::time_point<std::chrono::system_clock, DurationT>, field<std::chrono::time_point<std::chrono::system_clock, DurationT>, true>> base

Public Functions

field(const std::string &name, const std::string &format = default_datetime_format)
template<typename FormT>
bool fetch(const FormT &form)
template<typename FormT, typename ValidatorT>
bool validate(const FormT &form, const ValidatorT &validator)

Public Members

std::string _format
Template Struct field< T, false >
Inheritance Relationships
Base Type
Struct Documentation
template<typename T>
struct udho::forms::field<T, false> : public udho::forms::detail::basic_field<T, field<T, false>>

Public Types

enum [anonymous]

Values:

enumerator is_required
typedef T value_type
typedef field<T, false> self_type
typedef detail::basic_field<T, field<T, false>> base

Public Functions

field(const std::string &name, const value_type &def = value_type())
const value_type &def() const
template<typename FormT>
bool fetch(const FormT &form)
template<typename FormT, typename ValidatorT>
bool validate(const FormT &form, const ValidatorT &validator)

Protected Attributes

value_type _def
Template Struct field< T, true >
Inheritance Relationships
Base Type
Struct Documentation
template<typename T>
struct udho::forms::field<T, true> : public udho::forms::detail::basic_field<T, field<T, true>>

Public Types

enum [anonymous]

Values:

enumerator is_required
typedef T value_type
typedef field<T, true> self_type
typedef detail::basic_field<T, field<T, true>> base

Public Functions

field(const std::string &name)
template<typename FormT>
bool fetch(const FormT &form)
template<typename FormT, typename ValidatorT>
bool validate(const FormT &form, const ValidatorT &validator)
Template Struct form
Inheritance Relationships
Base Type
  • public DriverT

Struct Documentation
template<typename DriverT>
struct udho::forms::form : public DriverT

Public Functions

bool has(const std::string &name) const
template<typename T, typename ParserT = udho::forms::parser<T>>
T field(const std::string &name, bool *ok = 0x0) const
template<typename T, typename ParserT = udho::forms::parser<T>, typename ...ArgsT>
T field(const std::string &name, bool *ok, const ArgsT&... args) const
template<typename T, typename ParserT = udho::forms::parser<T>, typename ...ArgsT>
T field(const std::string &name, const ArgsT&... args) const
Template Struct parser
Struct Documentation
template<typename T>
struct udho::forms::parser

Public Static Functions

template<typename U, typename ...ArgsT>
bool parsable(const U &input, const ArgsT&... args)
template<typename U, typename ...ArgsT>
T parse(const U &input, const ArgsT&... args)
Template Struct validated
Struct Documentation
template<typename FormT>
struct validated
Template Struct validated< form< DriverT > >
Inheritance Relationships
Base Type
Struct Documentation
template<typename DriverT>
struct udho::forms::validated<form<DriverT>> : public udho::forms::accumulated

Public Types

typedef form<DriverT> form_type
typedef validated<form<DriverT>> self_type

Public Functions

validated(form_type &f)
template<typename ValidatorT, typename TailT>
self_type &add(detail::constrained_field<ValidatorT, TailT> &cf)
template<typename T, bool Required>
self_type &add(field<T, Required> &f)
Template Struct actual_callback_type
Struct Documentation
template<typename C>
struct udho::internal::actual_callback_type

Public Types

typedef C callback_type
Template Struct arg_to_tuple
Struct Documentation
template<typename TupleT, int Index = boost::tuples::length<TupleT>::value - 1>
struct udho::internal::arg_to_tuple

Public Types

typedef arg_to_tuple<TupleT, Index - 1> base_type

Public Static Functions

void convert(TupleT &tuple, const std::vector<std::string> &args)
Template Struct arg_to_tuple< TupleT, 0 >
Struct Documentation
template<typename TupleT>
struct udho::internal::arg_to_tuple<TupleT, 0>

Public Static Functions

void convert(TupleT&, const std::vector<std::string>&)
Template Struct bind_first
Struct Documentation
template<typename T>
struct bind_first
Template Struct bind_first< boost::function< R(Args…)> >
Struct Documentation
template<typename R, typename ...Args>
struct udho::internal::bind_first<boost::function<R(Args...)>>

Public Types

typedef reducer<R, Args...> reducer_type
typedef boost::function<R(Args...)> base_function_type
typedef reducer_type::object_type object_type
typedef reducer_type::function_type reduced_function_type

Public Functions

bind_first(object_type that, base_function_type base)
reduced_function_type reduced()

Public Members

object_type _that
reducer_type _reducer
Template Struct callable1
Struct Documentation
template<typename A1, typename R, typename ...V>
struct callable1
Template Struct callable1< A1, R(*)(A1 &, V…)>
Struct Documentation
template<typename A1, typename R, typename ...V>
struct udho::internal::callable1<A1, R (*)(A1&, V...)>

Public Types

typedef actual_callback_type<R (*)(A1&, V...)>::callback_type callback_type
typedef boost::function<R(V...)> function_type
typedef R return_type

Public Functions

callable1(callback_type cb, A1 &a1)
return_type operator()(V... args)

Public Members

callback_type _callback
A1 &_a1
Template Struct cast_optionally
Struct Documentation
template<typename T, int Index>
struct udho::internal::cast_optionally

Public Static Functions

T cast(const std::vector<std::string> &args)
Template Struct function_signature
Struct Documentation
template<typename T>
struct function_signature

extract the function signature

Template Struct function_signature< boost::function< R(Args…)> >
Struct Documentation
template<typename R, typename ...Args>
struct udho::internal::function_signature<boost::function<R(Args...)>>

Public Types

typedef R return_type
typedef boost::tuple<std::decay_t<Args>...> tuple_type
typedef boost::fusion::tuple<std::decay_t<Args>...> arguments_type
Template Struct function_signature< R(*)(Args…)>
Struct Documentation
template<typename R, typename ...Args>
struct udho::internal::function_signature<R (*)(Args...)>

Public Types

typedef R return_type
typedef boost::tuple<std::decay_t<Args>...> tuple_type
typedef boost::fusion::tuple<std::decay_t<Args>...> arguments_type
Template Struct member_
Struct Documentation
template<typename T>
struct member_
Template Struct member_< R C::* >
Struct Documentation
template<typename R, typename C>
struct udho::internal::member_<R C::*>

Public Types

typedef R result_type
typedef C that_type
RC::* actual_function_type
typedef boost::function<R(const C*)> const_base_function_type
typedef bind_first<const_base_function_type> const_binder_type
typedef const_binder_type::object_type object_type
typedef const_binder_type::reduced_function_type const_reduced_function_type

Public Functions

member_(actual_function_type function)
const_reduced_function_type reduced(const C *that)

Public Members

const_base_function_type _function
Template Struct reduced_
Struct Documentation
template<typename T>
struct reduced_
Template Struct reduced_< R(C::*)(Args…) const >
Struct Documentation
template<typename R, typename C, typename ...Args>
struct udho::internal::reduced_<R (C::*)(Args...) const>

Public Types

typedef R result_type
typedef C that_type
typedef R (C::* actual_function_type)(Args...) const
typedef boost::function<R(const C*, Args...)> base_function_type
typedef bind_first<base_function_type> binder_type
typedef const binder_type::object_type object_type
typedef binder_type::reduced_function_type reduced_function_type

Public Functions

reduced_(actual_function_type function)
reduced_function_type reduced(const C *that)

Public Members

base_function_type _function
Template Struct reduced_< R(C::*)(Args…)>
Struct Documentation
template<typename R, typename C, typename ...Args>
struct udho::internal::reduced_<R (C::*)(Args...)>

Public Types

typedef R result_type
typedef C that_type
typedef R (C::* actual_function_type)(Args...)
typedef boost::function<R(C*, Args...)> base_function_type
typedef bind_first<base_function_type> binder_type
typedef binder_type::object_type object_type
typedef binder_type::reduced_function_type reduced_function_type

Public Functions

reduced_(actual_function_type function)
reduced_function_type reduced(C *that)

Public Members

base_function_type _function
Template Struct reducer
Struct Documentation
template<typename R, typename First, typename ...Rest>
struct udho::internal::reducer

Public Types

typedef First object_type
typedef boost::function<R(Rest...)> function_type
typedef boost::function<R(First, Rest...)> actual_function_type

Public Functions

reducer(object_type that, actual_function_type actual)
R operator()(const Rest&... rest)

Public Members

object_type _that
actual_function_type _actual
Template Struct is_application
Struct Documentation
template<typename U>
struct udho::is_application

Public Types

enum [anonymous]

Values:

enumerator value

Public Static Functions

template<typename V>
V::application_type test(int)
template<typename>
void test(...)
Template Struct plain
Struct Documentation
template<typename StreamT>
struct udho::loggers::plain

Public Types

typedef StreamT stream_type
typedef plain<StreamT> self_type

Public Functions

plain(StreamT &stream)
void log(const std::chrono::system_clock::time_point &time, udho::logging::status status, const std::string &segment, int level, const std::string &message)
self_type &operator+=(const logging::features::colored &colored)
template<udho::logging::status Status>
self_type &operator()(const udho::logging::message<Status> &msg)

Public Members

StreamT &_stream
logging::features::colored _feature_color
Struct colored
Struct Documentation
struct udho::logging::features::colored

Public Functions

colored()
colored(bool c)

Public Members

bool _colored
Template Struct message
Inheritance Relationships
Derived Type
Struct Documentation
template<udho::logging::status Status>
struct udho::logging::message

A logging message

Template Parameters
  • Status:

Subclassed by udho::logging::messages::formatted::message< Status >

Public Types

typedef std::chrono::system_clock::time_point time_type

Public Functions

message(const std::string &segment, unsigned level = 0)
message(const std::string &segment, const std::string &content, unsigned level = 0)
std::string what() const

Public Members

const time_type time = std::chrono::system_clock::now()
const std::string _segment
const unsigned _level
std::string _content

Public Static Attributes

constexpr const udho::logging::status status = Status
Template Struct message
Inheritance Relationships
Base Type
Struct Documentation
template<udho::logging::status Status>
struct udho::logging::messages::formatted::message : public udho::logging::message<Status>

Public Types

typedef messages::formatted::message<Status> self_type
typedef udho::logging::message<Status> base_type

Public Functions

message(const std::string &segment, const std::string &format, unsigned level = 0)
template<typename T>
self_type &prepare(const T &value)
template<typename T>
self_type &operator%(const T &value)
std::string what() const

Public Members

boost::format _format
Template Struct lookup_table
Struct Documentation
template<typename DataT>
struct lookup_table

Accepts a prepared object that can be queried through string keys. Maintains a lookup table which contains aliases of such keys. So that the keys can be with both the real name as well as through the alias names. An unsigned integer depth value associated with every aliases. Based on which all aliases of some depth can be cleared. The up and down increases and decreases the value of depth. add will add an alias with the current depth. It can be used in a scoped environment where the entering to and leaving from an inner scope will call the down and up functions respectively. Calling up will clear the aliases set in the depth below

Template Struct lookup_table< udho::prepared< DataT > >
Struct Documentation
template<typename DataT>
struct udho::lookup_table<udho::prepared<DataT>>

Public Types

typedef udho::prepared<DataT> prepared_type
typedef boost::multi_index_container<declaration, boost::multi_index::indexed_by<boost::multi_index::ordered_unique<boost::multi_index::identity<declaration>>, boost::multi_index::ordered_unique<boost::multi_index::member<declaration, std::string, &declaration::_id>>, boost::multi_index::ordered_non_unique<boost::multi_index::member<declaration, std::size_t, &declaration::_depth>>>> storage_type
typedef storage_type::nth_index<1>::type named_storage_type
typedef storage_type::nth_index<2>::type depth_storage_type

Public Functions

lookup_table(const prepared_type &p)
bool valid(const std::string &key) const
std::string lookup(const std::string &key) const
bool add(const std::string &key, const std::string &ref, std::size_t depth)
std::size_t clear(std::size_t depth)
std::string eval(const std::string &key) const
std::string operator[](const std::string &key) const
template<typename T>
T extract(const std::string &key) const
template<typename T>
T parse(const std::string &key) const
std::vector<std::string> keys(const std::string &key) const
std::size_t count(const std::string &key) const
std::size_t down()
std::size_t up()
bool add(const std::string &key, const std::string &ref)

Public Members

const prepared_type &_prepared
storage_type _storage
named_storage_type &_storage_named
depth_storage_type &_storage_depth
std::size_t _level
Template Struct lookup_table< udho::prepared_group< U, V > >
Struct Documentation
template<typename U, typename V>
struct udho::lookup_table<udho::prepared_group<U, V>>

Public Types

typedef udho::prepared_group<U, V> prepared_type
typedef boost::multi_index_container<declaration, boost::multi_index::indexed_by<boost::multi_index::ordered_unique<boost::multi_index::identity<declaration>>, boost::multi_index::ordered_unique<boost::multi_index::member<declaration, std::string, &declaration::_id>>, boost::multi_index::ordered_non_unique<boost::multi_index::member<declaration, std::size_t, &declaration::_depth>>>> storage_type
typedef storage_type::nth_index<1>::type named_storage_type
typedef storage_type::nth_index<2>::type depth_storage_type

Public Functions

lookup_table(const prepared_type &p)
bool valid(const std::string &key) const
std::string lookup(const std::string &key) const
bool add(const std::string &key, const std::string &ref, std::size_t depth)
std::size_t clear(std::size_t depth)
std::string eval(const std::string &key) const
std::string operator[](const std::string &key) const
template<typename T>
T extract(const std::string &key) const
template<typename T>
T parse(const std::string &key) const
std::vector<std::string> keys(const std::string &key) const
std::size_t count(const std::string &key) const
std::size_t down()
std::size_t up()
bool add(const std::string &key, const std::string &ref)

Public Members

const prepared_type &_prepared
storage_type _storage
named_storage_type &_storage_named
depth_storage_type &_storage_depth
std::size_t _level
Template Struct module_evaluator
Struct Documentation
template<typename VisitorT, typename ModuleT, bool IsApplication = is_application<ModuleT>::value>
struct module_evaluator
Template Struct module_evaluator< VisitorT, ModuleT, false >
Struct Documentation
template<typename VisitorT, typename ModuleT>
struct udho::module_evaluator<VisitorT, ModuleT, false>

Public Functions

module_evaluator(VisitorT &visitor)
void operator()(ModuleT &modul)

Public Members

VisitorT &_visitor
Template Struct module_evaluator< VisitorT, ModuleT, true >
Struct Documentation
template<typename VisitorT, typename ModuleT>
struct udho::module_evaluator<VisitorT, ModuleT, true>

Public Functions

module_evaluator(VisitorT &visitor)
void operator()(ModuleT &app)

Public Members

VisitorT &_visitor
Struct module_info
Struct Documentation
struct udho::module_info

Public Members

boost::beast::http::verb _method
std::string _pattern
std::string _compositor
const void *_fptr
std::vector<module_info> _children
Template Struct module_overload
Struct Documentation
template<typename Function, template<typename> class CompositorT = compositors::transparent>
struct udho::module_overload

Public Types

typedef Function function_type
typedef module_overload<Function, CompositorT> self_type
typedef internal::function_signature<Function>::return_type return_type
typedef internal::function_signature<Function>::tuple_type tuple_type
typedef internal::function_signature<Function>::arguments_type arguments_type
typedef CompositorT<return_type> compositor_type
typedef compositor_type::response_type response_type

Public Functions

module_overload(boost::beast::http::verb request_method, function_type f, compositor_type compositor = compositor_type())
module_overload(const self_type &other)
std::string pattern() const
self_type &operator=(const std::string &pattern)
bool feasible(boost::beast::http::verb request_method, const std::string &subject) const

check number of arguments supplied on runtime and number of arguments with which this overload has been prepared at compile time.

template<typename T>
return_type call(T &value, const std::vector<std::string> &args)
template<typename T>
response_type operator()(T &value, const std::vector<std::string> &args)
template<typename T>
response_type operator()(T &value, const std::string &subject)
module_info info() const

Public Members

boost::beast::http::verb _request_method
std::string _pattern
function_type _function
compositor_type _compositor
Template Struct module_overload< Function, compositors::deferred >
Struct Documentation
template<typename Function>
struct udho::module_overload<Function, compositors::deferred>

Public Types

typedef Function function_type
typedef module_overload<Function, compositors::deferred> self_type
typedef internal::function_signature<Function>::return_type return_type
typedef internal::function_signature<Function>::tuple_type tuple_type
typedef internal::function_signature<Function>::arguments_type arguments_type
typedef compositors::deferred<return_type> compositor_type
typedef compositor_type::response_type response_type

Public Functions

module_overload(boost::beast::http::verb request_method, function_type f, compositor_type compositor = compositor_type())
module_overload(const self_type &other)
std::string pattern() const
self_type &operator=(const std::string &pattern)
bool feasible(boost::beast::http::verb request_method, const std::string &subject) const

check number of arguments supplied on runtime and number of arguments with which this overload has been prepared at compile time.

template<typename T>
void call(T &value, const std::vector<std::string> &args)
template<typename T>
void operator()(T &value, const std::vector<std::string> &args)
template<typename T>
void operator()(T &value, const std::string &subject)
module_info info() const

Public Members

boost::beast::http::verb _request_method
std::string _pattern
function_type _function
compositor_type _compositor
Template Struct multipart_form
Nested Relationships
Struct Documentation
template<typename Iterator>
struct udho::multipart_form

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 has(const std::string name) const

checks whether the form has any field with the given name

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

returns the part associated with the given name

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

returns the value of the field lexically casted with the desired type

form.field<int>("age");

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>
T value() const

lexically convert the contents of the body to the requested type

Public Members

header_map_type _headers
bounded_string_type _body
Struct multipart_form::form_part
Nested Relationships

This struct is a nested type of Template Struct multipart_form.

Struct Documentation
struct udho::multipart_form::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>
T value() const

lexically convert the contents of the body to the requested type

Public Members

header_map_type _headers
bounded_string_type _body
Template Struct overload_group
Struct Documentation
template<typename U, typename V>
struct udho::overload_group

compile time chain of url mappings

See

content_wrapper0

See

content_wrapper1

Public Types

typedef overload_group<U, V> self_type

type of this overload

typedef U parent_type

type of the parient in the meta-chain of overloads

typedef V overload_type

type of the next child in the overload chain

typedef parent_type::terminal_type terminal_type

Public Functions

overload_group(const parent_type &parent, const overload_type &overload)
template<typename ContextT, typename Lambda>
int serve(ContextT &ctx, boost::beast::http::verb request_method, const std::string &subject, Lambda send)

serves the content if the http request matches with the content’s request method and path. Calls the callback in _overload if it is feasible for the current request. Otherwise bubbles the request meta-recursively if some other overload group is feasible.

Parameters
  • req: the http request to serve

  • request_method: http vmethod get post put head etc …

  • subject: http resource path

  • send: the write callback

void summary(std::vector<module_info> &stack) const
template<typename AttachmentT>
self_type &listen(boost::asio::io_service &io, AttachmentT &attachment, int port = 9198)
template<typename F>
void eval(F &fnc)
const terminal_type &terminal() const

Public Members

parent_type _parent
overload_type _overload
Template Struct overload_group< U, app_< V, Ref > >
Struct Documentation
template<typename U, typename V, bool Ref>
struct udho::overload_group<U, app_<V, Ref>>

Public Types

typedef overload_group<U, app_<V, Ref>> self_type
typedef U parent_type
typedef app_<V, Ref> overload_type
typedef parent_type::terminal_type terminal_type

Public Functions

overload_group(const parent_type &parent, const overload_type &overload)
template<typename ContextT, typename Lambda>
int serve(ContextT &ctx, boost::beast::http::verb request_method, const std::string &subject, Lambda send)
void summary(std::vector<module_info> &stack) const
template<typename AttachmentT>
self_type &listen(boost::asio::io_service &io, AttachmentT &attachment, int port = 9198)
template<typename F>
void eval(F &fnc)
const terminal_type &terminal() const

Public Members

parent_type _parent
overload_type _overload
Template Struct overload_group< U, overload_terminal< V > >
Struct Documentation
template<typename U, typename V>
struct udho::overload_group<U, overload_terminal<V>>

terminal node of the compile time chain of url mappings

See

content_wrapper0

See

content_wrapper1

Public Types

typedef overload_group<U, overload_terminal<V>> self_type

type of this overload

typedef V overload_type

type of parent in the overoad meta-chain

typedef U parent_type

type of the next child in the overload chain

typedef overload_terminal<V> terminal_type

Public Functions

template<typename ...Args>
overload_group(Args... args)
template<typename ContextT, typename Lambda>
int serve(ContextT &ctx, boost::beast::http::verb request_method, const std::string &subject, Lambda send)
void summary(std::vector<module_info>&) const
template<typename F>
void eval(F &fnc)
const terminal_type &terminal() const

Public Members

terminal_type _terminal
Template Struct overload_group< U, overload_terminal< void > >
Struct Documentation
template<typename U>
struct udho::overload_group<U, overload_terminal<void>>

Public Types

typedef overload_group<U, overload_terminal<void>> self_type

type of this overload

typedef void overload_type

type of parent in the overoad meta-chain

typedef U parent_type

type of the next child in the overload chain

typedef overload_terminal<void> terminal_type

Public Functions

template<typename ...Args>
overload_group(Args...)
template<typename ContextT, typename Lambda>
int serve(ContextT&, boost::beast::http::verb, const std::string&, Lambda)
void summary(std::vector<module_info>&) const
template<typename F>
void eval(F&)
const terminal_type &terminal() const

Public Members

terminal_type _terminal
Template Struct overload_group_helper
Struct Documentation
template<typename OverloadT, typename ResponseT = typename OverloadT::response_type>
struct udho::overload_group_helper

Public Types

typedef OverloadT overload_type
typedef overload_type::response_type response_type

Public Functions

overload_group_helper(OverloadT &overload)
template<typename ContextT, typename Lambda>
int resolve(ContextT &ctx, Lambda send, const std::string &subject)

Public Members

OverloadT &_overload
Template Struct overload_group_helper< OverloadT, void >
Struct Documentation
template<typename OverloadT>
struct udho::overload_group_helper<OverloadT, void>

Public Types

typedef OverloadT overload_type
typedef void response_type

Public Functions

overload_group_helper(OverloadT &overload)
template<typename ContextT, typename Lambda>
int resolve(ContextT &ctx, Lambda send, const std::string &subject)

Public Members

OverloadT &_overload
Template Struct overload_terminal
Inheritance Relationships
Base Type
  • public AuxT

Struct Documentation
template<typename AuxT = void>
struct udho::overload_terminal : public AuxT

Public Types

typedef AuxT aux_type
Template Struct overload_terminal< void >
Struct Documentation
template<>
struct udho::overload_terminal<void>

Public Types

typedef void aux_type

Public Functions

template<typename ...Args>
overload_terminal(Args...)
Template Struct prepare
Struct Documentation
template<typename DerivedT>
struct udho::prepare

Public Types

typedef DerivedT prepared_type

Public Functions

template<typename F>
auto var(const std::string &key, F f)
template<typename F>
auto var(const std::string &key, F f) const
template<typename F>
auto fn(const std::string &key, F f)
template<typename F>
auto fn(const std::string &key, F f) const
auto index() const
Template Struct prepared
Struct Documentation
template<typename T, bool IsPrepared = detail::is_prepared<T>::value>
struct prepared

prepared<T> keeps a copy of the string based index returned by the T::index() function and const references the actual data object of type T. It also instantiates a visitor for travarsing that data object and extracting the values.

Template Struct prepared< T, true >
Struct Documentation
template<typename T>
struct udho::prepared<T, true>

Public Types

typedef T derived_type
typedef std::result_of<decltype(&derived_type::index)(const derived_type*)>::type index_type
typedef detail::association_group_visitor<index_type> visitor_type

Public Functions

prepared(const derived_type &data)
prepared(const prepared<T, true> &other)

a visitor keeps a reference to the index, So while copy constructing if the other object is going to be destructed then the copied visitor will have a dangling reference to the other._index hence the copy constructor instantiates a visitor again from the copied index

template<typename V>
V extract(const std::string &key, bool *okay = 0x0) const
template<typename V>
V parse(const std::string &key, bool *okay = 0x0) const
std::string stringify(const std::string &key, bool *okay = 0x0) const
template<typename V>
V at(const std::string &key, bool *okay = 0x0) const
std::string operator[](const std::string &key) const
std::size_t count(const std::string &key) const
std::vector<std::string> keys(const std::string &key) const

Public Members

const derived_type &_data
index_type _index
visitor_type _visitor
Template Struct prepared_group
Struct Documentation
template<typename H, typename T = void>
struct udho::prepared_group

Fold expression containing multiple prepared objects. Head is always type of udho::prepared<X> where X subclasses from udho::prepare<X> Tail is another prepared_group The actual prepared object is copied so it works even if the actual prepared object is an rvalue

Public Types

typedef H head_type
typedef T tail_type
typedef prepared_group<H, T> self_type

Public Functions

prepared_group(const head_type &head, const tail_type &tail)
template<typename V>
V extract(const std::string &key) const
template<typename V>
V parse(const std::string &key) const
std::string stringify(const std::string &key) const
template<typename V>
V at(const std::string &key) const
std::string operator[](const std::string &key) const
std::size_t count(const std::string &key) const
std::vector<std::string> keys(const std::string &key) const

Public Members

head_type _head
tail_type _tail
Template Struct prepared_group< H, void >
Struct Documentation
template<typename H>
struct udho::prepared_group<H, void>

Public Types

typedef H head_type
typedef prepared_group<H, void> self_type

Public Functions

prepared_group(const head_type &head)
template<typename V>
V extract(const std::string &key) const
template<typename V>
V parse(const std::string &key) const
std::string stringify(const std::string &key) const
template<typename V>
V at(const std::string &key) const
std::string operator[](const std::string &key) const
std::size_t count(const std::string &key) const
std::vector<std::string> keys(const std::string &key) const

Public Members

head_type _head
Template Struct proxy
Struct Documentation
template<typename K, typename C>
struct udho::proxy

Public Types

typedef K key_type
typedef C config_type
typedef proxy<K, C> proxy_type

Public Functions

proxy(config_type &conf)
value_type value() const
operator value_type() const
template<typename V>
proxy_type &operator=(V value)

Public Members

decltype(C().get(K())) typedef value_type
config_type &_config
Template Struct proxy< configs::server_<>::mimes_t, config< configs::server_<> > >
Struct Documentation
template<>
struct udho::proxy<configs::server_<>::mimes_t, config<configs::server_<>>>

Public Types

typedef configs::server_::mimes_t key_type
typedef config<configs::server_<>> config_type
typedef proxy<key_type, config_type> proxy_type

Public Functions

proxy(config_type &conf)
value_type value() const
operator value_type() const
template<typename V>
proxy_type &operator=(V value)
std::string at(const std::string &key) const
std::string of(const std::string &key) const
void set(const std::string &ext, const std::string &mime)

Public Members

decltype(config_type().get(key_type())) typedef value_type
config_type &_config
Struct reroute
Struct Documentation
struct udho::reroute

Public Types

boost::function< boost::beast::http::response< boost::beast::http::string_body >udho::contexts::stateless)> function_type

Public Functions

reroute(const std::string &alt_path)
std::string alt_path() const
boost::beast::http::response<boost::beast::http::string_body> operator()(udho::contexts::stateless ctx)

Public Members

std::string _alt_path
Template Struct server
Struct Documentation
template<typename AuxT, typename LoggerT = void, typename CacheT = void>
struct udho::server

Todo:

write docs

Public Types

typedef LoggerT logger_type
typedef CacheT cache_type
typedef AuxT auxiliary_type
typedef udho::attachment<auxiliary_type, logger_type, cache_type> attachment_type
typedef server<auxiliary_type, logger_type, cache_type> self_type
typedef attachment_type::configuration_type configuration_type
using context_type = udho::context<auxiliary_type, RequestT, attachment_type>
typedef udho::defs::request_type http_request_type
typedef http_request_type request_type

Public Functions

server(boost::asio::io_service &io, logger_type &logger)
server(const self_type&) = delete
server(self_type &&other) = default
template<typename RouterT>
void serve(RouterT &&router, int port = 9198)
template<typename FeatureT>
auto operator+=(const FeatureT &feature)
configuration_type &config()
const configuration_type &config() const
template<typename ConfigKeyT>
auto operator[](const ConfigKeyT &k)
template<typename ConfigKeyT>
auto operator[](const ConfigKeyT &k) const

Public Members

boost::asio::io_service &_io
attachment_type _attachment
Template Struct server< AuxT, void, CacheT >
Struct Documentation
template<typename AuxT, typename CacheT>
struct udho::server<AuxT, void, CacheT>

Public Types

typedef CacheT cache_type
typedef AuxT auxiliary_type
typedef udho::attachment<auxiliary_type, void, cache_type> attachment_type
typedef server<auxiliary_type, void, cache_type> self_type
typedef attachment_type::configuration_type configuration_type
using context_type = udho::context<auxiliary_type, RequestT, attachment_type>
typedef udho::defs::request_type http_request_type
typedef context_type<http_request_type> context
typedef http_request_type request_type

Public Functions

server(boost::asio::io_service &io)
server(const self_type&) = delete
server(self_type &&other) = default
template<typename RouterT>
void serve(RouterT &&router, int port = 9198)
template<typename FeatureT>
auto operator+=(const FeatureT &feature)
configuration_type &config()
const configuration_type &config() const
template<typename ConfigKeyT>
auto operator[](const ConfigKeyT &k)
template<typename ConfigKeyT>
auto operator[](const ConfigKeyT &k) const

Public Members

boost::asio::io_service &_io
attachment_type _attachment
Template Struct logged
Struct Documentation
template<typename T>
struct udho::servers::logged

Public Types

typedef T logger_type
using stateful = server<udho::bridge<udho::configuration_type>, logger_type, udho::cache::store<StorageT, boost::uuids::uuid, U...>>
using stateless = server<udho::bridge<udho::configuration_type>, logger_type, void>
Template Struct ostreamed_helper
Struct Documentation
template<typename CacheT>
struct udho::servers::ostreamed::ostreamed_helper

Public Types

typedef server<udho::bridge<udho::configuration_type>, udho::loggers::ostream, CacheT> server_type
typedef server_type::logger_type logger_type
typedef server_type::cache_type cache_type
typedef server_type::attachment_type attachment_type
typedef server_type::http_request_type request_type

Public Functions

ostreamed_helper(boost::asio::io_service &io, udho::loggers::ostream::stream_type &stream)
template<typename RouterT>
void serve(RouterT &&router, int port = 9198)
template<typename FeatureT>
auto operator+=(const FeatureT &feature)
server_type::configuration_type &config()
const server_type::configuration_type &config() const
template<typename ConfigKeyT>
auto operator[](const ConfigKeyT &k)
template<typename ConfigKeyT>
auto operator[](const ConfigKeyT &k) const

Public Members

udho::loggers::ostream _logger
server_type _server
Template Struct stateful
Struct Documentation
template<template<typename, typename> class StorageT, typename ...T>
struct udho::servers::stateful

Public Types

typedef udho::cache::store<StorageT, boost::uuids::uuid, T...> cache_type
using logged = server<udho::bridge<udho::configuration_type>, LoggerT, cache_type>
using ostreamed = logged<udho::loggers::ostream>
using quiet = server<udho::bridge<udho::configuration_type>, void, cache_type>
Template Struct session_
Struct Documentation
template<typename RequestT, typename ShadowT>
struct udho::session_

Public Types

typedef RequestT request_type
typedef udho::cookies_<request_type> cookies_type
typedef ShadowT shadow_type
typedef shadow_type::key_type key_type
typedef session_<request_type, shadow_type> self_type
typedef udho::cache::generator<key_type> generator_type
typedef udho::config<udho::configs::session> session_config_type

Public Functions

session_(cookies_type &cookies, shadow_type &shadow, const session_config_type &config)
template<typename ...T>
session_(session_<request_type, udho::cache::shadow<key_type, T...>> &other)
void identify()
const session_config_type &config() const
const key_type &id() const
bool returning() const
template<typename V>
bool exists() const
template<typename V>
V get() const
template<typename V>
V at()
template<typename V>
void set(const V &value)
std::size_t size() const
bool remove()
template<typename V>
bool remove()
boost::posix_time::ptime created() const
boost::posix_time::ptime updated() const
boost::posix_time::time_duration age() const
boost::posix_time::time_duration idle() const
template<typename V>
boost::posix_time::ptime created() const
template<typename V>
boost::posix_time::ptime updated() const
template<typename V>
boost::posix_time::time_duration age() const
template<typename V>
boost::posix_time::time_duration idle() const
std::string sessid() const

Public Members

const session_config_type &_config
cookies_type &_cookies
shadow_type _shadow
bool _returning
bool _identified
key_type _id
generator_type _generator
Template Struct session_< RequestT, void >
Struct Documentation
template<typename RequestT>
struct udho::session_<RequestT, void>

Public Functions

template<typename ...U>
session_(U...)
Template Struct start
Struct Documentation
template<typename ...T>
struct udho::start

Public Functions

start() = delete
start(const start<T...>&) = delete

Public Static Functions

template<typename ContextT>
start_<ContextT, T...> with(ContextT ctx, const std::string &name = "activity")
Template Struct start_
Inheritance Relationships
Base Type
Struct Documentation
template<typename ContextT, typename ...T>
struct udho::start_ : public udho::activities::subtask<activities::start<ContextT, T...>>

Public Types

typedef activities::start<ContextT, T...> activity_type
typedef activities::subtask<activity_type> base
typedef activity_type::collector_type collector_type
typedef activity_type::accessor_type accessor_type

Public Functions

start_(ContextT ctx, const std::string &name = "activity")
auto collector()
auto data() const
auto data()
template<typename ActivityT>
auto success() const
template<typename ActivityT>
auto failure() const
Struct url
Nested Relationships
Nested Types
Inheritance Relationships
Base Types
Struct Documentation
struct udho::url : public udho::configuration<detail::url_data>, public udho::forms::drivers::urlencoded_<Iterator>

Public Types

typedef udho::forms::drivers::urlencoded_raw urlencoded_type

Public Functions

url() = delete
url(const url &other)
std::string stringify() const

Public Static Functions

url build(const std::string &base, const std::initializer_list<param> &params)
url parse(const std::string &str)
class param

Public Functions

param(const std::string &k, const std::string &v)
std::string key() const
std::string value() const
std::string to_string() const
Template Struct urlencoded_form
Struct Documentation
template<typename Iterator>
struct udho::urlencoded_form

Form accessor for urlencoded 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(iterator_type begin, iterator_type end)
std::size_t count() const

number of fields in the form

bool has(const std::string name) const

checks whether there exists any field with the name provided

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

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

Public Members

header_map_type _fields
Template Struct is_invocable
Inheritance Relationships
Base Type
  • public std::is_constructible< std::function< void(Args ...)>, std::reference_wrapper< std::remove_reference< F >::type > >

Struct Documentation
template<typename F, typename ...Args>
struct is_invocable : public std::is_constructible<std::function<void(Args...)>, std::reference_wrapper<std::remove_reference<F>::type>>
Template Struct parser
Struct Documentation
template<typename ScopeT, typename ContextT>
struct udho::view::parser

Public Types

typedef ScopeT table_type
typedef parsing::expression<table_type> evaluator_type
typedef parsing::xml<ContextT> xml_parser_type
typedef parsing::tags::block<table_type, ContextT> block_directive_type
typedef parsing::tags::var<table_type, ContextT> var_directive_type
typedef parsing::tags::loop<table_type, ContextT> loop_directive_type
typedef parsing::tags::condition<table_type, ContextT> condition_directive_type
typedef parsing::tags::text<table_type, ContextT> text_directive_type
typedef parsing::tags::html<table_type, ContextT> html_directive_type
typedef parsing::tags::eval<table_type, ContextT> eval_directive_type
typedef parsing::tags::skip<table_type, ContextT> skip_directive_type
typedef parsing::attrs::target<table_type, ContextT> target_directive_type
typedef parsing::attrs::eval<table_type, ContextT> eval_attr_directive_type
typedef parsing::attrs::add_class<table_type, ContextT> add_class_directive_type
typedef parsing::attrs::condition<table_type, ContextT> condition_attr_directive_type

Public Functions

parser(table_type &scope, const ContextT &ctx)
void prepare()
std::string process(const std::string &contents)
Template Struct add_class
Struct Documentation
template<typename ScopeT, typename ContextT>
struct udho::view::parsing::attrs::add_class

udho::add-class:NAME = EXPR will add a class named NAME if the expression EXPR is true.

<div udho:add-class:visible="count(books) > 1"></div>
is transformed to
<div class="visible"></div>

Public Types

typedef ScopeT table_type
typedef parsing::expression<ScopeT> evaluator_type

Public Functions

add_class(parsing::xml<ContextT> &ctrl, table_type &table)
bool operator()(pugi::xml_node node, pugi::xml_node, pugi::xml_attribute attr, const ContextT &ctx)
std::string prefix() const

Public Members

parsing::xml<ContextT> &_ctrl
table_type &_table
evaluator_type _evaluator
Template Struct condition
Struct Documentation
template<typename ScopeT, typename ContextT>
struct udho::view::parsing::attrs::condition

works like the udho:if tag but can be used in attribute

Public Types

typedef ScopeT table_type
typedef parsing::expression<ScopeT> evaluator_type

Public Functions

condition(parsing::xml<ContextT> &ctrl, table_type &table)
bool operator()(pugi::xml_node node, pugi::xml_node, pugi::xml_attribute attr, const ContextT &ctx)
std::string prefix() const

Public Members

parsing::xml<ContextT> &_ctrl
table_type &_table
evaluator_type _evaluator
Template Struct eval
Struct Documentation
template<typename ScopeT, typename ContextT>
struct udho::view::parsing::attrs::eval

udho::eval:NAME = EXPR will add an attribute named NAME with value retrieved by evaluating the expression EXPR. It can have a conditional form too where the condition expr is first evaluated and if expr is true then the attribute is added, otherwise not

<input type="text" udho:eval:value="count(books)"></input>
<input type="text" udho:eval:title="expr ? count(books)"></input>
is transformed to
<input type="text" value="2"></input>
<input type="text" value="2"></input>

Public Types

typedef ScopeT table_type
typedef parsing::expression<ScopeT> evaluator_type

Public Functions

eval(parsing::xml<ContextT> &ctrl, table_type &table)
bool operator()(pugi::xml_node node, pugi::xml_node, pugi::xml_attribute attr, const ContextT &ctx)
std::string prefix() const

Public Members

parsing::xml<ContextT> &_ctrl
table_type &_table
evaluator_type _evaluator
Template Struct target
Struct Documentation
template<typename ScopeT, typename ContextT>
struct udho::view::parsing::attrs::target

udho::target:NAME = KEY will add an attribute named NAME with value retrieved by resolving KEY through scope table. It can have a conditional form too where the condition expr is first evaluated and if expr is true then the attribute is added, otherwise not

<div class="book" udho:target:title="book.title"></div>
<div class="book" udho:target:title="expr ? book.title"></div>
is transformed to
<div class="book" title="Some title"></div>
<div class="book" title="Some title"></div>

Public Types

typedef ScopeT table_type
typedef parsing::expression<ScopeT> evaluator_type

Public Functions

target(parsing::xml<ContextT> &ctrl, table_type &table)
bool operator()(pugi::xml_node node, pugi::xml_node, pugi::xml_attribute attr, const ContextT &ctx)
std::string prefix() const

Public Members

parsing::xml<ContextT> &_ctrl
table_type &_table
evaluator_type _evaluator
Template Struct expression
Struct Documentation
template<typename ScopeT>
struct udho::view::parsing::expression

Public Types

typedef ScopeT scope_type

Public Functions

expression(scope_type &table)
std::vector<token> rpn(const std::string &infix)
template<typename T>
T fetch(const token &t)
std::size_t count(const token &t) const
template<typename T>
T evaluate(const std::string &infix)

Public Members

scope_type &_table
Template Struct block
Struct Documentation
template<typename ScopeT, typename ContextT>
struct udho::view::parsing::tags::block

udho::block

Public Types

typedef ScopeT table_type
typedef parsing::expression<ScopeT> evaluator_type

Public Functions

block(parsing::xml<ContextT> &ctrl, table_type &table)
bool operator()(pugi::xml_node node, pugi::xml_node target, const ContextT &ctx)
std::string prefix() const

Public Members

parsing::xml<ContextT> &_ctrl
table_type &_table
evaluator_type _evaluator
Template Struct condition
Struct Documentation
template<typename ScopeT, typename ContextT>
struct udho::view::parsing::tags::condition

udho::if

Public Types

typedef ScopeT table_type
typedef parsing::expression<ScopeT> evaluator_type

Public Functions

condition(parsing::xml<ContextT> &ctrl, table_type &table)
bool operator()(pugi::xml_node node, pugi::xml_node target, const ContextT &ctx)
std::string prefix() const

Public Members

parsing::xml<ContextT> &_ctrl
table_type &_table
evaluator_type _evaluator
Template Struct eval
Struct Documentation
template<typename ScopeT, typename ContextT>
struct udho::view::parsing::tags::eval

udho::eval

Public Types

typedef ScopeT table_type
typedef parsing::expression<ScopeT> evaluator_type

Public Functions

eval(parsing::xml<ContextT> &ctrl, table_type &table)
bool operator()(pugi::xml_node node, pugi::xml_node target, const ContextT &ctx)
std::string prefix() const

Public Members

parsing::xml<ContextT> &_ctrl
table_type &_table
evaluator_type _evaluator
Template Struct html
Struct Documentation
template<typename ScopeT, typename ContextT>
struct udho::view::parsing::tags::html

udho::html

Public Types

typedef ScopeT table_type
typedef parsing::expression<ScopeT> evaluator_type

Public Functions

html(parsing::xml<ContextT> &ctrl, table_type &table)
bool operator()(pugi::xml_node node, pugi::xml_node target, const ContextT &ctx)
std::string prefix() const

Public Members

parsing::xml<ContextT> &_ctrl
table_type &_table
evaluator_type _evaluator
Template Struct loop
Struct Documentation
template<typename ScopeT, typename ContextT>
struct udho::view::parsing::tags::loop

udho::for

Public Types

typedef ScopeT table_type
typedef parsing::expression<ScopeT> evaluator_type

Public Functions

loop(parsing::xml<ContextT> &ctrl, table_type &table)
bool operator()(pugi::xml_node node, pugi::xml_node target, const ContextT &ctx)
std::string prefix() const

Public Members

parsing::xml<ContextT> &_ctrl
table_type &_table
evaluator_type _evaluator
Template Struct skip
Struct Documentation
template<typename ScopeT, typename ContextT>
struct udho::view::parsing::tags::skip

udho::template

Public Types

typedef ScopeT table_type
typedef parsing::expression<ScopeT> evaluator_type

Public Functions

skip(parsing::xml<ContextT> &ctrl, table_type &table)
bool operator()(pugi::xml_node node, pugi::xml_node target, const ContextT &ctx)
std::string prefix() const

Public Members

parsing::xml<ContextT> &_ctrl
table_type &_table
evaluator_type _evaluator
Template Struct text
Struct Documentation
template<typename ScopeT, typename ContextT>
struct udho::view::parsing::tags::text

udho::text

Public Types

typedef ScopeT table_type
typedef parsing::expression<ScopeT> evaluator_type

Public Functions

text(parsing::xml<ContextT> &ctrl, table_type &table)
bool operator()(pugi::xml_node node, pugi::xml_node target, const ContextT &ctx)
std::string prefix() const

Public Members

parsing::xml<ContextT> &_ctrl
table_type &_table
evaluator_type _evaluator
Template Struct var
Struct Documentation
template<typename ScopeT, typename ContextT>
struct udho::view::parsing::tags::var

udho::var

Public Types

typedef ScopeT table_type
typedef parsing::expression<ScopeT> evaluator_type

Public Functions

var(parsing::xml<ContextT> &ctrl, table_type &table)
bool operator()(pugi::xml_node node, pugi::xml_node target, const ContextT &ctx)
std::string prefix() const

Public Members

parsing::xml<ContextT> &_ctrl
table_type &_table
evaluator_type _evaluator
Struct token
Struct Documentation
struct udho::view::parsing::token

Public Types

enum type

Values:

enumerator op
enumerator function
enumerator call
enumerator comma
enumerator parenthesis_open
enumerator parenthesis_close
enumerator real
enumerator id
enum category

Values:

enumerator none
enumerator arithmetic
enumerator logical
enumerator junction
typedef std::map<std::string, std::size_t> operator_map_type
typedef std::map<std::string, int> function_map_type

Public Functions

bool is(const type &t) const
bool is(const category &c) const
int precedence() const
std::string value() const

Public Static Functions

token create(const std::string &buff)
template<typename T>
T arithmatic(const token &op_token, const T &l, const T &r)
template<typename T>
bool logical(const token &op_token, const T &l, const T &r)
Template Struct xml
Struct Documentation
template<typename ContextT>
struct udho::view::parsing::xml

Public Types

typedef ContextT context_type
typedef boost::function<bool(pugi::xml_node, pugi::xml_node, const context_type&)> tag_directive
typedef boost::function<bool(pugi::xml_node, pugi::xml_node, pugi::xml_attribute, const context_type&)> attr_directive
typedef std::map<std::string, tag_directive> tag_directive_map
typedef std::map<std::string, attr_directive> attr_directive_map

Public Functions

xml(const context_type &ctx)
void open(const std::string &contents)
void clear()
void parse(pugi::xml_node node, pugi::xml_node target)
void step_in(pugi::xml_node node, pugi::xml_node target)
void travarse(pugi::xml_node node, pugi::xml_node target)
void parse()
std::string output()
template<typename DirectiveT>
xml &add_directive_tag(DirectiveT directive)
template<typename DirectiveT>
xml &add_directive_attr(DirectiveT directive)

Public Members

const context_type &_ctx
pugi::xml_document _source
pugi::xml_document _transformed
tag_directive_map _directives_tag
attr_directive_map _directives_attr
Template Struct visitor
Inheritance Relationships
Base Type
  • public VisitorT

Struct Documentation
template<typename VisitorT>
struct udho::visitor : public VisitorT

Public Functions

template<typename ModuleT>
void operator()(ModuleT &overload)
void operator()()
Template Struct printing_visitor
Struct Documentation
template<std::uint8_t Visitables, typename StreamT>
struct udho::visitors::printing_visitor

Public Functions

printing_visitor(StreamT &stream)
template<typename V>
StreamT &column(const V &v, int width)
template<typename ModuleT>
void _module(const ModuleT &overload)
template<typename AppT>
void _application(const AppT &app)
void operator()()

Public Members

StreamT &_stream
std::size_t _indent
Template Struct printing_visitor_html
Struct Documentation
template<std::uint8_t Visitables, typename StreamT>
struct udho::visitors::printing_visitor_html

Public Functions

printing_visitor_html(StreamT &stream)
template<typename ModuleT>
void _module(const ModuleT &overload)
template<typename AppT>
void _application(const AppT &app)
void operator()()

Public Members

StreamT &_stream
std::size_t _indent
Template Struct target_application
Struct Documentation
template<typename F, std::uint8_t Visitables, std::uint8_t HasApplication = (Visitables & visitable::application)>
struct udho::visitors::target_application

Public Functions

target_application(F callback)
template<typename AppT>
void _application(AppT &overload)

Public Members

F _callback
Template Struct target_application< F, Visitables, 0 >
Struct Documentation
template<typename F, std::uint8_t Visitables>
struct udho::visitors::target_application<F, Visitables, 0>

Public Functions

target_application(F callback)
template<typename AppT>
void _application(AppT&)

Public Members

F _callback
Template Struct target_module
Struct Documentation
template<typename F, std::uint8_t Visitables, std::uint8_t HasModule = (Visitables & visitable::callable)>
struct udho::visitors::target_module

Public Functions

target_module(F callback)
template<typename ModuleT>
void _module(ModuleT &overload)

Public Members

F _callback
Template Struct target_module< F, Visitables, 0 >
Struct Documentation
template<typename F, std::uint8_t Visitables>
struct udho::visitors::target_module<F, Visitables, 0>

Public Functions

target_module(F callback)
template<typename ModuleT>
void _module(ModuleT&)

Public Members

F _callback
Template Struct targetted_visitor
Inheritance Relationships
Base Types
Struct Documentation
template<std::uint8_t Visitables, typename F>
struct udho::visitors::targetted_visitor : public udho::visitors::target_module<F, Visitables>, public udho::visitors::target_application<F, Visitables>

Public Functions

targetted_visitor(F callback)
void operator()()
Struct visitable
Struct Documentation
struct udho::visitors::visitable

Public Static Attributes

const std::uint8_t callable = (1 << 0)
const std::uint8_t application = (1 << 1)
const std::uint8_t both = callable | application
Template Struct watch
Struct Documentation
template<typename DerivedT, typename KeyT>
struct udho::watch

Public Types

typedef KeyT key_type
typedef watch<DerivedT, KeyT> self_type
typedef boost::posix_time::ptime time_point_type
typedef boost::posix_time::time_duration time_duration_type

Public Functions

watch(const key_type &key)
void release(const boost::system::error_code &e = boost::asio::error::operation_aborted)
time_point_type expiry() const
bool released() const
key_type key() const
bool valid() const
void expire_at(boost::posix_time::ptime time)

Public Members

key_type _key
time_point_type _expiry
bool _released
Template Struct watcher
Struct Documentation
template<typename WatchT>
struct udho::watcher

Public Types

typedef WatchT watch_type
typedef watch_type::key_type key_type
typedef watcher<WatchT> self_type
typedef std::list<watch_type> container_type
typedef container_type::iterator iterator_type
typedef std::multimap<key_type, iterator_type> index_type
typedef boost::posix_time::ptime time_point_type
typedef boost::posix_time::time_duration time_duration_type

Public Functions

watcher(boost::asio::io_service &io, const time_duration_type &duration)
bool insert(watch_type watch)
void expired(const boost::system::error_code &err)
std::size_t notify(const key_type &key)
std::size_t notify_all()
void async_notify(const key_type &key)
void async_notify_all()

Public Members

boost::asio::io_service &_io
time_duration_type _duration
boost::asio::deadline_timer _timer
container_type _watchers
index_type _index
boost::mutex _mutex
Template Class analyzer
Class Documentation
template<typename ActivityT>
class udho::activities::analyzer

const udho::accessor<A1, A2i, A3i>& d;
d.apply<A1>(udho::activities::analyzer<A1>()
     .canceled([](const A1SData& s, const A1FData& f){
         std::cout << "CANCELED" << std::endl;
     })
     .incomplete([](){
         std::cout << "INCOMPLETE" << std::endl;
     })
     .failure([](const A1FData& f){
         std::cout << "FAILED" << std::endl;
     })
     .success([](const A1SData& s){
         std::cout << "SUCCESS" << std::endl;
     })
);
An analyzer can be applied on an activity to analyze its result data. The analyzer can be equipped with callbackss to handle different result states.

See

state

Public Functions

void operator()()
void operator()(const success_type &s, const failure_type &f)
void operator()(const failure_type &f)
void operator()(const success_type &s)
template<typename AccessorT>
analyzer(AccessorT accessor)

construct an analyzer

self_type &incomplete(incomplete_ftor_type ftor)

If the activity is incomplete and an incomplete callback is set then the incomplete callback is invoked if any of the following holds

  • there is no error callback

  • there is an error callback but the task has not been canceled

  • there is an error callback and the task has been canceled (

    See

    operator()(const success_type&, const failure_type&))

self_type &canceled(cancelation_ftor_type ftor)

If the activity is canceled and a canceled callback is set then the canceled callback is invoked if the following holds

  • there is no error callback

self_type &error(success_ftor_type ftor)

The error callback is called if the subtask has not failed but has been canceled (through cancel_if) Once the error callback is set failure and incomplete callbacks are invoked differently The error callback is called if the following holds

  • there is an error callback set and the activity is canceled and the activity has not failed

self_type &failure(failure_ftor_type ftor)

If the activity has failed and afailure callback is set then the failure callback is called if any of the following holds

  • there is no error callback

  • there is an error callback set and the activity is canceled

  • there is an error callback set and the activity is not canceled

self_type &success(success_ftor_type ftor)

If the activity is complete and neither failed nor canceled then the success callback is called if a a success callback is set

activity_state apply()
bool successful()
Template Class application
Class Documentation
template<typename DerivedT>
class udho::application

all applications derive from this class

applications are a class having a set of methods bound with urls

struct my_app: public udho::application<my_app>{
     my_app();
     int add(udho::request_type req, int a, int b);
     int mul(udho::request_type req, int a, int b);
     template <typename RouterT>
     auto route(RouterT& router){
         return router | (get(&my_app::add).plain() = "^/add/(\\d+)/(\\d+)$")
                       | (get(&my_app::mul).plain() = "^/mul/(\\d+)/(\\d+)$");
     }
};
Template Parameters
  • DerivedT: The derived application class

Public Functions

application(const std::string &name)
std::string name() const
template<typename F>
auto get(F f)

add a get method

Template Parameters
  • F: callback type

Parameters
  • f: callback

template<typename F>
auto post(F f)

add a post method

Template Parameters
  • F: callback type

Parameters
  • f: callback

template<typename F>
auto head(F f)

add a head method

Template Parameters
  • F: callback type

Parameters
  • f: callback

template<typename F>
auto put(F f)

add a put method

Template Parameters
  • F: callback type

Parameters
  • f: callback

template<typename F>
auto del(F f)

add a delete method

Template Parameters
  • F: callback type

Parameters
  • f: callback

Template Class connection
Nested Relationships
Inheritance Relationships
Base Type
  • public std::enable_shared_from_this< connection< RouterT, AttachmentT > >

Class Documentation
template<typename RouterT, typename AttachmentT>
class udho::connection : public std::enable_shared_from_this<connection<RouterT, AttachmentT>>

Stateful HTTP Session

Public Functions

connection(RouterT &router, attachment_type &attachment, socket_type socket)

session constructor

Parameters
  • router: router

  • socket: TCP socket

~connection()
void run()

start the read loop

void do_read()
void on_read(boost::system::error_code ec, std::size_t bytes_transferred)
void on_write(boost::system::error_code, std::size_t bytes_transferred, bool close)
void do_close()
void respond(udho::defs::response_type &msg)
Template Class is_streamable
Class Documentation
template<typename S, typename T>
class udho::detail::is_streamable

Public Static Attributes

const bool value = decltype(test<S,T>(0))::value
Template Class listener
Inheritance Relationships
Base Type
  • public std::enable_shared_from_this< listener< RouterT, AttachmentT > >

Class Documentation
template<typename RouterT, typename AttachmentT>
class udho::listener : public std::enable_shared_from_this<listener<RouterT, AttachmentT>>

listener runs accept loop for HTTP sockets

Public Functions

listener(RouterT &router, boost::asio::io_service &service, attachment_type &attachment, const boost::asio::ip::tcp::endpoint &endpoint)

Parameters
  • router: HTTP url mapping router

  • service: I/O service

  • endpoint: HTTP server endpoint to listen on

void stop()

stops accepting incomming connections

~listener()
void run()

starts the async accept loop

void accept()

accept an incomming connection

void on_accept(boost::system::error_code ec)
Class url::param
Nested Relationships

This class is a nested type of Struct url.

Class Documentation
class udho::url::param

Public Functions

param(const std::string &k, const std::string &v)
std::string key() const
std::string value() const
std::string to_string() const

Enums

Enum state
Enum Documentation
enum udho::activities::state

activity result states

Values:

enumerator unknown
enumerator incomplete

The activity is incomplete

enumerator failure

The activity has failed

enumerator success

The activity completed successfully

enumerator canceled

The activity is canceled

enumerator error

The activity is canceled but has not failed. The error state is only used when an error callback is passed to the analyzer

Enum form_type
Enum Documentation
enum udho::form_type

Values:

enumerator unparsed
enumerator urlencoded
enumerator multipart
Enum segment
Enum Documentation
enum udho::logging::segment

Values:

enumerator unknown
enumerator router
enumerator server
enumerator parser
enumerator user
Enum status
Enum Documentation
enum udho::logging::status

Values:

enumerator error
enumerator warning
enumerator info
enumerator debug

Functions

Template Function udho::activities::collect
Function Documentation
template<typename ...T, typename ContextT>
std::shared_ptr<collector<ContextT, dataset<T...>>> udho::activities::collect(ContextT &ctx, const std::string &name)
Template Function udho::activities::operator<<(collector<ContextT, dataset<T…>>&, const U&)
Function Documentation

Warning

doxygenfunction: Unable to resolve multiple matches for function “udho::activities::operator<<” with arguments (collector<ContextT, dataset<T…>>&, const U&) in doxygen xml output for project “udho” from directory: dox/xml. Potential matches:

- std::ostream &operator<<(std::ostream &os, const state &s)
- template<typename U, typename ...T> accessor<T...> &operator<<(accessor<T...> &h, const U &data)
- template<typename U, typename ContextT, typename ...T> collector<ContextT, dataset<T...>> &operator<<(collector<ContextT, dataset<T...>> &h, const U &data)
Template Function udho::activities::operator<<(accessor<T…>&, const U&)
Function Documentation

Warning

doxygenfunction: Unable to resolve multiple matches for function “udho::activities::operator<<” with arguments (accessor<T…>&, const U&) in doxygen xml output for project “udho” from directory: dox/xml. Potential matches:

- std::ostream &operator<<(std::ostream &os, const state &s)
- template<typename U, typename ...T> accessor<T...> &operator<<(accessor<T...> &h, const U &data)
- template<typename U, typename ContextT, typename ...T> collector<ContextT, dataset<T...>> &operator<<(collector<ContextT, dataset<T...>> &h, const U &data)
Function udho::activities::operator<<(std::ostream&, const state&)
Function Documentation

Warning

doxygenfunction: Unable to resolve multiple matches for function “udho::activities::operator<<” with arguments (std::ostream&, const state&) in doxygen xml output for project “udho” from directory: dox/xml. Potential matches:

- std::ostream &operator<<(std::ostream &os, const state &s)
- template<typename U, typename ...T> accessor<T...> &operator<<(accessor<T...> &h, const U &data)
- template<typename U, typename ContextT, typename ...T> collector<ContextT, dataset<T...>> &operator<<(collector<ContextT, dataset<T...>> &h, const U &data)
Template Function udho::activities::operator>>(const collector<ContextT, dataset<T…>>&, U&)
Function Documentation

Warning

doxygenfunction: Unable to resolve multiple matches for function “udho::activities::operator>>” with arguments (const collector<ContextT, dataset<T…>>&, U&) in doxygen xml output for project “udho” from directory: dox/xml. Potential matches:

- template<typename U, typename ...T> const accessor<T...> &operator>>(const accessor<T...> &h, U &data)
- template<typename U, typename ContextT, typename ...T> const collector<ContextT, dataset<T...>> &operator>>(const collector<ContextT, dataset<T...>> &h, U &data)
Template Function udho::activities::operator>>(const accessor<T…>&, U&)
Function Documentation

Warning

doxygenfunction: Unable to resolve multiple matches for function “udho::activities::operator>>” with arguments (const accessor<T…>&, U&) in doxygen xml output for project “udho” from directory: dox/xml. Potential matches:

- template<typename U, typename ...T> const accessor<T...> &operator>>(const accessor<T...> &h, U &data)
- template<typename U, typename ContextT, typename ...T> const collector<ContextT, dataset<T...>> &operator>>(const collector<ContextT, dataset<T...>> &h, U &data)
Template Function udho::after(T&…)
Function Documentation

Warning

doxygenfunction: Unable to resolve multiple matches for function “udho::after” with arguments (T&…) in doxygen xml output for project “udho” from directory: dox/xml. Potential matches:

- template<typename ...T> udho::activities::after<T...> after(T&... dependencies)
- udho::activities::after_none after()
Function udho::after()
Function Documentation
udho::activities::after_none udho::after()
Template Function udho::analyze
Function Documentation
template<typename ActivityT, typename AccessorT>
udho::activities::analyzer<ActivityT> udho::analyze(AccessorT &accessor)

See

udho::activities::analyzer

Template Function udho::app(T…)
Function Documentation

Warning

doxygenfunction: Unable to resolve multiple matches for function “udho::app” with arguments (T…) in doxygen xml output for project “udho” from directory: dox/xml. Potential matches:

- template<typename AppT, typename ...T> app_<AppT, false> app(T... args)
- template<typename AppT> app_<AppT, true> app(AppT &a)
Template Function udho::app(AppT&)
Function Documentation

Warning

doxygenfunction: Unable to resolve multiple matches for function “udho::app” with arguments (AppT&) in doxygen xml output for project “udho” from directory: dox/xml. Potential matches:

- template<typename AppT, typename ...T> app_<AppT, false> app(T... args)
- template<typename AppT> app_<AppT, true> app(AppT &a)
Template Function udho::associate
Function Documentation
template<typename F>
detail::association<F> udho::associate(const std::string &key, F callback)
Template Function udho::collect
Function Documentation
template<typename ...T, typename ContextT>
auto udho::collect(ContextT &ctx, const std::string &name)

shorthand for udho::activities::collect

Template Function udho::data(const T&)
Function Documentation

Warning

doxygenfunction: Unable to resolve multiple matches for function “udho::data” with arguments (const T&) in doxygen xml output for project “udho” from directory: dox/xml. Potential matches:

- template<typename H, typename T, typename ...Rest> auto data(const H &head, const T &tail, const Rest&... rest)
- template<typename H, typename T> data_helper<H, T>::result_type data(const H &head, const T &tail)
- template<typename T> prepared<T> data(const T &obj)
Template Function udho::data(const H&, const T&)
Function Documentation

Warning

doxygenfunction: Unable to resolve multiple matches for function “udho::data” with arguments (const H&, const T&) in doxygen xml output for project “udho” from directory: dox/xml. Potential matches:

- template<typename H, typename T, typename ...Rest> auto data(const H &head, const T &tail, const Rest&... rest)
- template<typename H, typename T> data_helper<H, T>::result_type data(const H &head, const T &tail)
- template<typename T> prepared<T> data(const T &obj)
Template Function udho::data(const H&, const T&, const Rest&…)
Function Documentation

Warning

doxygenfunction: Unable to resolve multiple matches for function “udho::data” with arguments (const H&, const T&, const Rest&…) in doxygen xml output for project “udho” from directory: dox/xml. Potential matches:

- template<typename H, typename T, typename ...Rest> auto data(const H &head, const T &tail, const Rest&... rest)
- template<typename H, typename T> data_helper<H, T>::result_type data(const H &head, const T &tail)
- template<typename T> prepared<T> data(const T &obj)
Template Function udho::del(F)
Function Documentation

Warning

doxygenfunction: Unable to resolve multiple matches for function “udho::del” with arguments (F) in doxygen xml output for project “udho” from directory: dox/xml. Potential matches:

- template<typename F, typename A1> auto del(F ftor, A1 &a1)
- template<typename F> auto del(F ftor)
Template Function udho::del(F, A1&)
Function Documentation

Warning

doxygenfunction: Unable to resolve multiple matches for function “udho::del” with arguments (F, A1&) in doxygen xml output for project “udho” from directory: dox/xml. Potential matches:

- template<typename F, typename A1> auto del(F ftor, A1 &a1)
- template<typename F> auto del(F ftor)
Template Function udho::detail::operator|
Function Documentation
template<typename U, typename V, typename F>
association_group<association<F>, association_group<U, V>> udho::detail::operator|(const association_group<U, V> &nonterminal, const association<F> &terminal)
Template Function udho::detail::visit
Function Documentation
template<typename U, typename V>
association_group_visitor<association_group<U, V>> udho::detail::visit(const association_group<U, V> &nonterminal)
Function udho::exceptions::http_redirection
Function Documentation
http_error udho::exceptions::http_redirection(const std::string &location, boost::beast::http::status status = boost::beast::http::status::temporary_redirect)
Template Function udho::form::operator<<(validated<udho::form_<RequestT>>&, field<T, Required>&)
Function Documentation

Warning

doxygenfunction: Unable to resolve multiple matches for function “udho::form::operator<<” with arguments (validated<udho::form_<RequestT>>&, field<T, Required>&) in doxygen xml output for project “udho” from directory: dox/xml. Potential matches:

- template<typename T, bool Required, typename IteratorT> validated<udho::multipart_form<IteratorT>> &operator<<(validated<udho::multipart_form<IteratorT>> &validator, field<T, Required> &field_)
- template<typename T, bool Required, typename RequestT> validated<udho::form_<RequestT>> &operator<<(validated<udho::form_<RequestT>> &validator, field<T, Required> &field_)
- template<typename T, bool Required> validated &operator<<(validated<> &validator, field<T, Required> &field_)
Template Function udho::form::operator<<(validated<udho::multipart_form<IteratorT>>&, field<T, Required>&)
Function Documentation

Warning

doxygenfunction: Unable to resolve multiple matches for function “udho::form::operator<<” with arguments (validated<udho::multipart_form<IteratorT>>&, field<T, Required>&) in doxygen xml output for project “udho” from directory: dox/xml. Potential matches:

- template<typename T, bool Required, typename IteratorT> validated<udho::multipart_form<IteratorT>> &operator<<(validated<udho::multipart_form<IteratorT>> &validator, field<T, Required> &field_)
- template<typename T, bool Required, typename RequestT> validated<udho::form_<RequestT>> &operator<<(validated<udho::form_<RequestT>> &validator, field<T, Required> &field_)
- template<typename T, bool Required> validated &operator<<(validated<> &validator, field<T, Required> &field_)
Template Function udho::form::operator<<(validated<>&, field<T, Required>&)
Function Documentation

Warning

doxygenfunction: Unable to resolve multiple matches for function “udho::form::operator<<” with arguments (validated<>&, field<T, Required>&) in doxygen xml output for project “udho” from directory: dox/xml. Potential matches:

- template<typename T, bool Required, typename IteratorT> validated<udho::multipart_form<IteratorT>> &operator<<(validated<udho::multipart_form<IteratorT>> &validator, field<T, Required> &field_)
- template<typename T, bool Required, typename RequestT> validated<udho::form_<RequestT>> &operator<<(validated<udho::form_<RequestT>> &validator, field<T, Required> &field_)
- template<typename T, bool Required> validated &operator<<(validated<> &validator, field<T, Required> &field_)
Function udho::form::validate()
Function Documentation
validated<void> udho::form::validate()
Template Function udho::form::validate(udho::form_<RequestT>&)
Function Documentation

Warning

doxygenfunction: Unable to resolve multiple matches for function “udho::form::validate” with arguments (udho::form_<RequestT>&) in doxygen xml output for project “udho” from directory: dox/xml. Potential matches:

- template<typename IteratorT> validated<udho::multipart_form<IteratorT>> validate(const udho::multipart_form<IteratorT> &form)
- template<typename RequestT> validated<udho::form_<RequestT>> validate(udho::form_<RequestT> &form)
- validated<void> validate()
Template Function udho::form::validate(const udho::multipart_form<IteratorT>&)
Function Documentation

Warning

doxygenfunction: Unable to resolve multiple matches for function “udho::form::validate” with arguments (const udho::multipart_form<IteratorT>&) in doxygen xml output for project “udho” from directory: dox/xml. Potential matches:

- template<typename IteratorT> validated<udho::multipart_form<IteratorT>> validate(const udho::multipart_form<IteratorT> &form)
- template<typename RequestT> validated<udho::form_<RequestT>> validate(udho::form_<RequestT> &form)
- validated<void> validate()
Template Function udho::forms::form_multipart
Function Documentation
template<typename RequestT>
form_multipart_<RequestT> udho::forms::form_multipart(const RequestT &req)
Template Function udho::forms::operator<<(accumulated&, detail::constrained_field<ValidatorT, FieldT>&)
Function Documentation

Warning

doxygenfunction: Unable to resolve multiple matches for function “udho::forms::operator<<” with arguments (accumulated&, detail::constrained_field<ValidatorT, FieldT>&) in doxygen xml output for project “udho” from directory: dox/xml. Potential matches:

- template<typename T, bool Required> accumulated &operator<<(accumulated &acc, field<T, Required> &field)
- template<typename ValidatorT, typename FieldT> accumulated &operator<<(accumulated &acc, detail::constrained_field<ValidatorT, FieldT> &field)
Template Function udho::forms::operator<<(accumulated&, field<T, Required>&)
Function Documentation

Warning

doxygenfunction: Unable to resolve multiple matches for function “udho::forms::operator<<” with arguments (accumulated&, field<T, Required>&) in doxygen xml output for project “udho” from directory: dox/xml. Potential matches:

- template<typename T, bool Required> accumulated &operator<<(accumulated &acc, field<T, Required> &field)
- template<typename ValidatorT, typename FieldT> accumulated &operator<<(accumulated &acc, detail::constrained_field<ValidatorT, FieldT> &field)
Template Function udho::forms::operator>>(form<DriverT>&, detail::constrained_field<ValidatorT, FieldT>&)
Function Documentation

Warning

doxygenfunction: Unable to resolve multiple matches for function “udho::forms::operator>>” with arguments (form<DriverT>&, detail::constrained_field<ValidatorT, FieldT>&) in doxygen xml output for project “udho” from directory: dox/xml. Potential matches:

- template<typename DriverT, typename T, bool Required> form<DriverT> &operator>>(form<DriverT> &form, field<T, Required> &field)
- template<typename DriverT, typename T, bool Required> validated<form<DriverT>> &operator>>(validated<form<DriverT>> &vf, field<T, Required> &field)
- template<typename DriverT, typename ValidatorT, typename FieldT> form<DriverT> &operator>>(form<DriverT> &form, detail::constrained_field<ValidatorT, FieldT> &field)
- template<typename DriverT, typename ValidatorT, typename FieldT> validated<form<DriverT>> &operator>>(validated<form<DriverT>> &vf, detail::constrained_field<ValidatorT, FieldT> &field)
Template Function udho::forms::operator>>(form<DriverT>&, field<T, Required>&)
Function Documentation

Warning

doxygenfunction: Unable to resolve multiple matches for function “udho::forms::operator>>” with arguments (form<DriverT>&, field<T, Required>&) in doxygen xml output for project “udho” from directory: dox/xml. Potential matches:

- template<typename DriverT, typename T, bool Required> form<DriverT> &operator>>(form<DriverT> &form, field<T, Required> &field)
- template<typename DriverT, typename T, bool Required> validated<form<DriverT>> &operator>>(validated<form<DriverT>> &vf, field<T, Required> &field)
- template<typename DriverT, typename ValidatorT, typename FieldT> form<DriverT> &operator>>(form<DriverT> &form, detail::constrained_field<ValidatorT, FieldT> &field)
- template<typename DriverT, typename ValidatorT, typename FieldT> validated<form<DriverT>> &operator>>(validated<form<DriverT>> &vf, detail::constrained_field<ValidatorT, FieldT> &field)
Template Function udho::forms::operator>>(validated<form<DriverT>>&, detail::constrained_field<ValidatorT, FieldT>&)
Function Documentation

Warning

doxygenfunction: Unable to resolve multiple matches for function “udho::forms::operator>>” with arguments (validated<form<DriverT>>&, detail::constrained_field<ValidatorT, FieldT>&) in doxygen xml output for project “udho” from directory: dox/xml. Potential matches:

- template<typename DriverT, typename T, bool Required> form<DriverT> &operator>>(form<DriverT> &form, field<T, Required> &field)
- template<typename DriverT, typename T, bool Required> validated<form<DriverT>> &operator>>(validated<form<DriverT>> &vf, field<T, Required> &field)
- template<typename DriverT, typename ValidatorT, typename FieldT> form<DriverT> &operator>>(form<DriverT> &form, detail::constrained_field<ValidatorT, FieldT> &field)
- template<typename DriverT, typename ValidatorT, typename FieldT> validated<form<DriverT>> &operator>>(validated<form<DriverT>> &vf, detail::constrained_field<ValidatorT, FieldT> &field)
Template Function udho::forms::operator>>(validated<form<DriverT>>&, field<T, Required>&)
Function Documentation

Warning

doxygenfunction: Unable to resolve multiple matches for function “udho::forms::operator>>” with arguments (validated<form<DriverT>>&, field<T, Required>&) in doxygen xml output for project “udho” from directory: dox/xml. Potential matches:

- template<typename DriverT, typename T, bool Required> form<DriverT> &operator>>(form<DriverT> &form, field<T, Required> &field)
- template<typename DriverT, typename T, bool Required> validated<form<DriverT>> &operator>>(validated<form<DriverT>> &vf, field<T, Required> &field)
- template<typename DriverT, typename ValidatorT, typename FieldT> form<DriverT> &operator>>(form<DriverT> &form, detail::constrained_field<ValidatorT, FieldT> &field)
- template<typename DriverT, typename ValidatorT, typename FieldT> validated<form<DriverT>> &operator>>(validated<form<DriverT>> &vf, detail::constrained_field<ValidatorT, FieldT> &field)
Template Function udho::forms::validate
Function Documentation
template<typename DriverT>
validated<form<DriverT>> udho::forms::validate(form<DriverT> &f)
Template Function udho::get(F)
Function Documentation

Warning

doxygenfunction: Unable to resolve multiple matches for function “udho::get” with arguments (F) in doxygen xml output for project “udho” from directory: dox/xml. Potential matches:

- template<typename F, typename A1> auto get(F ftor, A1 &a1)
- template<typename F> auto get(F ftor)
Template Function udho::get(F, A1&)
Function Documentation

Warning

doxygenfunction: Unable to resolve multiple matches for function “udho::get” with arguments (F, A1&) in doxygen xml output for project “udho” from directory: dox/xml. Potential matches:

- template<typename F, typename A1> auto get(F ftor, A1 &a1)
- template<typename F> auto get(F ftor)
Template Function udho::head(F)
Function Documentation

Warning

doxygenfunction: Unable to resolve multiple matches for function “udho::head” with arguments (F) in doxygen xml output for project “udho” from directory: dox/xml. Potential matches:

- template<typename F, typename A1> auto head(F ftor, A1 &a1)
- template<typename F> auto head(F ftor)
Template Function udho::head(F, A1&)
Function Documentation

Warning

doxygenfunction: Unable to resolve multiple matches for function “udho::head” with arguments (F, A1&) in doxygen xml output for project “udho” from directory: dox/xml. Potential matches:

- template<typename F, typename A1> auto head(F ftor, A1 &a1)
- template<typename F> auto head(F ftor)
Template Function udho::internal::arguments_to_tuple
Function Documentation
template<typename TupleT>
void udho::internal::arguments_to_tuple(TupleT &tuple, const std::vector<std::string> &args)
Template Function udho::internal::html_summary
Function Documentation
template<typename RouterT>
std::string udho::internal::html_summary(RouterT &router)
Template Function udho::internal::member
Function Documentation
template<typename T>
member_<T>::const_reduced_function_type udho::internal::member(T function, const typename member_<T>::that_type *that)
Function udho::internal::path_cat
Function Documentation
boost::filesystem::path udho::internal::path_cat(const boost::filesystem::path &base, const std::string &path)
Function udho::internal::path_inside
Function Documentation
bool udho::internal::path_inside(const boost::filesystem::path &base, const boost::filesystem::path &path)
Template Function udho::internal::reduced
Function Documentation
template<typename T>
reduced_<T>::reduced_function_type udho::internal::reduced(T function, typename reduced_<T>::object_type that)
Template Function udho::internal::to_fusion(std::index_sequence<Is…>, T&&)
Function Documentation

Warning

doxygenfunction: Unable to resolve multiple matches for function “udho::internal::to_fusion” with arguments (std::index_sequence<Is…>, T&&) in doxygen xml output for project “udho” from directory: dox/xml. Potential matches:

- template<class ...Ts> auto to_fusion(boost::tuple<Ts...> in)
- template<class ...Ts> boost::fusion::tuple<Ts...> to_fusion(std::tuple<Ts...> in)
- template<std::size_t... Is, class T> auto to_fusion(std::index_sequence<Is...>, T &&in)
Template Function udho::internal::to_fusion(boost::tuple<Ts…>)
Function Documentation

Warning

doxygenfunction: Unable to resolve multiple matches for function “udho::internal::to_fusion” with arguments (boost::tuple<Ts…>) in doxygen xml output for project “udho” from directory: dox/xml. Potential matches:

- template<class ...Ts> auto to_fusion(boost::tuple<Ts...> in)
- template<class ...Ts> boost::fusion::tuple<Ts...> to_fusion(std::tuple<Ts...> in)
- template<std::size_t... Is, class T> auto to_fusion(std::index_sequence<Is...>, T &&in)
Template Function udho::internal::to_fusion(std::tuple<Ts…>)
Function Documentation

Warning

doxygenfunction: Unable to resolve multiple matches for function “udho::internal::to_fusion” with arguments (std::tuple<Ts…>) in doxygen xml output for project “udho” from directory: dox/xml. Potential matches:

- template<class ...Ts> auto to_fusion(boost::tuple<Ts...> in)
- template<class ...Ts> boost::fusion::tuple<Ts...> to_fusion(std::tuple<Ts...> in)
- template<std::size_t... Is, class T> auto to_fusion(std::index_sequence<Is...>, T &&in)
Template Function udho::logging::messages::formatted::operator<<
Function Documentation
template<udho::logging::status Status, typename T>
message<Status> &udho::logging::messages::formatted::operator<<(message<Status> &msg, const T &value)
Template Function udho::operator/=
Function Documentation
template<typename U, typename V, typename F>
udho::overload_group<U, V> &udho::operator/=(udho::overload_group<U, V> &group, F fixture)
Template Function udho::operator<<(attachment<AuxT, LoggerT, CacheT>&, const udho::logging::message<Status>&)
Function Documentation

Warning

doxygenfunction: Unable to resolve multiple matches for function “udho::operator<<” with arguments (attachment<AuxT, LoggerT, CacheT>&, const udho::logging::message<Status>&) in doxygen xml output for project “udho” from directory: dox/xml. Potential matches:

- template<typename AuxT, typename LoggerT, typename CacheT, udho::logging::status Status> attachment<AuxT, LoggerT, CacheT> &operator<<(attachment<AuxT, LoggerT, CacheT> &attachment, const udho::logging::message<Status> &msg)
- template<typename AuxT, typename RequestT, typename ShadowT> udho::context<AuxT, RequestT, ShadowT> &operator<<(udho::context<AuxT, RequestT, ShadowT> &context, const exceptions::http_error &error)
- template<typename AuxT, typename RequestT, udho::logging::status Status> const detail::context_common<AuxT, RequestT> &operator<<(const detail::context_common<AuxT, RequestT> &ctx, const udho::logging::message<Status> &msg)
- template<typename Function, template<typename> class CompositorT, int N> module_overload<Function, CompositorT> operator<<(module_overload<Function, CompositorT> overload, const char (&expr)[N])
- template<typename K, typename C> std::ostream &operator<<(std::ostream &stream, const proxy<K, C> &p)
- template<typename RequestT, typename ShadowT, typename T> session_<RequestT, ShadowT> &operator<<(session_<RequestT, ShadowT> &session, const T &data)
- template<typename RequestT, typename V> cookies_<RequestT> &operator<<(cookies_<RequestT> &cookies, const udho::cookie_<V> &cookie)
- template<typename StreamT, typename U, typename V> StreamT &operator<<(StreamT &stream, const overload_group<U, V> &router)
- template<typename U, typename V, typename F> overload_group<overload_group<U, V>, F> operator<<(const overload_group<U, V> &group, const F &method)
Template Function udho::operator<<(std::ostream&, const proxy<K, C>&)
Function Documentation

Warning

doxygenfunction: Unable to resolve multiple matches for function “udho::operator<<” with arguments (std::ostream&, const proxy<K, C>&) in doxygen xml output for project “udho” from directory: dox/xml. Potential matches:

- template<typename AuxT, typename LoggerT, typename CacheT, udho::logging::status Status> attachment<AuxT, LoggerT, CacheT> &operator<<(attachment<AuxT, LoggerT, CacheT> &attachment, const udho::logging::message<Status> &msg)
- template<typename AuxT, typename RequestT, typename ShadowT> udho::context<AuxT, RequestT, ShadowT> &operator<<(udho::context<AuxT, RequestT, ShadowT> &context, const exceptions::http_error &error)
- template<typename AuxT, typename RequestT, udho::logging::status Status> const detail::context_common<AuxT, RequestT> &operator<<(const detail::context_common<AuxT, RequestT> &ctx, const udho::logging::message<Status> &msg)
- template<typename Function, template<typename> class CompositorT, int N> module_overload<Function, CompositorT> operator<<(module_overload<Function, CompositorT> overload, const char (&expr)[N])
- template<typename K, typename C> std::ostream &operator<<(std::ostream &stream, const proxy<K, C> &p)
- template<typename RequestT, typename ShadowT, typename T> session_<RequestT, ShadowT> &operator<<(session_<RequestT, ShadowT> &session, const T &data)
- template<typename RequestT, typename V> cookies_<RequestT> &operator<<(cookies_<RequestT> &cookies, const udho::cookie_<V> &cookie)
- template<typename StreamT, typename U, typename V> StreamT &operator<<(StreamT &stream, const overload_group<U, V> &router)
- template<typename U, typename V, typename F> overload_group<overload_group<U, V>, F> operator<<(const overload_group<U, V> &group, const F &method)
Template Function udho::operator<<(const detail::context_common<AuxT, RequestT>&, const udho::logging::message<Status>&)
Function Documentation

Warning

doxygenfunction: Unable to resolve multiple matches for function “udho::operator<<” with arguments (const detail::context_common<AuxT, RequestT>&, const udho::logging::message<Status>&) in doxygen xml output for project “udho” from directory: dox/xml. Potential matches:

- template<typename AuxT, typename LoggerT, typename CacheT, udho::logging::status Status> attachment<AuxT, LoggerT, CacheT> &operator<<(attachment<AuxT, LoggerT, CacheT> &attachment, const udho::logging::message<Status> &msg)
- template<typename AuxT, typename RequestT, typename ShadowT> udho::context<AuxT, RequestT, ShadowT> &operator<<(udho::context<AuxT, RequestT, ShadowT> &context, const exceptions::http_error &error)
- template<typename AuxT, typename RequestT, udho::logging::status Status> const detail::context_common<AuxT, RequestT> &operator<<(const detail::context_common<AuxT, RequestT> &ctx, const udho::logging::message<Status> &msg)
- template<typename Function, template<typename> class CompositorT, int N> module_overload<Function, CompositorT> operator<<(module_overload<Function, CompositorT> overload, const char (&expr)[N])
- template<typename K, typename C> std::ostream &operator<<(std::ostream &stream, const proxy<K, C> &p)
- template<typename RequestT, typename ShadowT, typename T> session_<RequestT, ShadowT> &operator<<(session_<RequestT, ShadowT> &session, const T &data)
- template<typename RequestT, typename V> cookies_<RequestT> &operator<<(cookies_<RequestT> &cookies, const udho::cookie_<V> &cookie)
- template<typename StreamT, typename U, typename V> StreamT &operator<<(StreamT &stream, const overload_group<U, V> &router)
- template<typename U, typename V, typename F> overload_group<overload_group<U, V>, F> operator<<(const overload_group<U, V> &group, const F &method)
Template Function udho::operator<<(udho::context<AuxT, RequestT, ShadowT>&, const exceptions::http_error&)
Function Documentation

Warning

doxygenfunction: Unable to resolve multiple matches for function “udho::operator<<” with arguments (udho::context<AuxT, RequestT, ShadowT>&, const exceptions::http_error&) in doxygen xml output for project “udho” from directory: dox/xml. Potential matches:

- template<typename AuxT, typename LoggerT, typename CacheT, udho::logging::status Status> attachment<AuxT, LoggerT, CacheT> &operator<<(attachment<AuxT, LoggerT, CacheT> &attachment, const udho::logging::message<Status> &msg)
- template<typename AuxT, typename RequestT, typename ShadowT> udho::context<AuxT, RequestT, ShadowT> &operator<<(udho::context<AuxT, RequestT, ShadowT> &context, const exceptions::http_error &error)
- template<typename AuxT, typename RequestT, udho::logging::status Status> const detail::context_common<AuxT, RequestT> &operator<<(const detail::context_common<AuxT, RequestT> &ctx, const udho::logging::message<Status> &msg)
- template<typename Function, template<typename> class CompositorT, int N> module_overload<Function, CompositorT> operator<<(module_overload<Function, CompositorT> overload, const char (&expr)[N])
- template<typename K, typename C> std::ostream &operator<<(std::ostream &stream, const proxy<K, C> &p)
- template<typename RequestT, typename ShadowT, typename T> session_<RequestT, ShadowT> &operator<<(session_<RequestT, ShadowT> &session, const T &data)
- template<typename RequestT, typename V> cookies_<RequestT> &operator<<(cookies_<RequestT> &cookies, const udho::cookie_<V> &cookie)
- template<typename StreamT, typename U, typename V> StreamT &operator<<(StreamT &stream, const overload_group<U, V> &router)
- template<typename U, typename V, typename F> overload_group<overload_group<U, V>, F> operator<<(const overload_group<U, V> &group, const F &method)
Template Function udho::operator<<(module_overload<Function, CompositorT>, const char(&))
Function Documentation

Warning

doxygenfunction: Unable to resolve multiple matches for function “udho::operator<<” with arguments (module_overload<Function, CompositorT>, const char(&)) in doxygen xml output for project “udho” from directory: dox/xml. Potential matches:

- template<typename AuxT, typename LoggerT, typename CacheT, udho::logging::status Status> attachment<AuxT, LoggerT, CacheT> &operator<<(attachment<AuxT, LoggerT, CacheT> &attachment, const udho::logging::message<Status> &msg)
- template<typename AuxT, typename RequestT, typename ShadowT> udho::context<AuxT, RequestT, ShadowT> &operator<<(udho::context<AuxT, RequestT, ShadowT> &context, const exceptions::http_error &error)
- template<typename AuxT, typename RequestT, udho::logging::status Status> const detail::context_common<AuxT, RequestT> &operator<<(const detail::context_common<AuxT, RequestT> &ctx, const udho::logging::message<Status> &msg)
- template<typename Function, template<typename> class CompositorT, int N> module_overload<Function, CompositorT> operator<<(module_overload<Function, CompositorT> overload, const char (&expr)[N])
- template<typename K, typename C> std::ostream &operator<<(std::ostream &stream, const proxy<K, C> &p)
- template<typename RequestT, typename ShadowT, typename T> session_<RequestT, ShadowT> &operator<<(session_<RequestT, ShadowT> &session, const T &data)
- template<typename RequestT, typename V> cookies_<RequestT> &operator<<(cookies_<RequestT> &cookies, const udho::cookie_<V> &cookie)
- template<typename StreamT, typename U, typename V> StreamT &operator<<(StreamT &stream, const overload_group<U, V> &router)
- template<typename U, typename V, typename F> overload_group<overload_group<U, V>, F> operator<<(const overload_group<U, V> &group, const F &method)
Template Function udho::operator<<(const overload_group<U, V>&, const F&)
Function Documentation

Warning

doxygenfunction: Unable to resolve multiple matches for function “udho::operator<<” with arguments (const overload_group<U, V>&, const F&) in doxygen xml output for project “udho” from directory: dox/xml. Potential matches:

- template<typename AuxT, typename LoggerT, typename CacheT, udho::logging::status Status> attachment<AuxT, LoggerT, CacheT> &operator<<(attachment<AuxT, LoggerT, CacheT> &attachment, const udho::logging::message<Status> &msg)
- template<typename AuxT, typename RequestT, typename ShadowT> udho::context<AuxT, RequestT, ShadowT> &operator<<(udho::context<AuxT, RequestT, ShadowT> &context, const exceptions::http_error &error)
- template<typename AuxT, typename RequestT, udho::logging::status Status> const detail::context_common<AuxT, RequestT> &operator<<(const detail::context_common<AuxT, RequestT> &ctx, const udho::logging::message<Status> &msg)
- template<typename Function, template<typename> class CompositorT, int N> module_overload<Function, CompositorT> operator<<(module_overload<Function, CompositorT> overload, const char (&expr)[N])
- template<typename K, typename C> std::ostream &operator<<(std::ostream &stream, const proxy<K, C> &p)
- template<typename RequestT, typename ShadowT, typename T> session_<RequestT, ShadowT> &operator<<(session_<RequestT, ShadowT> &session, const T &data)
- template<typename RequestT, typename V> cookies_<RequestT> &operator<<(cookies_<RequestT> &cookies, const udho::cookie_<V> &cookie)
- template<typename StreamT, typename U, typename V> StreamT &operator<<(StreamT &stream, const overload_group<U, V> &router)
- template<typename U, typename V, typename F> overload_group<overload_group<U, V>, F> operator<<(const overload_group<U, V> &group, const F &method)
Template Function udho::operator<<(StreamT&, const overload_group<U, V>&)
Function Documentation

Warning

doxygenfunction: Unable to resolve multiple matches for function “udho::operator<<” with arguments (StreamT&, const overload_group<U, V>&) in doxygen xml output for project “udho” from directory: dox/xml. Potential matches:

- template<typename AuxT, typename LoggerT, typename CacheT, udho::logging::status Status> attachment<AuxT, LoggerT, CacheT> &operator<<(attachment<AuxT, LoggerT, CacheT> &attachment, const udho::logging::message<Status> &msg)
- template<typename AuxT, typename RequestT, typename ShadowT> udho::context<AuxT, RequestT, ShadowT> &operator<<(udho::context<AuxT, RequestT, ShadowT> &context, const exceptions::http_error &error)
- template<typename AuxT, typename RequestT, udho::logging::status Status> const detail::context_common<AuxT, RequestT> &operator<<(const detail::context_common<AuxT, RequestT> &ctx, const udho::logging::message<Status> &msg)
- template<typename Function, template<typename> class CompositorT, int N> module_overload<Function, CompositorT> operator<<(module_overload<Function, CompositorT> overload, const char (&expr)[N])
- template<typename K, typename C> std::ostream &operator<<(std::ostream &stream, const proxy<K, C> &p)
- template<typename RequestT, typename ShadowT, typename T> session_<RequestT, ShadowT> &operator<<(session_<RequestT, ShadowT> &session, const T &data)
- template<typename RequestT, typename V> cookies_<RequestT> &operator<<(cookies_<RequestT> &cookies, const udho::cookie_<V> &cookie)
- template<typename StreamT, typename U, typename V> StreamT &operator<<(StreamT &stream, const overload_group<U, V> &router)
- template<typename U, typename V, typename F> overload_group<overload_group<U, V>, F> operator<<(const overload_group<U, V> &group, const F &method)
Template Function udho::operator<<(session_<RequestT, ShadowT>&, const T&)
Function Documentation

Warning

doxygenfunction: Unable to resolve multiple matches for function “udho::operator<<” with arguments (session_<RequestT, ShadowT>&, const T&) in doxygen xml output for project “udho” from directory: dox/xml. Potential matches:

- template<typename AuxT, typename LoggerT, typename CacheT, udho::logging::status Status> attachment<AuxT, LoggerT, CacheT> &operator<<(attachment<AuxT, LoggerT, CacheT> &attachment, const udho::logging::message<Status> &msg)
- template<typename AuxT, typename RequestT, typename ShadowT> udho::context<AuxT, RequestT, ShadowT> &operator<<(udho::context<AuxT, RequestT, ShadowT> &context, const exceptions::http_error &error)
- template<typename AuxT, typename RequestT, udho::logging::status Status> const detail::context_common<AuxT, RequestT> &operator<<(const detail::context_common<AuxT, RequestT> &ctx, const udho::logging::message<Status> &msg)
- template<typename Function, template<typename> class CompositorT, int N> module_overload<Function, CompositorT> operator<<(module_overload<Function, CompositorT> overload, const char (&expr)[N])
- template<typename K, typename C> std::ostream &operator<<(std::ostream &stream, const proxy<K, C> &p)
- template<typename RequestT, typename ShadowT, typename T> session_<RequestT, ShadowT> &operator<<(session_<RequestT, ShadowT> &session, const T &data)
- template<typename RequestT, typename V> cookies_<RequestT> &operator<<(cookies_<RequestT> &cookies, const udho::cookie_<V> &cookie)
- template<typename StreamT, typename U, typename V> StreamT &operator<<(StreamT &stream, const overload_group<U, V> &router)
- template<typename U, typename V, typename F> overload_group<overload_group<U, V>, F> operator<<(const overload_group<U, V> &group, const F &method)
Template Function udho::operator>>(const char(&), module_overload<Function, CompositorT>)
Function Documentation

Warning

doxygenfunction: Unable to resolve multiple matches for function “udho::operator>>” with arguments (const char(&), module_overload<Function, CompositorT>) in doxygen xml output for project “udho” from directory: dox/xml. Potential matches:

- template<typename Function, template<typename> class CompositorT, int N> module_overload<Function, CompositorT> operator>>(const char (&expr)[N], module_overload<Function, CompositorT> overload)
- template<typename RequestT, typename ShadowT, typename T> const session_<RequestT, ShadowT> &operator>>(const session_<RequestT, ShadowT> &session, T &data)
Template Function udho::operator>>(const session_<RequestT, ShadowT>&, T&)
Function Documentation

Warning

doxygenfunction: Unable to resolve multiple matches for function “udho::operator>>” with arguments (const session_<RequestT, ShadowT>&, T&) in doxygen xml output for project “udho” from directory: dox/xml. Potential matches:

- template<typename Function, template<typename> class CompositorT, int N> module_overload<Function, CompositorT> operator>>(const char (&expr)[N], module_overload<Function, CompositorT> overload)
- template<typename RequestT, typename ShadowT, typename T> const session_<RequestT, ShadowT> &operator>>(const session_<RequestT, ShadowT> &session, T &data)
Template Function udho::operator|(const prepared_group<U, V>&, const udho::prepared<P>&)
Function Documentation

Warning

doxygenfunction: Unable to resolve multiple matches for function “udho::operator|” with arguments (const prepared_group<U, V>&, const udho::prepared<P>&) in doxygen xml output for project “udho” from directory: dox/xml. Potential matches:

- template<typename U, typename V, typename F> overload_group<overload_group<U, V>, F> operator|(const overload_group<U, V> &group, const F &method)
- template<typename U, typename V, typename P> prepared_group<udho::prepared<P>, prepared_group<U, V>> operator|(const prepared_group<U, V> &nonterminal, const udho::prepared<P> &terminal)
- template<typename U, typename V> prepared_group<udho::prepared<V>, prepared_group<udho::prepared<U>, void>> operator|(const udho::prepared<U> &left, const udho::prepared<V> &right)
Template Function udho::operator|(const udho::prepared<U>&, const udho::prepared<V>&)
Function Documentation

Warning

doxygenfunction: Unable to resolve multiple matches for function “udho::operator|” with arguments (const udho::prepared<U>&, const udho::prepared<V>&) in doxygen xml output for project “udho” from directory: dox/xml. Potential matches:

- template<typename U, typename V, typename F> overload_group<overload_group<U, V>, F> operator|(const overload_group<U, V> &group, const F &method)
- template<typename U, typename V, typename P> prepared_group<udho::prepared<P>, prepared_group<U, V>> operator|(const prepared_group<U, V> &nonterminal, const udho::prepared<P> &terminal)
- template<typename U, typename V> prepared_group<udho::prepared<V>, prepared_group<udho::prepared<U>, void>> operator|(const udho::prepared<U> &left, const udho::prepared<V> &right)
Template Function udho::operator|(const overload_group<U, V>&, const F&)
Function Documentation

Warning

doxygenfunction: Unable to resolve multiple matches for function “udho::operator|” with arguments (const overload_group<U, V>&, const F&) in doxygen xml output for project “udho” from directory: dox/xml. Potential matches:

- template<typename U, typename V, typename F> overload_group<overload_group<U, V>, F> operator|(const overload_group<U, V> &group, const F &method)
- template<typename U, typename V, typename P> prepared_group<udho::prepared<P>, prepared_group<U, V>> operator|(const prepared_group<U, V> &nonterminal, const udho::prepared<P> &terminal)
- template<typename U, typename V> prepared_group<udho::prepared<V>, prepared_group<udho::prepared<U>, void>> operator|(const udho::prepared<U> &left, const udho::prepared<V> &right)
Template Function udho::overload(boost::beast::http::verb, F, CompositorT<typename internal::function_signature<F>::return_type>)
Function Documentation

Warning

doxygenfunction: Unable to resolve multiple matches for function “udho::overload” with arguments (boost::beast::http::verb, F, CompositorT<typename internal::function_signature<F>::return_type>) in doxygen xml output for project “udho” from directory: dox/xml. Potential matches:

- template<typename F, template<typename> class CompositorT = compositors::transparent> module_overload<F, CompositorT> overload(boost::beast::http::verb request_method, F ftor, CompositorT<typename internal::function_signature<F>::return_type> compositor = CompositorT<typename internal::function_signature<F>::return_type>())
- template<typename F, typename A1, template<typename> class CompositorT = compositors::transparent> auto overload(boost::beast::http::verb request_method, F ftor, A1 &a1, CompositorT<typename internal::function_signature<F>::return_type> compositor = CompositorT<typename internal::function_signature<F>::return_type>())
Template Function udho::overload(boost::beast::http::verb, F, A1&, CompositorT<typename internal::function_signature<F>::return_type>)
Function Documentation

Warning

doxygenfunction: Unable to resolve multiple matches for function “udho::overload” with arguments (boost::beast::http::verb, F, A1&, CompositorT<typename internal::function_signature<F>::return_type>) in doxygen xml output for project “udho” from directory: dox/xml. Potential matches:

- template<typename F, template<typename> class CompositorT = compositors::transparent> module_overload<F, CompositorT> overload(boost::beast::http::verb request_method, F ftor, CompositorT<typename internal::function_signature<F>::return_type> compositor = CompositorT<typename internal::function_signature<F>::return_type>())
- template<typename F, typename A1, template<typename> class CompositorT = compositors::transparent> auto overload(boost::beast::http::verb request_method, F ftor, A1 &a1, CompositorT<typename internal::function_signature<F>::return_type> compositor = CompositorT<typename internal::function_signature<F>::return_type>())
Template Function udho::post(F)
Function Documentation

Warning

doxygenfunction: Unable to resolve multiple matches for function “udho::post” with arguments (F) in doxygen xml output for project “udho” from directory: dox/xml. Potential matches:

- template<typename F, typename A1> auto post(F ftor, A1 &a1)
- template<typename F> auto post(F ftor)
Template Function udho::post(F, A1&)
Function Documentation

Warning

doxygenfunction: Unable to resolve multiple matches for function “udho::post” with arguments (F, A1&) in doxygen xml output for project “udho” from directory: dox/xml. Potential matches:

- template<typename F, typename A1> auto post(F ftor, A1 &a1)
- template<typename F> auto post(F ftor)
Template Function udho::put(F)
Function Documentation

Warning

doxygenfunction: Unable to resolve multiple matches for function “udho::put” with arguments (F) in doxygen xml output for project “udho” from directory: dox/xml. Potential matches:

- template<typename F, typename A1> auto put(F ftor, A1 &a1)
- template<typename F> auto put(F ftor)
Template Function udho::put(F, A1&)
Function Documentation

Warning

doxygenfunction: Unable to resolve multiple matches for function “udho::put” with arguments (F, A1&) in doxygen xml output for project “udho” from directory: dox/xml. Potential matches:

- template<typename F, typename A1> auto put(F ftor, A1 &a1)
- template<typename F> auto put(F ftor)
Template Function udho::scope
Function Documentation
template<typename GroupT>
lookup_table<GroupT> udho::scope(const GroupT &p)

returns a table of strings mapped with value returning objects GroupT must be an instance of udho::prepare<T> which can be obtained by using udho::data(const T&)

Function udho::util::charToHex
Function Documentation
std::string udho::util::charToHex(char c)
Template Function udho::util::from_hex
Function Documentation
template<typename CharT>
CharT udho::util::from_hex(CharT ch)
Function udho::util::hexToChar
Function Documentation
char udho::util::hexToChar(char first, char second)
Template Function udho::util::to_hex
Function Documentation
template<typename CharT>
CharT udho::util::to_hex(CharT x)
Template Function udho::util::urldecode
Function Documentation
template<typename CharT>
std::basic_string<CharT> udho::util::urldecode(const std::basic_string<CharT> &src)
Template Function udho::util::urlencode
Function Documentation
template<typename CharT>
std::basic_string<CharT> udho::util::urlencode(const std::basic_string<CharT> &src)
Template Function udho::view::expression
Function Documentation
template<typename ScopeT>
parsing::expression<ScopeT> udho::view::expression(ScopeT &scope)
Template Function udho::view::parsing::tokenize
Function Documentation
template<typename InputIt, typename OutputIt>
OutputIt udho::view::parsing::tokenize(InputIt begin, InputIt end, OutputIt output)
Template Function udho::view::processor
Function Documentation
template<typename ScopeT, typename ContextT>
parser<ScopeT, ContextT> udho::view::processor(ScopeT &scope, const ContextT &ctx)

returns a parser interface using which an xml based view can be parsed ScopeT must be a lookup table which can be obtained by using udho::scope

Template Function udho::visit
Function Documentation
template<typename ActorT, typename ModuleT>
void udho::visit(ActorT &actor, ModuleT &mod)
Template Function udho::visitors::print
Function Documentation
template<std::uint8_t Visitables, typename F>
visitor<printing_visitor<Visitables, F>> udho::visitors::print(F &callback)

prints the selected routes in the router

router /= budho::visitors::print<budho::visitors::visitable::callable | budho::visitors::visitable::application, std::ostream>(std::cout);

Template Function udho::visitors::print_html
Function Documentation
template<std::uint8_t Visitables, typename F>
visitor<printing_visitor_html<Visitables, F>> udho::visitors::print_html(F &callback)
Template Function udho::visitors::target
Function Documentation
template<std::uint8_t Visitables, typename F>
visitor<targetted_visitor<Visitables, F>> udho::visitors::target(F callback)

Variables

Variable udho::forms::default_datetime_format
Variable Documentation
constexpr const char *udho::forms::default_datetime_format = "%Y-%m-%d %H:%M:%S"

Defines

Define ROUTING_DEFERRED
Define Documentation
ROUTING_DEFERRED
Define UDHO_SESSION_FILE_EXTENSION
Define Documentation
UDHO_SESSION_FILE_EXTENSION
Define UDHO_VERSION
Define Documentation
UDHO_VERSION
Define UDHO_VERSION_STRING
Define Documentation
UDHO_VERSION_STRING

Typedefs

Typedef udho::accessor
Typedef Documentation
using udho::accessor = activities::accessor<T...>

shorthand for udho::activities::accessor

See

udho::activities::accessor

Typedef udho::activities::detail::apply_helper
Typedef Documentation
using udho::activities::detail::apply_helper = apply_helper_<udho::util::is_invocable<FunctorT, TargetsT...>::value, FunctorT, TargetsT...>
Typedef udho::activity
Typedef Documentation
using udho::activity = activities::activity<DerivedT, SuccessDataT, FailureDataT>

shorthand for udho::activities::activity

See

udho::activities::activity

Typedef udho::client_options
Typedef Documentation
typedef client_options_ udho::client_options
Typedef udho::configs::form
Typedef Documentation
typedef form_ udho::configs::form
Typedef udho::configs::logger
Typedef Documentation
typedef logger_ udho::configs::logger
Typedef udho::configs::router
Typedef Documentation
typedef router_ udho::configs::router
Typedef udho::configs::server
Typedef Documentation
typedef server_ udho::configs::server
Typedef udho::configs::session
Typedef Documentation
typedef session_ udho::configs::session
Typedef udho::configuration_type
Typedef Documentation
typedef udho::configuration<udho::configs::server, udho::configs::session, udho::configs::router, udho::configs::logger, udho::configs::form> udho::configuration_type
Typedef udho::contexts::stateful
Typedef Documentation
using udho::contexts::stateful = context<udho::bridge<udho::configuration_type>, udho::defs::request_type, udho::cache::shadow<udho::defs::session_key_type, T...>>

A stateful context for stateful callable using the default bridge and the default HTTP request type.

See

udho::context< AuxT, RequestT, void >

Template Parameters
  • T...: Session states

Typedef udho::contexts::stateless
Typedef Documentation
using udho::contexts::stateless = context<udho::bridge<udho::configuration_type>, udho::defs::request_type, void>

A stateless context for stateless callable using the default bridge and the default HTTP request type.

See

udho::context

Typedef udho::defs::request_type
Typedef Documentation
typedef boost::beast::http::request<boost::beast::http::string_body> udho::defs::request_type
Typedef udho::defs::response_type
Typedef Documentation
typedef boost::beast::http::response<boost::beast::http::string_body> udho::defs::response_type
Typedef udho::defs::session_key_type
Typedef Documentation
typedef boost::uuids::uuid udho::defs::session_key_type
Typedef udho::detail::url_data
Typedef Documentation
typedef url_data_ udho::detail::url_data
Typedef udho::form::optional
Typedef Documentation
using udho::form::optional = field<T, false>
Typedef udho::form::required
Typedef Documentation
using udho::form::required = field<T, true>
Typedef udho::forms::constraints::length_gt
Typedef Documentation
typedef gt<std::string> udho::forms::constraints::length_gt
Typedef udho::forms::constraints::length_gte
Typedef Documentation
typedef gte<std::string> udho::forms::constraints::length_gte
Typedef udho::forms::constraints::length_lt
Typedef Documentation
typedef lt<std::string> udho::forms::constraints::length_lt
Typedef udho::forms::constraints::length_lte
Typedef Documentation
typedef lte<std::string> udho::forms::constraints::length_lte
Typedef udho::forms::constraints::length_max
Typedef Documentation
typedef length_lte udho::forms::constraints::length_max
Typedef udho::forms::constraints::length_min
Typedef Documentation
typedef length_gte udho::forms::constraints::length_min
Typedef udho::forms::constraints::max
Typedef Documentation
using udho::forms::constraints::max = lte<T>
Typedef udho::forms::constraints::min
Typedef Documentation
using udho::forms::constraints::min = gte<T>
Typedef udho::forms::detail::constraint_visitor
Typedef Documentation
using udho::forms::detail::constraint_visitor = constraint_visitor_<ConstrainedFieldT, ConstrainedFieldT::depth - Depth>
Typedef udho::forms::drivers::multipart_raw
Typedef Documentation
typedef multipart_<std::string::const_iterator> udho::forms::drivers::multipart_raw
Typedef udho::forms::drivers::urlencoded_raw
Typedef Documentation
typedef urlencoded_<std::string::const_iterator> udho::forms::drivers::urlencoded_raw
Typedef udho::forms::form_
Typedef Documentation
using udho::forms::form_ = form<drivers::combo<RequestT>>
Typedef udho::forms::form_multipart_
Typedef Documentation
using udho::forms::form_multipart_ = form<drivers::multipart<RequestT>>
Typedef udho::forms::optional
Typedef Documentation
using udho::forms::optional = field<T, false>
Typedef udho::forms::query_
Typedef Documentation
using udho::forms::query_ = form<drivers::urlencoded_raw>
Typedef udho::forms::required
Typedef Documentation
using udho::forms::required = field<T, true>
Typedef udho::loggers::ostream
Typedef Documentation
typedef plain<std::ostream> udho::loggers::ostream
Typedef udho::logging::messages::debug
Typedef Documentation
typedef message<udho::logging::status::debug> udho::logging::messages::debug
Typedef udho::logging::messages::error
Typedef Documentation
typedef message<udho::logging::status::error> udho::logging::messages::error
Typedef udho::logging::messages::formatted::debug
Typedef Documentation
typedef message<udho::logging::status::debug> udho::logging::messages::formatted::debug
Typedef udho::logging::messages::formatted::error
Typedef Documentation
typedef message<udho::logging::status::error> udho::logging::messages::formatted::error
Typedef udho::logging::messages::formatted::info
Typedef Documentation
typedef message<udho::logging::status::info> udho::logging::messages::formatted::info
Typedef udho::logging::messages::formatted::warning
Typedef Documentation
typedef message<udho::logging::status::warning> udho::logging::messages::formatted::warning
Typedef udho::logging::messages::info
Typedef Documentation
typedef message<udho::logging::status::info> udho::logging::messages::info
Typedef udho::logging::messages::warning
Typedef Documentation
typedef message<udho::logging::status::warning> udho::logging::messages::warning
Typedef udho::perform
Typedef Documentation
using udho::perform = activities::perform<ActivityT>

shorthand for udho::activities::perform

See

udho::activities::perform

Typedef udho::require
Typedef Documentation
using udho::require = activities::require<DependenciesT...>

shorthand for udho::activities::require

See

udho::activities::require

Typedef udho::router
Typedef Documentation
typedef basic_router udho::router
Typedef udho::servers::ostreamed::stateful
Typedef Documentation
using udho::servers::ostreamed::stateful = ostreamed_helper<udho::cache::store<StorageT, boost::uuids::uuid, U...>>
Typedef udho::servers::ostreamed::stateless
Typedef Documentation
using udho::servers::ostreamed::stateless = ostreamed_helper<void>
Typedef udho::servers::quiet::stateful
Typedef Documentation
using udho::servers::quiet::stateful = server<udho::bridge<udho::configuration_type>, void, udho::cache::store<StorageT, boost::uuids::uuid, T...>>
Typedef udho::servers::quiet::stateless
Typedef Documentation
using udho::servers::quiet::stateless = server<udho::bridge<udho::configuration_type>, void, void>
Typedef udho::servers::stateless::logged
Typedef Documentation
using udho::servers::stateless::logged = server<udho::bridge<udho::configuration_type>, LoggerT, void>
Typedef udho::servers::stateless::quiet
Typedef Documentation
using udho::servers::stateless::quiet = server<udho::bridge<udho::configuration_type>, void, void>
Typedef udho::tcp
Typedef Documentation
using udho::tcp = boost::asio::ip::tcp
Typedef udho::visitors::targeted
Typedef Documentation
using udho::visitors::targeted = visitor<targetted_visitor<Visitables, F>>

Quickstart

Building udho

udho can be built like a regular cmake library. The requirements of udho library are available in most *nix reposetories.

Requirements

  • boost >= 1.66

  • icu [optional]

  • git

  • cmake

  • c++ compiler

Ubuntu

sudo apt-get install git cmake build-essential boost-all-dev libicu-dev pugixml-dev

Fedora

sudo dnf install @development-tools
sudo dnf install git cmake boost-devel libicu-devel pugixml-devel

Arch Linux

sudo pacman -S base-devel git cmake boost icu pugixml

Mac

brew install git cmake boost icu pugixml

Build

After the dependencies are installed udho has to be cloned from the git reposetory and ompiled as a regular C++ library. use make tests to execute the unit tests. The exemaples are inside examples directory.

git clone https://gitlab.com/neel.basu/udho.git
cd udho
mkdir build
cd build
cmake ..
make

URL Routing

Request Context

A context wraps a raw HTTP request and is passed to all callables once its corresponding url pattern is matched. The context also associates the request with the underlying server. So using the server the server common functions that are not specific any particular callable like logging, template rendering etc. can be performed. The context can be stateful or stateless. With a stateless context session informations can not be accessed even if the server is stateful. A stateful context is instantiated with a set of states that can be accessed from the callable. The set of states with which the stateful context is created should be the subset of the states of a stateful server. As the stateful context contains a subset of server states only that subset of state information is accessible through the stateful context.

Note

The context templates require the bridge and HTTP request type to be passed as the template parameters while instantiation. Its adviced to use the conveniance types instead of directly instiating these templates.

str::string profile(udho::contexts::stateful<user> ctx){
    if(ctx.session().exists<user>()){
      user data;
      ctx.session() >> data;
      // user logged in
    }else{
      // user not logged in
    }
}

udho::contexts::stateful is actually a typedef of udho::context with default bridge and request type

std::string profile(udho::contexts::stateless ctx, std::size_t uid){
    // view public profile of user uid
}

udho::contexts::stateless is actually a typedef of udho::context with default bridge and request type

Request

The request parameters can be accessed either through the conveniance methods or through the raw boost-beast request object. Use ctx.request() to get the underlying request object from the context. However for common tasks there are conveniance methods that extracts information from the request object and returns.

Warning

doxygenfunction: Cannot find function “udho::context::request” in doxygen xml output for project “udho” from directory: dox/xml

Warning

doxygenfunction: Cannot find function “udho::context::target” in doxygen xml output for project “udho” from directory: dox/xml

Warning

doxygenfunction: Cannot find function “udho::context::path” in doxygen xml output for project “udho” from directory: dox/xml

Warning

doxygenfunction: Cannot find function “udho::context::query” in doxygen xml output for project “udho” from directory: dox/xml

Logging

The context passes a logging message to the logger attached with the server.

Warning

doxygenfunction: Cannot find function “udho::context::log” in doxygen xml output for project “udho” from directory: dox/xml

API

Stateful Context Template

template<typename AuxT, typename RequestT, typename ShadowT>
struct udho::context : public udho::detail::context_common<AuxT, RequestT>

A Stateful context passed to all callables along with the arguments. The context is always the first argument to the callable. Even if the callable takes no arguments, it must take the context as the first argument. A stateful context should be used in callables that need to use session states.

Note

instead of instantiating this template directly use udho::contexts::stateful

Template Parameters
  • AuxT: bridge between the server and the callable

  • RequestT: HTTP request type

  • ShadowT: the session data structure

Public Functions

session_type &session()

access the HTTP Session

See

udho::session_

Stateless Context Template

template<typename AuxT, typename RequestT>
struct context<AuxT, RequestT, void> : public udho::detail::context_common<AuxT, RequestT>

A Stateless context passed to all callables along with the arguments. he context is always the first argument to the callable. Even if the callable takes no arguments, it must take the context as the first argument. A stateless context should be used in callables that need not to use session states.

Note

instead of instantiating this template directly use udho::contexts::stateless

Template Parameters
  • AuxT: bridge between the server and the callable

  • RequestT: HTTP request type

HTTP Server

udho provides varying types of servers depending on the logging and session facilities. A server is called stateful if it provides HTTP session, otherwise it is called stateless. If the server provides APIs that do noy require any session then use stateless server, otherwise use a stateful server. If no logging is required then use a quiet server that uses a void logger, otherwise use a logging server. The servers udho::servers::ostreamed::stateless and udho::servers::ostreamed::stateful<> used in the examples are stateless and stateful servers respectively that uses ostreamed logger present inside udho. All servers inside udho::servers namespace are typedef’ed udho::server.

Logged Stateless Server

udho::servers::stateless::logged<LoggerT>
udho::servers::logged<LoggerT>::stateless

Quiet Stateless Server

udho::servers::stateless::quiet
udho::servers::quiet::stateless

Logged Stateful Server

udho::servers::stateful<States...>::logged<LoggerT>
udho::servers::logged<LoggerT>::stateful<States...>

Quiet Stateful Server

udho::servers::stateful<States...>::quiet
udho::servers::quiet::stateful<States...>

udho comes with a logger udho::loggers::ostream that prints logginf messages to std::ostream. This logger is used in all examples. So there is a typedef servers::stateful<States...>::ostreamed that actually is servers::stateful<States...>::logged<loggers::ostream>

A Logging server takes reference to a logger in constructor. So the Logger has to be instantiated by the caller, as shown in the following example.

udho::loggers::ostream logger(std::cout);
udho::servers::stateful<StateA, StateB>::ostreamed server(logger);

For ease of access there is an ostreamed server is provided which owns the ostream logger inside. To use this server, no logger has to be instantiated. Only the stream (std::cout) has to be provided. through the constructor.

udho::servers::ostreamed::stateless
udho::servers::ostreamed::stateful<StateA, StateB>

States

The stateful server uses session cookie for remembering a returning user. The session cookie is named UDHOSESSID. For each session some information can be stored at server side. This type of features are useful for login, captcha, CSRF token etc.. udho takes advantage of stateful nation of C++ and provides session functionality around a set of states defined at compile time. A state can be any copiable C++ type. Once a stateful server is instantiated with N number of states, callables that takes stateful contexts with M <= N states can be used.

struct student{
    std::string  first_name;
    std::string  last_name;
    unsigned int registration_id;
};
struct appearence{
    std::string theme;
};

Using these two states a server can be defined as following.

udho::servers::ostreamed::stateful<student, appearence> server(std::cout);

A function taking a stateful context around zero or more of these two states can be used in the router when the above server is used. So all four (func1, func2, func3, and func4) are valid functions that can be mapped with the router when the above mentioned server is used.

std::string func1(udho::contexts::stateful<student, appearence> ctx){
    // ...
}
std::string func2(udho::contexts::stateful<student> ctx){
    // ...
}
std::string func3(udho::contexts::stateful<appearence> ctx){
    // ...
}
std::string func4(udho::contexts::stateless ctx){
    // ...
}

In these functions the corresponding values of the current session of the requested type can be accessed like the following.

std::string func1(udho::contexts::stateful<student, appearence> ctx){
    bool student_data_exists = ctx.session().exists<student>();
    if(!student_data_exists){
        student data;
        data.first_name = "Jane";
        data.last_name  = "Doe";
        data.registration_id = 1;

        ctx.session() << data;
    }else{
        student data;
        ctx.session() >> data;
        std::cout << data.first_name << std::endl;
    }
}

Form

Forms are accessed through the context using ctx.form() method. Forms submitted in POST request can be url encoded or multipart. Different form parsing techniques are used by udho::urlencoded_form and udho::multipart_form.

API

udho::form

template<typename RequestT>
struct udho::form_

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

Public Functions

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

udho::urlencoded_form

template<typename Iterator>
struct udho::urlencoded_form

Form accessor for urlencoded forms

Public Functions

std::size_t count() const

number of fields in the form

bool has(const std::string name) const

checks whether there exists any field with the name provided

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

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

udho::multipart_form

template<typename Iterator>
struct udho::multipart_form

Form accessor for multipart forms

Public Functions

std::size_t count() const

number of fields in the form

bool has(const std::string name) const

checks whether the form has any field with the given name

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

returns the part associated with the given name

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

returns the value of the field lexically casted with the desired type

form.field<int>("age");

struct form_part

A part in the multipart form data

Public Functions

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>();

std::string str() const

returns the body of the part as string

template<typename T>
T value() const

lexically convert the contents of the body to the requested type

HTTP Session

udho server takes a LoggerT and a CacheT as template parameters. The LoggerT provides logging facilities and the CacheT serves as the HTTP session. the first parameter udho::bridge bridges a server with the contexts. It provides utilities like document root, that are configured at the server to the callable’s context. The reference to the bridge can be accessed through aux() method in the context.

typedef server<udho::bridge, LoggerT, CacheT> server_type;

The cache is implemented by the template udho::cache::store<KeyT, States...>. The cache::store serves as a key-value store where the set of possible values are limited by the variadic parameter States....

struct X{};
struct Y{};
struct Z{};
udho::cache::store<int, X, X, Z> store;

In the example above an integer indexed store is created that can store only three types of values (X, Y, Z) for each key. Any read or write opration using any type other than these three will be restricted at compile time. The operations that can be performed on the store are

checks for existance of any value of type V against the key

gets the value of type V associated with the key. If no such value is inserted returns the default_value

returns the value of type V associated with key and throws exception if that doesn’t exist.

associates a value of type V with key

udho uses boost::uuids::uuid as KeyTto provide session id. So each session id is 128 bit uuid generated by boost uuid library.

Logging

Async Task Graph

Execution of Asynchronous Tasks may be required for executing SQL or any other data queries including HTTP queries to fetch external data. udho does not including a database library with itself. However any asynchronous database library using boost asio may benifit from an async activity framework. udho::activities provides an way to describe a task graph that gather data into an heterogenous collector. A task may be associated with its dependencies of other tasks and task related data.

Collector

Different activities using different success and failure data will be involved in the subtask graph. A subtask or even an activity may need to use the data fetched by its dependencies in order to execute its action. Hence a heterogenous collector collects the data submited by the success or failure methods, which can be accessed through an accessor. In the following example data is a collector that collects success or failure data of three activities A1, A2, and A3 respectively. Usually all activities involved in the subtask graph should be passed as a template parameter of collect

auto data = udho::activities::collect<A1, A2, A3>(ctx, "Any string name for the collector");

However under many circumstances the entire collector is not required to be accessed. Instead a subset of what has been collected are accessed. So an accessor<...> is created from that collector.

udho::activities::accessor<A1, A2> access(data);
if(!access.failed<A1>()){
    A1SData pre = access.success<A1>();
}

The collector has to be passed to the constructor of all activities.

Activity

An activity is the definition of the job that has to be performed. A subtask is an instantiation of an activity. Definition of an activity consists of two types SuccessDataT, FailureDataT and a no argument function call operarator operator()() overload. A subtask on the other hand instantiates an activity by specifying its data and execution dependencies thus establishing an order of invocation. The philosophy is that the activity is reusable while the subtask reuses that to model different use cases. The activity is invoked through its operator()() overload after all its prior activities have completed (dependencies are specified by the subtask). The operator()() must call either success() or failure() methods either synchronously or asynchronously with SuccessDataT or FailureDataT in order to signal its completion. An activity A subclasses from udho::activity<A, SuccessA, FailureA> which defines the success() and failure() methods.

In the following example the success and failure data for activity A1 are A1SData and A1FData respectively. A1 starts a timer for 5 seconds. Once the timer finishes the value 42 is set as the success value and the activity finishes.

struct A1SData{
    int value;
};

struct A1FData{
    int reason;
};

struct A1: udho::activities::activity<A1, A1SData, A1FData>{
    typedef udho::activities::activity<A1, A1SData, A1FData> base;

    boost::asio::deadline_timer _timer;

    template <typename CollectorT>
    A1(CollectorT c, boost::asio::io_context& io): base(c), _timer(io){}

    void operator()(){
        _timer.expires_from_now(boost::posix_time::seconds(5));
        _timer.async_wait(boost::bind(&A1::finished, self(), boost::asio::placeholders::error));
    }

    void finished(const boost::system::error_code& e){
        A1SData data;
        data.value = 42; // Fetched 42 from somewhere
        success(data); // successful
    }
};

Subtask

Activities serves the purpose of defining an action. however to action is supposed to fit in some use case depending on the application needs. The application needs may require a specific order of invocation of these activities. So that sufficient data is collected before some activity is invoked.

digraph {
  A1 -> A2;
  A1 -> A3;
  A2 -> A4;
  A3 -> A4;
}

In the above mentioned task graph, Both A2 and A3 depends on A1. Hence A2 and A3 may start as soon as A1 completes. A4 depends on both A2 and A3 and cannot start until both A2 and A3 completes. In this situation A2 and A3 can access the data fetched by A1 activity because that has already been completed (succeded or failed) before A2 or A3 is invoked. Similarly A4 can access the data collected by A1, A2, A3 that has completed before A4 has been invoked.

usho::activities::perform describes the above subtask graph as shown in the following code block.

auto data = udho::activities::collect<A1, A2i, A3i>(ctx, "A");

auto t1 = udho::activities::perform<A1>::with(data, io);
auto t2 = udho::activities::perform<A2>::require<A1>::with(data, io).after(t1);
auto t3 = udho::activities::perform<A3>::require<A1>::with(data, io).after(t1);
auto t4 = udho::activities::perform<A4>::require<A2, A3>::with(data, io).after(t2).after(t3);

The above statements using perform are equivalent to the following.

auto data = udho::activities::collect<A1, A2i, A3i>(ctx, "A");

auto t1 = udho::activities::subtask<A1>::with(data, io);
auto t2 = udho::activities::subtask<A2, A1>::with(data, io).after(t1);
auto t3 = udho::activities::subtask<A3, A1>::with(data, io).after(t1);
auto t4 = udho::activities::subtask<A4, A2, A3>::with(data, io).after(t2).after(t3);

With this arrangement Success/Failure data of A1 is available to A2 and A3 before it starts execution. To access that data the constructors on A2 and A3 may create an accessor as shown below.

struct A2: udho::activities::activity<A2, A2SData, A2FData>{
    typedef udho::activities::activity<A2, A2SData, A2FData> base;

    boost::asio::deadline_timer _timer;
    udho::activities::accessor<A1> _accessor;       // An accessor to access success/failure data of A1

    template <typename CollectorT>
    A2(CollectorT c, boost::asio::io_context& io): base(c), _timer(io), _accessor(c){}

    void operator()(){
        _timer.expires_from_now(boost::posix_time::seconds(10));
        _timer.async_wait(boost::bind(&A2::finished, self(), boost::asio::placeholders::error));
    }

    void finished(const boost::system::error_code& err){
        if(!err && !_accessor.failed<A1>()){        // check whether A1 has failed or not
            A1SData pre = _accessor.success<A1>();  // access the success data collected from A1
            A2SData data;
            data.value = pre.value + 2;             // creates its own success data
            success(data);                          // signal completion with success
        }
    }
};

However in the above mentioned implementation A2 always depends on A1. In an use case where A2 depends on some other activity or even executed independently won’t be feasible because A2 will still have an accessor to A1 and it will try to extract the success data of A1 irrespective of the graph. On the other hand, A2 may still need some data that has to be set in order to perform the activity. that data may be derived from A1 or from some other activity or through some constructor argument.

struct A2i: udho::activities::activity<A2i, A2SData, A2FData>{
    typedef udho::activities::activity<A2i, A2SData, A2FData> base;

    int prevalue;
    boost::asio::deadline_timer _timer;

    template <typename CollectorT>
    A2i(CollectorT c, boost::asio::io_context& io, int p): base(c), prevalue(p), _timer(io){}

    template <typename CollectorT>
    A2i(CollectorT c, boost::asio::io_context& io): base(c), _timer(io){}

    void operator()(){
        _timer.expires_from_now(boost::posix_time::seconds(10));
        _timer.async_wait(boost::bind(&A2i::finished, self(), boost::asio::placeholders::error));
    }

    void finished(const boost::system::error_code& err){
        if(!err){
            A2SData data;
            data.value = prevalue + 2;
            success(data);
        }
    }
};

In the above example prevalue is that piece of information that is required by A2i in order to perform its activity. It doesn’t care who provides that information, whether its A1, or some other activity. A2i has a constructor that takes that prevalue as an argument which can be used when prevalue is known at the time of construction, or when A2i is the starting activity in the graph.

auto t2 = udho::activities::perform<A2i>::require<A1>::with(data, io).after(t1).prepare([data](A2i& a2i){
    udho::activities::accessor<A1> a1_access(data);
    A1SData pre = a1_access.success<A1>();
    a2i.prevalue = pre.value;
});

In the above code block that activity A2 is prepared through its reference passed as the argument right after all its dependencies (only A1 in this case) completes by the callback provided in the prepare function. The collected data is captured inside the lambda function from which the A1 success data is accessed.

Final

Finally we would like do something once the entire subtask graph has completed in a similar fasion. In the following example we do not perform A4. Instead we execute the following piece of code once both A2i and A3i completes.

udho::activities::require<A2i, A3i>::with(data).exec([ctx, name](const udho::activities::accessor<A1, A2i, A3i>& d) mutable{
    std::cout << "Final begin" << std::endl;

    int sum = 0;

    if(!d.failed<A2i>()){
        A2SData pre = d.success<A2i>();
        sum += pre.value;
        std::cout << "A2i " << pre.value << std::endl;
    }

    if(!d.failed<A3i>()){
        A3SData pre = d.success<A3i>();
        sum += pre.value;
        std::cout << "A3i " << pre.value << std::endl;
    }

    ctx.respond(boost::lexical_cast<std::string>(sum), "text/plain");

    std::cout << "Final end" << std::endl;
}).after(t2).after(t3);

Once everything is set up we start the initial task t1()

t1();

Note

By default if one subtask fails then all subtasks that depend on it will be cancelled and the final callback will be called immediately. However the sibling subtasks of the failing subtask will continue executing. To change this behavior use required(false) on the subtask.

auto t1 = udho::activities::perform<A1>::with(data, io).required(false);

In the above example all other subtasks will execute even if t1 fails.

Note

The following shorthands may be used for conveniance. udho::collect udho::accessor udho::activity udho::perform udho::require

Example

API

Data

template<typename ContextT, typename DatasetT>
struct collector
template<typename ...T>
struct udho::activities::accessor : public udho::activities::fixed_key_accessor<udho::cache::shadow<std::string, T::result_type...>>

Access a subset of data from the collector

Public Functions

template<typename V>
bool exists() const

Whether there exists any data for activity V

Template Parameters
  • V: Activity Type

template<typename V>
const V::result_type &get() const

get data associated with activity V

Template Parameters
  • V: activity type

template<typename V>
bool completed() const

Check whether activity V has completed.

Template Parameters
  • V: activity type

template<typename V>
bool canceled() const

Check whether activity V has been canceled.

Template Parameters
  • V: activity type

template<typename V>
bool failed() const

Check whether activity V has failed (only the failure data of V is valid).

Template Parameters
  • V: activity type

template<typename V>
bool okay() const

Check whether activity V is okay.

Template Parameters
  • V: activity type

template<typename V>
V::result_type::success_type success() const

get success data for activity V

Template Parameters
  • V: activity type

template<typename V>
V::result_type::failure_type failure() const

get failure data for activity V

Template Parameters
  • V: activity type

template<typename V, typename F>
void apply(F f) const

Apply a callback on result of V

Template Parameters
  • V: activity type

Parameters
  • f: callback

Activity

template<typename DerivedT, typename SuccessDataT = void, typename FailureDataT = void>
struct udho::activities::activity : public std::enable_shared_from_this<DerivedT>, public udho::activities::result<SuccessDataT, FailureDataT>

An activity A must subclass from activity<A, SuccessA, FailureA> assuming SuccessA and FailureA are the types that contains the relevant information regarding its success or failure. The activity A must overload a no argument operator()() which initiates the activity. After the activity is initiated either success() or failure() methods must be called in order to signal its completion. The activity A must take the collector as the first argument to its constructor, which is passed to the base class activity<A, SuccessA, FailureA>. Hence its prefered to take the first parameter to the constructor as template parameter.

Template Parameters
  • DerivedT: Activity Class

  • SuccessDataT: data associated to the activity if the activity succeeds

  • FailureDataT: data associated to the activity if the activity fails

Public Functions

derived_ptr_type self()

shared_ptr to this

template<typename SuccessT, typename FailureT>
struct udho::activities::result : public udho::activities::result_data<SuccessT, FailureT>

Completion handler for an activity.

Template Parameters
  • SuccessT: success data associated with the activity

  • FailureT: failure data associated with the activity

Public Functions

template<typename StoreT>
result(StoreT &store)

Parameters
  • store: collector

template<typename CombinatorT>
void done(CombinatorT cmb)

attach another subtask as done callback which will be executed once this subtask finishes

Parameters
  • cmb: next subtask

void required(bool flag)

mark the activity as required or optional

Parameters
  • flag:

void cancel_if(cancel_if_ftor f)

Force cancelation of the activity even after it is successful to stop propagating to the next activities

Parameters
  • f: callback which should return true to signal cancelation

template<typename SuccessT, typename FailureT>
struct udho::activities::result_data

Contains Copiable Success or Failure data for an activity.

Template Parameters
  • SuccessT: success data type

  • FailureT: failure data type

Subclassed by udho::activities::result< SuccessT, FailureT >

Public Functions

bool completed() const

either success or failure data set

bool failed() const

whether the activity has failed

bool canceled() const

check whether the activity has been canceled

const success_type &success_data() const

Success data

const failure_type &failure_data() const

Failure data

template<typename CallableT>
void apply(CallableT callback)

Apply a callable to the result data which will be invoked exactly once with appropriate arguments. The invocation of the callback depends on the state as shown below.

  • Incomplete: callback()

  • Canceled: callback(const SuccessT&, const FailureT&)

  • Failed: callback(const FailureT&)

  • Successful: callback(const SuccessT&)

The callback may not have all the overloads.

Parameters
  • callback:

Subtask

template<typename ActivityT, typename ...DependenciesT>
struct udho::activities::subtask

A subtask is an instantiation of an activity. The subtask reuses an activity to model different use cases by attaching dependencies. A subtask contains two shared pointers, one to the activity and another one to the combinator. The subtask cannot be instantiated directly by calling the subtask constructor. Instead call the static with method to instantiate.

Template Parameters
  • ActivityT: The activity

  • DependenciesT: The activities that has to be performed before performing ActivityT

Public Functions

std::shared_ptr<activity_type> activity()

shared pointer to the activity

template<typename V, typename ...DependenciesV>
self_type &done(subtask<V, DependenciesV...> &next)

execute task next after the current one

Parameters
  • next: the next subtask

template<typename V, typename ...DependenciesV>
self_type &after(subtask<V, DependenciesV...> &previous)

t2.after(t1) is equivalent to t1.done(t2)

Parameters
  • previous: the previous subtask

template<typename PreparatorT>
self_type &prepare(PreparatorT prep)

attach a callback which will be called with a reference to the activity after it has been instantiated and all its dependencies have completed.

self_type &required(bool flag)

Set required flag on or off. If a required subtask fails then all intermediate subtask that depend on it fails and the final callback is called immediately. By default all subtasks are required

self_type &cancel_if(typename activity_type::cancel_if_ftor cancelor)

Force cancelation of the activity even after it is successful to stop propagating to the next activities

Parameters
  • f: callback which should return true to signal cancelation

std::shared_ptr<activity_type> operator->()

returns the shared pointer to the actiivity

template<typename FunctionT>
self_type &if_errored(FunctionT ftor)

abort if canceled if ftor returns false. f will be called with the success if it has been canceled due to error

template<typename FunctionT>
self_type &if_failed(FunctionT ftor)

abort if canceled if ftor returns false. f will be called with the failue data if it has been canceled due to failure

Public Static Functions

template<typename CollectorT, typename ...U>
self_type with(CollectorT collector, U&&... u)

Arguments for the constructor of the Activity

template<typename ActivityT>
struct udho::activities::perform

create a subtask to perform activity ActivityT

Template Parameters
  • ActivityT: the activity to perform

Public Static Functions

template<typename ...U>
subtask<ActivityT> with(U&&... u)

arguments for the activity constructor

template<typename ...DependenciesT>
struct require

mention the activities that has to be performed before executing this subtask.

Template Parameters
  • DependenciesT: dependencies

Public Static Functions

template<typename ...U>
subtask<ActivityT, DependenciesT...> with(U&&... u)

arguments for the activity constructor

Udho (উধো)

udho is a minimalistic featureful HTTP framework based on Boost.Beast.

Code | Issues

License Documentation Status pipeline status develop pipeline status master Codacy Badge Total alerts Language grade: C/C++
std::string world(udho::contexts::stateless ctx){
    return "{'planet': 'Earth'}";
}
std::string planet(udho::contexts::stateless ctx, std::string name){
    return "Hello "+name;
}
int main(){
    boost::asio::io_service io;
    udho::servers::ostreamed::stateless server(io, std::cout);

    auto urls = udho::router() | "/world"          >> udho::get(&world).json()
                               | "/planet/(\\w+)"  >> udho::get(&planet).plain();

    server.serve(urls, 9198);

    io.run();
    return 0;
}

Philosophy

udho::router comprises of mapping between url patterns (as regex) and the corresponding callables (function pointers, function objects). Multiple such mappings are combined at compile time using pipe (|) operator. The url mappings are passed to the server along with the listening port and document root. The request methods (udho::get, udho::post, udho::head, udho::put, etc..) and the response content type (json(), plain() etc…) are attached with the callable on compile time. Whenever an HTTP request appears to the server its path is matched against the url patterns and the matching callable is called. The values captured from the url patterns are lexically converted (using ``boost::lexical_cast` <https://theboostcpplibraries.com/boost.lexical_cast>`_) and passed as arguments to the callables. The server can be logging or quiet. The example above uses an ostreamed logger that logs on std::cout.

States

HTTP is stateless in general. But Session makes it stateful using a session cookie (e.g. PHPSESSID for PHP). A server can be stateless or stateful depending on the choice of session. If the server uses HTTP session then it has to be stateful, and the states comprising the session has to be declared at the compile time. The example above uses a stateless server (no HTTP session cookie). Hence all the callables take a statless context. The example shown below uses stateful session, where user is the only state. There can be multiple states passed as template parameters of stateful<StateA, StateB, StateC> while constructing the server. Callables should have a matching context, that takes all contexts::stateful<StateA, StateB, StateC> or lesser number of states contexts::stateful<StateB, StateC>. Callables in a stateful server can have a contexts::stateless context too.

Context

All the callables must take a compatiable context as the first parameter. The context includes the HTTP request object, logger reference, cookies, session information and additional accessories that might be required for serving the request.

Dependencies:

udho depend on boost. As boost-beast is only available on boost >= 1.66, udho requires a boost version at least 1.66. udho may optionally use ICU library for unicode regex functionality. In that case ICU library may be required.

  • boost > 1.66

  • pugixml

  • icu [optional]

Features:

  • [x] regular expression based url routing to callables (functions / function objects)

  • [x] compile time binding of routing rule with callables

  • [x] compile time travarsable url router

  • [x] response mime type specification in routing rule

  • [x] any default constructible can be used as callable argument type that can be parsed from std::string

  • [x] any ostreamable can be used as return type of callables

  • [x] automatic type coersion for url based method calling

  • [x] throwable http error messages

  • [x] throwable HTTP redirection

  • [x] serving static content from disk document root if no rule matched

  • [x] urlencoded/multipart form parsing

  • [x] form field validation

  • [x] on memory / on disk session for stateful web applications (no globals) and no session for stateless applications

  • [x] strictly typed on memory / on disk session storage

  • [x] compile time pluggable & customizable logging

  • [ ] server-sent events

  • [x] deferred response and long polling

  • [x] aync task graph

  • [x] xml based template parsing (working but need refactoring)

  • [x] arithmatic and logical expression evaluation in xml template (working but need refactoring)

Stateful Example

struct user{
    std::string name;
    user(){}
    user(const std::string& nm): name(nm){}
};
std::string login(udho::contexts::stateful<user> ctx){ /// < strictly typed stateful context
    const static username = "derp";
    const static password = "derp123";

    if(ctx.session().exists<user>()){
        user data;
        ctx.session() >> data;  /// < extract session data
        return "already logged in";
    }else{
        if(ctx.form().has("user") && ctx.form().has("pass")){
            std::string usr = ctx.form().field<std::string>("user"); /// < form field value from post request
            std::string psw = ctx.form().field<std::string>("pass"); /// < form field value from post request
            if(usr == username && psw == password){
                ctx.session() << user(usr); /// < put data in session
                return "successful";
            }
        }
    }
    return "failed";
}

std::string echo(udho::contexts::stateful<user> ctx, int num){
    if(ctx.session().exists<user>()){
        user data;
        ctx.session() >> data;
        return boost::format("{'name': '%1%', 'num': %2%}") % data.name % num;
    }
    return "{}";
}

int main(){
    std::string doc_root("/path/to/static/document/root");

    boost::asio::io_service io;
    udho::servers::ostreamed::stateful<user> server(io, std::cout);

    auto router = udho::router()
        | (udho::post(&login).plain() = "^/login$")
        | (udho::get(&echo).json()    = "^/echo/(\\d+)$");

    server.serve(router, 9198, doc_root);

    io.run();

    return 0;
}

Indices and tables