32template<
typename X,
typename Y,
typename =
void>
36template<
typename X,
typename Y>
41 decltype(std::equal_to<>{}(std::declval<X>(), std::declval<Y>()))>,
42 bool>::value>> : std::true_type {
45template<
typename X,
typename Y>
59 using std::runtime_error::runtime_error;
87 -> std::enable_if_t<Private::are_equality_comparable_v<T, T>,
bool>
89 return std::equal_to<>{}(x, y);
99 template<
typename X,
typename Y>
101 -> std::enable_if_t<!Private::are_equality_comparable_v<X, Y>,
bool>
111 template<
typename PropertyType>
160 explicit Property(T value)
noexcept(std::is_nothrow_move_constructible<T>::value)
161 : m_value{
std::move(value) }
181 : m_value(
std::move(other.m_value))
182 , m_valueAboutToChange(
std::move(other.m_valueAboutToChange))
183 , m_valueChanged(
std::move(other.m_valueChanged))
184 , m_destroyed(
std::move(other.m_destroyed))
185 , m_updater(
std::move(other.m_updater))
192 using namespace std::placeholders;
193 m_updater->setUpdateFunction(
199 other.m_moved.emit(*
this);
200 m_moved = std::move(other.m_moved);
210 m_value = std::move(other.m_value);
211 m_valueAboutToChange = std::move(other.m_valueAboutToChange);
212 m_valueChanged = std::move(other.m_valueChanged);
213 m_destroyed = std::move(other.m_destroyed);
214 m_updater = std::move(other.m_updater);
218 using namespace std::placeholders;
219 m_updater->setUpdateFunction(
225 other.m_moved.emit(*
this);
226 m_moved = std::move(other.m_moved);
237 template<
typename UpdaterT>
238 explicit Property(std::unique_ptr<UpdaterT> &&updater)
240 *
this = std::move(updater);
254 template<
typename UpdaterT>
257 m_updater = std::move(updater);
260 using namespace std::placeholders;
261 m_updater->setUpdateFunction(
265 setHelper(m_updater->get());
321 "Cannot set value on a read-only property. This property likely holds the result of a binding expression."
324 setHelper(std::move(value));
357 void setHelper(T value)
362 m_valueAboutToChange.
emit(m_value, value);
363 m_value = std::move(value);
364 m_valueChanged.
emit(m_value);
371 mutable Signal<const T &, const T &> m_valueAboutToChange;
372 mutable Signal<const T &> m_valueChanged;
382 template<
typename PropertyType>
387 std::unique_ptr<PropertyUpdater<T>> m_updater;
396 stream <<
property.get();
409 prop.
set(std::move(temp));
416struct is_property_helper : std::false_type {
420struct is_property_helper<Property<
T>> : std::true_type {
424struct is_property : is_property_helper<std::decay_t<T>> {
A property represents a value that can be part of or the result of data binding.
Property & operator=(std::unique_ptr< UpdaterT > &&updater)
Property(Property< T > const &other)=delete
void reset()
Disconnects the binding from this Property.
Signal< const T &, const T & > & valueAboutToChange() const
Signal< const T & > & valueChanged() const
Property & operator=(Property< T > const &other)=delete
Signal & destroyed() const
Property< T > & operator=(T const &rhs)
Property(Property< T > &&other) noexcept(std::is_nothrow_move_constructible< T >::value)
Properties are movable.
Property(std::unique_ptr< UpdaterT > &&updater)
T const & operator()() const
Property(T value) noexcept(std::is_nothrow_move_constructible< T >::value)
Property & operator=(Property< T > &&other) noexcept(std::is_nothrow_move_assignable< T >::value)
A Signal provides a mechanism for communication between objects.
void emit(Args... p) const
constexpr bool are_equality_comparable_v
typename operator_node_result< Operator, Ts... >::type operator_node_result_t
The main namespace of the KDBindings library.
std::ostream & operator<<(std::ostream &stream, Property< T > const &property)
std::istream & operator>>(std::istream &stream, Property< T > &prop)
ReadOnlyProperty()=delete
An instance of the KDBindings::equal_to struct is used to decide whether two values of type T are equ...
auto operator()(const T &x, const T &y) const noexcept -> std::enable_if_t< Private::are_equality_comparable_v< T, T >, bool >
auto operator()(const X &, const Y &) const noexcept -> std::enable_if_t<!Private::are_equality_comparable_v< X, Y >, bool >