casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Types | Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
casa::vi::Try< A > Class Template Reference

#include <Try.h>

Inheritance diagram for casa::vi::Try< A >:
casa::vi::TryBase

Public Types

typedef A value_type
 

Public Member Functions

 Try ()
 Constructors. More...
 
 Try (const A &a)
 
 Try (A &&a)
 
 Try (const std::exception_ptr &e)
 
 Try (std::exception_ptr &&e)
 
 Try (const Try< A > &ta)
 
 Try (Try< A > &&ta)
 
Try< A > & operator= (const Try< A > &ta)
 Instance methods. More...
 
Try< A > & operator= (Try< A > &&ta)
 
bool operator== (const Try< A > &ta) const
 
bool operator!= (const Try< A > &ta) const
 
template<typename F , typename TB = typename std::result_of<F()>::type, class = std::enable_if<std::is_base_of<TryBase,TB>::value>>
TB andThen (F &&f) const
 
template<typename F , class = std::enable_if< std::is_convertible<std::result_of<F(const A&)>,bool>::value>>
Try< A > filter (F &&f) const
 
template<typename F , typename TB = typename std::result_of<F(const A&)>::type, class = std::enable_if<std::is_base_of<TryBase,TB>::value>>
TB flatMap (F &&f) const
 
template<class = std::enable_if<std::is_base_of<TryBase,A>::value>>
flatten () const
 
template<typename Err , typename Val , typename B = typename std::result_of<Err(const std::exception_ptr&)>::type, typename C = typename std::result_of<Val(const A&)>::type, class = std::enable_if<std::is_same<B,C>::value>>
fold (Err &&err, Val &&val) const
 
template<typename F >
void foreach (F &&f) const
 
get () const
 
template<typename F , typename B = typename std::result_of<F()>::type, class = typename std::enable_if<std::is_base_of<B, A>::value>>
getOrElse (F &&f) const
 
template<typename B , class = typename std::enable_if<std::is_base_of<B, A>::value>>
getOrElse_ (const B &b) const
 
bool isSuccess () const
 
template<typename F , typename B = typename std::result_of<F(const A&)>::type>
Try< B > map (F &&f) const
 
template<typename F , typename TB = typename std::result_of<F()>::type, class = std::enable_if<std::is_base_of<TryBase,TB>::value>, class = std::enable_if< std::is_base_of<typename TB::value_type,A>::value>>
TB orElse (F &&f) const
 
template<typename TB , class = std::enable_if<std::is_base_of<TryBase,TB>::value>, class = std::enable_if< std::is_base_of<typename TB::value_type,A>::value>>
TB orElse_ (const TB &tb) const
 
template<typename F , class = std::enable_if< std::is_convertible< std::result_of<F(const std::exception&)>,A>::value>>
Try< A > recoverWith (F &&f) const
 
template<typename Err , typename Val , typename TB = typename std::result_of<Err(const std::exception_ptr&)>::type, typename TC = typename std::result_of<Val(const A&)>::type, class = std::enable_if<std::is_base_of<TryBase,TB>::value>, class = std::enable_if<std::is_base_of<TryBase,TC>::value>, class = std::enable_if<std::is_same<TB,TC>::value >>
TB transform (Err &&err, Val &&val) const
 
template<typename F , typename B = typename std::result_of<F(const A&)>::type>
Try< B > operator| (F &&f) const
 
template<typename F , typename TB = typename std::result_of<F(const A&)>::type, class = std::enable_if<std::is_base_of<TryBase,TB>::value>>
TB operator>>= (F &&f) const
 
template<typename F , typename TB = typename std::result_of<F()>::type, class = std::enable_if<std::is_base_of<TryBase,TB>::value>>
TB operator>> (F &&f) const
 

Static Public Member Functions

template<typename F , class = std::enable_if< std::is_convertible<std::result_of<F()>,A>::value,A>>
static Try< A > from (F &&f)
 Static methods. More...
 
template<typename F , typename B = typename std::result_of<F(const A&)>::type>
static std::function< Try< B >
const Try< A > &)> 
lift (F f)
 

Private Attributes

bool m_isSuccess
 
std::unique_ptr< A > m_value
 
std::exception_ptr m_exception
 

Detailed Description

