Krita Source Code Documentation
Loading...
Searching...
No Matches
kiszug Namespace Reference

Classes

struct  empty_t
 

Variables

constexpr auto foreach_arg
 
constexpr auto foreach_tuple
 
template<typename T >
constexpr auto map_equal = [] (T value) { return zug::map([value](auto&& x) { return x == value; }); }
 
template<>
constexpr auto map_equal< qreal > = [] (qreal value) { return zug::map([value](auto&& x) { return qFuzzyCompare(x, value); }); }
 
template<typename T >
constexpr auto map_greater = [] (T value) { return zug::map([value](auto&& x) { return x > value; }); }
 
template<typename T >
constexpr auto map_greater_equal = [] (T value) { return zug::map([value](auto&& x) { return x >= value; }); }
 
template<>
constexpr auto map_greater_equal< qreal > = [] (qreal value) { return zug::map([value](auto&& x) { return x >= value || qFuzzyCompare(x, value); }); }
 
template<typename T >
constexpr auto map_less = [] (T value) { return zug::map([value](auto&& x) { return x < value; }); }
 
template<typename T >
constexpr auto map_less_equal = [] (T value) { return zug::map([value](auto&& x) { return x <= value; }); }
 
template<>
constexpr auto map_less_equal< qreal > = [] (qreal value) { return zug::map([value](auto&& x) { return x <= value || qFuzzyCompare(x, value); }); }
 
template<typename T >
constexpr auto map_multiply = [] (T coeff) { return zug::map([coeff](auto&& x) { return x * coeff; }); }
 
template<typename T >
constexpr auto map_not_equal = [] (T value) { return zug::map([value](auto&& x) { return x != value; }); }
 
template<>
constexpr auto map_not_equal< qreal > = [] (qreal value) { return zug::map([value](auto&& x) { return !qFuzzyCompare(x, value); }); }
 
constexpr auto map_round = zug::map([](qreal x) -> int { return qRound(x); })
 
template<typename T >
constexpr auto map_static_cast = zug::map([](auto&& x) { return static_cast<T>(x); })
 
constexpr auto to_functor
 

Detailed Description

kiszug is a namespace extending the functionality of zug library. It contains transducers, lenses and other tools that are not present in zug itself.

Naming convention exception:

The namespace follows naming convention of zug library, that is, all entities should be named in "snake_case" manner.

Variable Documentation

◆ foreach_arg

constexpr auto kiszug::foreach_arg
constexpr
Initial value:
=
[] (auto mapping) {
return zug::map([=] (auto&&... t) {
return std::make_tuple(zug::compat::invoke(to_functor(mapping), ZUG_FWD(t))...);
});
}
constexpr auto to_functor
Definition KisZug.h:70

Definition at line 84 of file KisZug.h.

85 {
86 return zug::map([=] (auto&&... t) {
87 return std::make_tuple(zug::compat::invoke(to_functor(mapping), ZUG_FWD(t))...);
88 });
89 };

◆ foreach_tuple

constexpr auto kiszug::foreach_tuple
constexpr
Initial value:
=
[] (auto mapping) {
return zug::map([=] (auto &&t) {
return kismpl::apply_to_tuple(to_functor(mapping), ZUG_FWD(t));
});
}
auto apply_to_tuple(F f, Tuple &&t)
Definition KisMpl.h:60

Definition at line 77 of file KisZug.h.

78 {
79 return zug::map([=] (auto &&t) {
80 return kismpl::apply_to_tuple(to_functor(mapping), ZUG_FWD(t));
81 });
82 };

◆ map_equal

template<typename T >
constexpr auto kiszug::map_equal = [] (T value) { return zug::map([value](auto&& x) { return x == value; }); }
constexpr

Definition at line 36 of file KisZug.h.

36{ return zug::map([value](auto&& x) { return x == value; }); };
float value(const T *src, size_t ch)

◆ map_equal< qreal >

template<>
constexpr auto kiszug::map_equal< qreal > = [] (qreal value) { return zug::map([value](auto&& x) { return qFuzzyCompare(x, value); }); }
inlineconstexpr

