AnCH Framework 0.1
Another C++ Hack Framework
 
Loading...
Searching...
No Matches
anch::Fluent< T, C > Class Template Reference

Java style fuent class. More...

#include <fluent.hpp>

+ Collaboration diagram for anch::Fluent< T, C >:

Public Member Functions

 Fluent ()=delete
 
 Fluent (C< T > &container)
 
 Fluent (const Fluent &other)
 
 Fluent (Fluent &&other)
 
virtual ~Fluent ()
 
Fluentfilter (std::function< bool(const T &)> predicate)
 
Fluentskip (uint64_t skip)
 
Fluentlimit (uint64_t limit)
 
Fluentconcat (Fluent< T, C > &other) noexcept
 
bool allMatch (std::function< bool(const T &)> predicate)
 
bool anyMatch (std::function< bool(const T &)> predicate)
 
bool noneMatch (std::function< bool(const T &)> predicate)
 
void forEach (std::function< void(T &)> action)
 
template<typename U>
Fluent< U, std::vector > map (std::function< U(const T &)> mapper)
 
template<typename D>
void collect (D &container, std::function< void(D &, const T &)> collector)
 
template<typename D>
collect (std::function< void(D &, const T &)> collector)
 
template<typename D, typename R>
void collect (D &container, R(D::*collector)(const T &))
 
template<typename D, typename R>
collect (R(D::*collector)(const T &))
 

Detailed Description

template<typename T, template< typename > typename C>
class anch::Fluent< T, C >

Java style fuent class.

Fluent aims to lazily apply treatment on container.
Every operation is stored until final operation is call. They are applied in their insertion order.

Author
Vincent Lachenal

Constructor & Destructor Documentation

◆ Fluent() [1/4]

template<typename T, template< typename > typename C>
anch::Fluent< T, C >::Fluent ( )
delete

Forbids Fluent constructor

◆ Fluent() [2/4]

template<typename T, template< typename > typename C>
anch::Fluent< T, C >::Fluent ( C< T > & container)

Build fluent from container

Parameters
containerthe container

◆ Fluent() [3/4]

template<typename T, template< typename > typename C>
anch::Fluent< T, C >::Fluent ( const Fluent< T, C > & other)

Fluent copy constructor

+ Here is the call graph for this function:

◆ Fluent() [4/4]

template<typename T, template< typename > typename C>
anch::Fluent< T, C >::Fluent ( Fluent< T, C > && other)

Fluent move constructor

+ Here is the call graph for this function:

◆ ~Fluent()

template<typename T, template< typename > typename C>
virtual anch::Fluent< T, C >::~Fluent ( )
virtual

Fluent destructor

Member Function Documentation

◆ allMatch()

template<typename T, template< typename > typename C>
bool anch::Fluent< T, C >::allMatch ( std::function< bool(const T &)> predicate)

Check if every items in fluent match a predicate

Parameters
predicatethe function to use to check items

◆ anyMatch()

template<typename T, template< typename > typename C>
bool anch::Fluent< T, C >::anyMatch ( std::function< bool(const T &)> predicate)

Check if there is at least one item in fluent that matches a predicate

Parameters
predicatethe function to use to check items

◆ collect() [1/4]

template<typename T, template< typename > typename C>
template<typename D, typename R>
void anch::Fluent< T, C >::collect ( D & container,
R(D::* collector )(const T &) )

Collect fluent items in container

Parameters
containerthe container to fill
collectorthe collector function

◆ collect() [2/4]

template<typename T, template< typename > typename C>
template<typename D>
void anch::Fluent< T, C >::collect ( D & container,
std::function< void(D &, const T &)> collector )

Collect fluent items in container

Parameters
containerthe container to fill
collectorthe collector function

◆ collect() [3/4]

template<typename T, template< typename > typename C>
template<typename D, typename R>
D anch::Fluent< T, C >::collect ( R(D::* collector )(const T &))

Collect fluent items in container

Parameters
collectorthe collector function
Returns
the result container

◆ collect() [4/4]

template<typename T, template< typename > typename C>
template<typename D>
D anch::Fluent< T, C >::collect ( std::function< void(D &, const T &)> collector)

Collect fluent items in container

Parameters
collectorthe collector function
Returns
the result container

◆ concat()

template<typename T, template< typename > typename C>
Fluent & anch::Fluent< T, C >::concat ( Fluent< T, C > & other)
noexcept

Fluent lazy 'concatenation'

Parameters
otherthe fluent to concatenate
+ Here is the call graph for this function:

◆ filter()

template<typename T, template< typename > typename C>
Fluent & anch::Fluent< T, C >::filter ( std::function< bool(const T &)> predicate)

Add filter function

Parameters
predicatethe filter function
Returns
the current Fluent
+ Here is the call graph for this function:

◆ forEach()

template<typename T, template< typename > typename C>
void anch::Fluent< T, C >::forEach ( std::function< void(T &)> action)

Apply treatment for each item in fluent

Parameters
actionthe function to execute on each item

◆ limit()

template<typename T, template< typename > typename C>
Fluent & anch::Fluent< T, C >::limit ( uint64_t limit)

Set limit

Parameters
limitthe number maximum of elements to treat
Returns
the current Fluent
+ Here is the call graph for this function:

◆ map()

template<typename T, template< typename > typename C>
template<typename U>
Fluent< U, std::vector > anch::Fluent< T, C >::map ( std::function< U(const T &)> mapper)

Create a new fluent transforming current fluent type into another.

Parameters
mapperthe mapping function
+ Here is the call graph for this function:

◆ noneMatch()

template<typename T, template< typename > typename C>
bool anch::Fluent< T, C >::noneMatch ( std::function< bool(const T &)> predicate)

Check if there is no item in fluent that matches a predicate

Parameters
predicatethe function to use to check items

◆ skip()

template<typename T, template< typename > typename C>
Fluent & anch::Fluent< T, C >::skip ( uint64_t skip)

Set skip

Parameters
skipthe elements to skip
Returns
the current Fluent
+ Here is the call graph for this function:

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