template<typename A>
class casa::vi::Try< A >

Definition at line 52 of file Try.h.

Member Typedef Documentation

template<typename A>
typedef A casa::vi::Try< A >::value_type

Definition at line 57 of file Try.h.

Constructor & Destructor Documentation

template<typename A>
casa::vi::Try< A >::Try ( )
inline

Constructors.

Definition at line 61 of file Try.h.

template<typename A>
casa::vi::Try< A >::Try ( const A &  a)
inline

Definition at line 65 of file Try.h.

References casa::vi::Try< A >::m_value.

template<typename A>
casa::vi::Try< A >::Try ( A &&  a)
inline

Definition at line 70 of file Try.h.

References casa::vi::Try< A >::m_value, and move().

template<typename A>
casa::vi::Try< A >::Try ( const std::exception_ptr &  e)
inline

Definition at line 75 of file Try.h.

template<typename A>
casa::vi::Try< A >::Try ( std::exception_ptr &&  e)
inline

Definition at line 79 of file Try.h.

template<typename A>
casa::vi::Try< A >::Try ( const Try< A > &  ta)
inline

Definition at line 83 of file Try.h.

template<typename A>
casa::vi::Try< A >::Try ( Try< A > &&  ta)
inline

Definition at line 87 of file Try.h.

Member Function Documentation

template<typename A>
template<typename F , typename TB = typename std::result_of<F()>::type, class = std::enable_if<std::is_base_of<TryBase,TB>::value>>
TB casa::vi::Try< A >::andThen ( F &&  f) const
inline

Definition at line 167 of file Try.h.

References casa::vi::Try< A >::flatMap().

Referenced by casa::vi::Try< A >::operator>>().

template<typename A>
template<typename F , class = std::enable_if< std::is_convertible<std::result_of<F(const A&)>,bool>::value>>
Try<A> casa::vi::Try< A >::filter ( F &&  f) const
inline

Definition at line 179 of file Try.h.

References casa::vi::Try< A >::m_isSuccess, and casa::vi::Try< A >::m_value.

template<typename A>
template<typename F , typename TB = typename std::result_of<F(const A&)>::type, class = std::enable_if<std::is_base_of<TryBase,TB>::value>>
TB casa::vi::Try< A >::flatMap ( F &&  f) const
inline

Definition at line 200 of file Try.h.

References casa::vi::Try< A >::map().

Referenced by casa::vi::Try< A >::andThen(), and casa::vi::Try< A >::operator>>=().

template<typename A>
template<class = std::enable_if<std::is_base_of<TryBase,A>::value>>
A casa::vi::Try< A >::flatten ( ) const
inline
template<typename A>
template<typename Err , typename Val , typename B = typename std::result_of<Err(const std::exception_ptr&)>::type, typename C = typename std::result_of<Val(const A&)>::type, class = std::enable_if<std::is_same<B,C>::value>>
B casa::vi::Try< A >::fold ( Err &&  err,
Val &&  val 
) const
inline
template<typename A>
template<typename F >
void casa::vi::Try< A >::foreach ( F &&  f) const
inline

Definition at line 238 of file Try.h.

References casa::vi::Try< A >::m_isSuccess, and casa::vi::Try< A >::m_value.

template<typename A>
template<typename F , class = std::enable_if< std::is_convertible<std::result_of<F()>,A>::value,A>>
static Try<A> casa::vi::Try< A >::from ( F &&  f)
inlinestatic

Static methods.

Definition at line 101 of file Try.h.

Referenced by casa::vi::Try< A >::recoverWith(), and casa::vi::try_().

template<typename A>
A casa::vi::Try< A >::get ( ) const
inline
template<typename A>
template<typename F , typename B = typename std::result_of<F()>::type, class = typename std::enable_if<std::is_base_of<B, A>::value>>
B casa::vi::Try< A >::getOrElse ( F &&  f) const
inline

Definition at line 260 of file Try.h.

References casa::vi::Try< A >::m_isSuccess, and casa::vi::Try< A >::m_value.

Referenced by casa::vi::Try< A >::getOrElse_().

template<typename A>
template<typename B , class = typename std::enable_if<std::is_base_of<B, A>::value>>
B casa::vi::Try< A >::getOrElse_ ( const B &  b) const
inline