Definition at line 53 of file KisZug.h.

53{ return zug::map([value](auto&& x) { return qFuzzyCompare(x, value); }); };
static bool qFuzzyCompare(half p1, half p2)

◆ map_greater

template<typename T >
constexpr auto kiszug::map_greater = [] (T value) { return zug::map([value](auto&& x) { return x > value; }); }
constexpr

Definition at line 42 of file KisZug.h.

42{ return zug::map([value](auto&& x) { return x > value; }); };

◆ map_greater_equal

template<typename T >
constexpr auto kiszug::map_greater_equal = [] (T value) { return zug::map([value](auto&& x) { return x >= value; }); }
constexpr

Definition at line 44 of file KisZug.h.

44{ return zug::map([value](auto&& x) { return x >= value; }); };

◆ map_greater_equal< qreal >

template<>
constexpr auto kiszug::map_greater_equal< qreal > = [] (qreal value) { return zug::map([value](auto&& x) { return x >= value || qFuzzyCompare(x, value); }); }
inlineconstexpr

Definition at line 59 of file KisZug.h.

59{ return zug::map([value](auto&& x) { return x >= value || qFuzzyCompare(x, value); }); };

◆ map_less

template<typename T >
constexpr auto kiszug::map_less = [] (T value) { return zug::map([value](auto&& x) { return x < value; }); }
constexpr

Definition at line 47 of file KisZug.h.

47{ return zug::map([value](auto&& x) { return x < value; }); };

◆ map_less_equal

template<typename T >
constexpr auto kiszug::map_less_equal = [] (T value) { return zug::map([value](auto&& x) { return x <= value; }); }
constexpr

Definition at line 50 of file KisZug.h.

50{ return zug::map([value](auto&& x) { return x <= value; }); };

◆ map_less_equal< qreal >

template<>
constexpr auto kiszug::map_less_equal< qreal > = [] (qreal value) { return zug::map([value](auto&& x) { return x <= value || qFuzzyCompare(x, value); }); }
inlineconstexpr

Definition at line 62 of file KisZug.h.

62{ return zug::map([value](auto&& x) { return x <= value || qFuzzyCompare(x, value); }); };

◆ map_multiply

template<typename T >
constexpr auto kiszug::map_multiply = [] (T coeff) { return zug::map([coeff](auto&& x) { return x * coeff; }); }
constexpr

Definition at line 33 of file KisZug.h.

33{ return zug::map([coeff](auto&& x) { return x * coeff; }); };

◆ map_not_equal

template<typename T >
constexpr auto kiszug::map_not_equal = [] (T value) { return zug::map([value](auto&& x) { return x != value; }); }
constexpr

Definition at line 39 of file KisZug.h.

39{ return zug::map([value](auto&& x) { return x != value; }); };

◆ map_not_equal< qreal >

template<>
constexpr auto kiszug::map_not_equal< qreal > = [] (qreal value) { return zug::map([value](auto&& x) { return !qFuzzyCompare(x, value); }); }
inlineconstexpr

Definition at line 56 of file KisZug.h.

56{ return zug::map([value](auto&& x) { return !qFuzzyCompare(x, value); }); };

◆ map_round

constexpr auto kiszug::map_round = zug::map([](qreal x) -> int { return qRound(x); })
constexpr

Definition at line 64 of file KisZug.h.

◆ map_static_cast

template<typename T >
constexpr auto kiszug::map_static_cast = zug::map([](auto&& x) { return static_cast<T>(x); })
constexpr

Definition at line 30 of file KisZug.h.

◆ to_functor

constexpr auto kiszug::to_functor
constexpr
Initial value:
= [] (auto f) {
return
[=] (auto &&x) {
return f(zug::last)(empty_t{}, ZUG_FWD(x));
};
}

Definition at line 70 of file KisZug.h.

70 {
71 return
72 [=] (auto &&x) {
73 return f(zug::last)(empty_t{}, ZUG_FWD(x));
74 };
75};