Java style fuent class. More...
#include <fluent.hpp>
Public Member Functions | |
Fluent ()=delete | |
Fluent (C< T > &container) | |
Fluent (const Fluent &other) | |
Fluent (Fluent &&other) | |
virtual | ~Fluent () |
Fluent & | filter (std::function< bool(const T &)> predicate) |
Fluent & | skip (uint64_t skip) |
Fluent & | limit (uint64_t limit) |
Fluent & | concat (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> | |
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> | |
D | collect (R(D::*collector)(const T &)) |
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.
|
delete |
Forbids Fluent constructor
anch::Fluent< T, C >::Fluent | ( | C< T > & | container | ) |
Build fluent from container
container | the container |
anch::Fluent< T, C >::Fluent | ( | const Fluent< T, C > & | other | ) |
anch::Fluent< T, C >::Fluent | ( | Fluent< T, C > && | other | ) |
|
virtual |
Fluent destructor
bool anch::Fluent< T, C >::allMatch | ( | std::function< bool(const T &)> | predicate | ) |
Check if every items in fluent match a predicate
predicate | the function to use to check items |
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
predicate | the function to use to check items |
void anch::Fluent< T, C >::collect | ( | D & | container, |
R(D::* | collector )(const T &) ) |
Collect fluent items in container
container | the container to fill |
collector | the collector function |
void anch::Fluent< T, C >::collect | ( | D & | container, |
std::function< void(D &, const T &)> | collector ) |
Collect fluent items in container
container | the container to fill |
collector | the collector function |
D anch::Fluent< T, C >::collect | ( | R(D::* | collector )(const T &) | ) |
Collect fluent items in container
collector | the collector function |
D anch::Fluent< T, C >::collect | ( | std::function< void(D &, const T &)> | collector | ) |
Collect fluent items in container
collector | the collector function |
|
noexcept |
Fluent lazy 'concatenation'
other | the fluent to concatenate |
Fluent & anch::Fluent< T, C >::filter | ( | std::function< bool(const T &)> | predicate | ) |
Add filter function
predicate | the filter function |
void anch::Fluent< T, C >::forEach | ( | std::function< void(T &)> | action | ) |
Apply treatment for each item in fluent
action | the function to execute on each item |
Fluent & anch::Fluent< T, C >::limit | ( | uint64_t | limit | ) |
Set limit
limit | the number maximum of elements to treat |
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.
mapper | the mapping function |
bool anch::Fluent< T, C >::noneMatch | ( | std::function< bool(const T &)> | predicate | ) |
Check if there is no item in fluent that matches a predicate
predicate | the function to use to check items |
Fluent & anch::Fluent< T, C >::skip | ( | uint64_t | skip | ) |
Set skip
skip | the elements to skip |