Definition at line 272 of file Try.h.

References casa::vi::Try< A >::getOrElse().

template<typename A>
bool casa::vi::Try< A >::isSuccess ( ) const
inline

Definition at line 277 of file Try.h.

References casa::vi::Try< A >::m_isSuccess.

template<typename A>
template<typename F , typename B = typename std::result_of<F(const A&)>::type>
static std::function<Try<B>const Try<A>&)> casa::vi::Try< A >::lift ( f)
inlinestatic

Definition at line 120 of file Try.h.

template<typename A>
template<typename F , typename B = typename std::result_of<F(const A&)>::type>
Try<B> casa::vi::Try< A >::map ( F &&  f) const
inline
template<typename A>
bool casa::vi::Try< A >::operator!= ( const Try< A > &  ta) const
inline

Definition at line 155 of file Try.h.

template<typename A>
Try<A>& casa::vi::Try< A >::operator= ( const Try< A > &  ta)
inline

Instance methods.

Definition at line 130 of file Try.h.

References casa::vi::Try< A >::m_exception, casa::vi::Try< A >::m_isSuccess, and casa::vi::Try< A >::m_value.

template<typename A>
Try<A>& casa::vi::Try< A >::operator= ( Try< A > &&  ta)
inline
template<typename A>
bool casa::vi::Try< A >::operator== ( const Try< A > &  ta) const
inline
template<typename A>
template<typename F , typename TB = typename std::result_of<F()>::type, class = std::enable_if<std::is_base_of<TryBase,TB>::value>>
TB casa::vi::Try< A >::operator>> ( F &&  f) const
inline

Definition at line 400 of file Try.h.

References casa::vi::Try< A >::andThen().

template<typename A>
template<typename F , typename TB = typename std::result_of<F(const A&)>::type, class = std::enable_if<std::is_base_of<TryBase,TB>::value>>
TB casa::vi::Try< A >::operator>>= ( F &&  f) const
inline

Definition at line 388 of file Try.h.

References casa::vi::Try< A >::flatMap().

template<typename A>
template<typename F , typename B = typename std::result_of<F(const A&)>::type>
Try<B> casa::vi::Try< A >::operator| ( F &&  f) const
inline

Definition at line 376 of file Try.h.

References casa::vi::Try< A >::map().

template<typename A>
template<typename F , typename TB = typename std::result_of<F()>::type, class = std::enable_if<std::is_base_of<TryBase,TB>::value>, class = std::enable_if< std::is_base_of<typename TB::value_type,A>::value>>
TB casa::vi::Try< A >::orElse ( F &&  f) const
inline

Definition at line 310 of file Try.h.

References casa::vi::Try< A >::m_isSuccess.

Referenced by casa::vi::Try< A >::orElse_().

template<typename A>
template<typename TB , class = std::enable_if<std::is_base_of<TryBase,TB>::value>, class = std::enable_if< std::is_base_of<typename TB::value_type,A>::value>>
TB casa::vi::Try< A >::orElse_ ( const TB &  tb) const
inline

Definition at line 326 of file Try.h.

References casa::vi::Try< A >::orElse().

template<typename A>
template<typename F , class = std::enable_if< std::is_convertible< std::result_of<F(const std::exception&)>,A>::value>>
Try<A> casa::vi::Try< A >::recoverWith ( F &&  f) const
inline
template<typename A>
template<typename Err , typename Val , typename TB = typename std::result_of<Err(const std::exception_ptr&)>::type, typename TC = typename std::result_of<Val(const A&)>::type, class = std::enable_if<std::is_base_of<TryBase,TB>::value>, class = std::enable_if<std::is_base_of<TryBase,TC>::value>, class = std::enable_if<std::is_same<TB,TC>::value >>
TB casa::vi::Try< A >::transform ( Err &&  err,
Val &&  val 
) const
inline

Definition at line 362 of file Try.h.

References casa::vi::Try< A >::fold().

Member Data Documentation

template<typename A>
std::exception_ptr casa::vi::Try< A >::m_exception
private
template<typename A>
bool casa::vi::Try< A >::m_isSuccess
private
template<typename A>
std::unique_ptr<A> casa::vi::Try< A >::m_value
private

The documentation for this class was generated from the following file: