4#ifndef _Stroika_Foundation_Common_Property_h_
5#define _Stroika_Foundation_Common_Property_h_ 1
7#include "Stroika/Foundation/StroikaPreComp.h"
10#include <forward_list>
15#include "Stroika/Foundation/Common/Common.h"
17#include "Stroika/Foundation/Execution/LazyInitialized.h"
56#ifndef qStroika_Foundation_Common_Property_EmbedThisInProperties
57#if qCompilerAndStdLib_function_dependency_too_complex_Buggy
58#define qStroika_Foundation_Common_Property_EmbedThisInProperties 1
60#define qStroika_Foundation_Common_Property_EmbedThisInProperties 0
64#if qStroika_Foundation_Common_Property_EmbedThisInProperties
68#define qStroika_Foundation_Common_Property_ExtraCaptureStuff this
72#define qStroika_Foundation_Common_Property_OuterObjPtr(property, propertyPtrToMember) this
77#define qStroika_Foundation_Common_Property_ExtraCaptureStuff
81#define qStroika_Foundation_Common_Property_OuterObjPtr(property, propertyPtrToMember) \
82 Memory::GetObjectOwningField (property, propertyPtrToMember)
85 struct PropertyCommon {
103 template <
typename TT>
104 static constexpr bool kIsMutableType = not is_const_v<remove_reference_t<TT>> and is_reference_v<TT>;
106 enum class PropertyChangedEventResultType {
107 eSilentlyCutOffProcessing,
112 template <
typename T>
113 concept IPropertyMutatable = PropertyCommon::kIsMutableType<T>;
127 template <
typename T>
132 using value_type = T;
143 template <qCompilerAndStdLib_RequiresNotMatchXXXDefined_1_BWA (invocable<const ReadOnlyProperty<T>*>) G>
145 qCompilerAndStdLib_RequiresNotMatchXXXDefined_2_BWA (
requires (convertible_to<invoke_result_t<G,
const ReadOnlyProperty<T>*>, T>));
156 nonvirtual T
Get () const
157 requires (not IPropertyMutatable<T>);
159 requires (IPropertyMutatable<T>);
173 nonvirtual operator const T () const
174 requires (not IPropertyMutatable<T>);
175 nonvirtual operator T ()
176 requires (IPropertyMutatable<T>);
192 nonvirtual const T operator() () const
193 requires (not IPropertyMutatable<T>);
194 nonvirtual T operator() ()
195 requires (IPropertyMutatable<T>);
208 template <typename T>
213 using value_type = T;
225 template <qCompilerAndStdLib_RequiresNotMatchXXXDefined_1_BWA (invocable<WriteOnlyProperty<T>*, T>) S>
405 template <
typename T>
412 using decayed_value_type = remove_cvref_t<T>;
423 template <invocable<const ReadOnlyProperty<T>*> G, invocable<WriteOnlyProperty<remove_cvref_t<T>>*, remove_cvref_t<T>> S>
425 requires (convertible_to<invoke_result_t<G, const ReadOnlyProperty<T>*>, T>);
435 template <
typename TT>
436 nonvirtual
bool operator== (
const TT& rhs)
const;
447 template <
typename T>
490 template <
typename T>
493 using typename Property<T>::decayed_value_type;
502 template <qCompilerAndStdLib_RequiresNotMatchXXXDefined_1_BWA (invocable<const ExtendableProperty<T>*>) G,
503 qCompilerAndStdLib_RequiresNotMatchXXXDefined_1_BWA (invocable<ExtendableProperty<T>*, remove_cvref_t<T>>) S>
505 qCompilerAndStdLib_RequiresNotMatchXXXDefined_2_BWA (
requires (convertible_to<invoke_result_t<G,
const ExtendableProperty<T>*>, T>));
517 struct PropertyChangedEvent {
518 decayed_value_type fPreviousValue;
519 decayed_value_type fNewValue;
575 forward_list<PropertyReadEventHandler> fPropertyReadHandlers_;
576 forward_list<PropertyChangedEventHandler> fPropertyChangedHandlers_;
586#include "Property.inl"
ExtendableProperty is a Property which has callbacks associated with it, to be notified when it is ac...
conditional_t< is_reference_v< base_value_type >, decayed_value_type *, base_value_type > PropertyReadEventHandlerArgAndReturnValue_
function< PropertyCommon::PropertyChangedEventResultType(const PropertyChangedEvent &)> PropertyChangedEventHandler
function< PropertyReadEventHandlerArgAndReturnValue_(const PropertyReadEventHandlerArgAndReturnValue_ &)> PropertyReadEventHandler
ReadOnlyProperty< const std::forward_list< PropertyReadEventHandler > & > propertyReadHandlers
ReadOnlyProperty< const std::forward_list< PropertyChangedEventHandler > & > propertyChangedHandlers
T base_value_type
base_value_type is T the type declared, and decayed_value_type is similar, but with the references et...
nonvirtual const T operator()() const
ReadOnlyProperty()=delete
WriteOnlyProperty()=delete
value-object, where the value construction is delayed until first needed (can be handy to avoid c++ i...
conditional_t<(sizeof(CHECK_T)<=2 *sizeof(void *)) and is_trivially_copyable_v< CHECK_T >, CHECK_T, const CHECK_T & > ArgByValueType
This is an alias for 'T' - but how we want to pass it on stack as formal parameter.