4#if !qStroika_Foundation_Common_Property_EmbedThisInProperties
17 template <qCompilerAndStdLib_RequiresNotMatchXXXDefined_1_BWA (invocable<const ReadOnlyProperty<T>*>) G>
19 qCompilerAndStdLib_RequiresNotMatchXXXDefined_2_BWA (
requires (convertible_to<invoke_result_t<G,
const ReadOnlyProperty<T>*>, T>))
25 requires (not IPropertyMutatable<T>)
27 return fGetter_ (
this);
31 requires (IPropertyMutatable<T>)
33 return fGetter_ (
this);
37 requires (not IPropertyMutatable<T>)
43 requires (IPropertyMutatable<T>)
49 requires (not IPropertyMutatable<T>)
55 requires (IPropertyMutatable<T>)
66 template <qCompilerAndStdLib_RequiresNotMatchXXXDefined_1_BWA (invocable<WriteOnlyProperty<T>*, T>) S>
74 fSetter_ (
this, value);
94 template <invocable<const ReadOnlyProperty<T>*> G, invocable<WriteOnlyProperty<remove_cvref_t<T>>*, remove_cvref_t<T>> S>
96 requires (convertible_to<invoke_result_t<G, const ReadOnlyProperty<T>*>, T>)
98 , WriteOnlyProperty<decayed_value_type>{setter}
101 template <
typename T>
102 inline auto Property<T>::operator= (ArgByValueType<decayed_value_type> value) -> Property&
107 template <
typename T>
108 inline auto Property<T>::operator= (
const Property& value) -> Property&
113 template <
typename T>
114 template <
typename TT>
115 inline bool Property<T>::operator== (
const TT& rhs)
const
117 return Get () ==
static_cast<T
> (rhs);
125 template <
typename T>
126 template <qCompilerAndStdLib_RequiresNotMatchXXXDefined_1_BWA (invocable<const ExtendableProperty<T>*>) G,
127 qCompilerAndStdLib_RequiresNotMatchXXXDefined_1_BWA (invocable<ExtendableProperty<T>*, remove_cvref_t<T>>) S>
128 ExtendableProperty<T>::ExtendableProperty (G getter, S setter)
129 qCompilerAndStdLib_RequiresNotMatchXXXDefined_2_BWA (
requires (convertible_to<invoke_result_t<G,
const ExtendableProperty<T>*>, T>))
133 const ExtendableProperty* thisObj =
static_cast<const ExtendableProperty*
> (property);
135 if constexpr (is_reference_v<base_value_type>) {
136 PropertyReadEventHandlerArgAndReturnValue_ value = &getter (property);
137 for (
const auto& handler : thisObj->fPropertyReadHandlers_) {
138 value = handler (value);
143 base_value_type value = getter (property);
144 for (
const auto& handler : thisObj->fPropertyReadHandlers_) {
145 value = handler (value);
150 [getter, setter] (
auto* property,
const auto& newValue) {
153 ExtendableProperty* thisObj =
static_cast<ExtendableProperty*
> (property);
155 if (not thisObj->fPropertyChangedHandlers_.empty ()) {
156 T prevValue = getter (property);
157 for (
const auto& handler : thisObj->fPropertyChangedHandlers_) {
158 if (handler (PropertyChangedEvent{prevValue, newValue}) ==
159 PropertyCommon::PropertyChangedEventResultType::eSilentlyCutOffProcessing) {
164 setter (property, newValue);
166 , propertyReadHandlers{[qStroika_Foundation_Common_Property_ExtraCaptureStuff] (
167 [[maybe_unused]]
const auto* property) ->
const std::forward_list<PropertyReadEventHandler>& {
169 return thisObj->fPropertyReadHandlers_;
171 , rwPropertyReadHandlers{
172 [qStroika_Foundation_Common_Property_ExtraCaptureStuff] ([[maybe_unused]]
const auto* property) -> std::forward_list<PropertyReadEventHandler>& {
174 qStroika_Foundation_Common_Property_OuterObjPtr (property, &ExtendableProperty::rwPropertyReadHandlers));
175 return thisObj->fPropertyReadHandlers_;
177 [qStroika_Foundation_Common_Property_ExtraCaptureStuff] ([[maybe_unused]]
auto* property,
const auto& handlerList) {
178 ExtendableProperty* thisObj = qStroika_Foundation_Common_Property_OuterObjPtr (property, &ExtendableProperty::rwPropertyReadHandlers);
179 thisObj->fPropertyReadHandlers_ = handlerList;
181 , propertyChangedHandlers{[qStroika_Foundation_Common_Property_ExtraCaptureStuff] (
182 [[maybe_unused]]
const auto* property) ->
const std::forward_list<PropertyChangedEventHandler>& {
184 return thisObj->fPropertyChangedHandlers_;
186 , rwPropertyChangedHandlers{
187 [qStroika_Foundation_Common_Property_ExtraCaptureStuff] ([[maybe_unused]]
const auto* property) -> std::forward_list<PropertyChangedEventHandler>& {
188 ExtendableProperty* thisObj =
const_cast<ExtendableProperty*
> (
189 qStroika_Foundation_Common_Property_OuterObjPtr (property, &ExtendableProperty::rwPropertyChangedHandlers));
190 return thisObj->fPropertyChangedHandlers_;
192 [qStroika_Foundation_Common_Property_ExtraCaptureStuff] ([[maybe_unused]]
auto* property,
const auto& handlerList) {
194 qStroika_Foundation_Common_Property_OuterObjPtr (property, &ExtendableProperty::rwPropertyChangedHandlers);
195 thisObj->fPropertyChangedHandlers_ = handlerList;
199 template <
typename T>
200 inline auto ExtendableProperty<T>::operator= (ArgByValueType<T> value) -> ExtendableProperty&
202 Property<T>::operator= (value);
205 template <
typename T>
206 inline auto ExtendableProperty<T>::operator= (
const ExtendableProperty& value) -> ExtendableProperty&
208 Property<T>::operator= (value);
ExtendableProperty is a Property which has callbacks associated with it, to be notified when it is ac...
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
nonvirtual void operator()(ArgByValueType< T > value)
nonvirtual void Set(ArgByValueType< T > value)
nonvirtual WriteOnlyProperty & operator=(ArgByValueType< T > value)
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.