104 #ifndef LIB_DIFF_TREE_MUTATOR_ATTRIBUTE_BINDING_H 105 #define LIB_DIFF_TREE_MUTATOR_ATTRIBUTE_BINDING_H 142 : PAR(std::forward<PAR>(chain))
143 , attribID_(attribID)
156 return spec.isNamed()
157 and attribID_ == spec.idi;
163 if (this->isApplicable(spec))
165 "but this binding for '%s' is linked to a data field and " 166 "thus does not support any notion of 'order' or 'position', " 167 "inserting or deletion."}
168 % oper % spec.idi % this->attribID_);
182 return isApplicable (spec)
183 or PAR::matchSrc (spec);
194 return isApplicable (spec)
195 or PAR::acceptSrc (spec);
207 __ifApplicable_refuse_to (
"skip or drop", refSpec);
208 PAR::skipSrc (refSpec);
212 findSrc (
GenNode const& refSpec)
override 214 __ifApplicable_refuse_to (
"re-order", refSpec);
215 return PAR::findSrc (refSpec);
231 return PAR::accept_until(spec);
234 __ifApplicable_refuse_to (
"navigate to a position behind", spec);
235 return PAR::accept_until(spec);
243 template<
class PAR,
class CLO>
273 if (not this->isApplicable(spec))
274 return PAR::injectNew(spec);
276 setter_(spec.data.get<ValueType>());
284 if (not this->isApplicable(spec))
285 return PAR::assignElm(spec);
287 setter_(spec.data.get<ValueType>());
294 template<
class PAR,
class MUT>
307 , mutatorBuilder_(clo)
317 if (not this->isApplicable(spec))
318 return PAR::mutateChild(spec, targetBuff);
320 mutatorBuilder_(targetBuff);
343 return this->isApplicable(spec)
344 or PAR::injectNew(spec);
352 template<
typename CLO>
354 Builder<PAR>::change (
Symbol attributeID, CLO setterClosure)
356 return chainedBuilder<ChangeOperation<PAR,CLO>> (attributeID, setterClosure);
362 template<
typename CLO>
364 Builder<PAR>::mutateAttrib (
Symbol attributeID, CLO mutatorBuilderClosure)
367 return chainedBuilder<MutationOperation<PAR,CLO>> (key, mutatorBuilderClosure);
372 template<
typename CLO>
374 Builder<PAR>::mutateAttrib (
idi::BareEntryID const& rawID, CLO mutatorBuilderClosure)
376 return chainedBuilder<MutationOperation<PAR,CLO>> (rawID, mutatorBuilderClosure);
type erased baseclass for building a combined hash and symbolic ID.
#define ASSERT_VALID_SIGNATURE(_FUN_, _SIG_)
Macro for a compile-time check to verify the given generic functors or lambdas expose some expected s...
virtual bool matchSrc(GenNode const &spec) override
ensure the given spec is deemed appropriate at that point.
inline string literal This is a marker type to indicate that
typed symbolic and hash ID for asset-like position accounting.
virtual bool acceptSrc(GenNode const &spec) override
accept status quo, after verifying the spec from the diff verb
A front-end for using printf-style formatting.
Implementation namespace for support and library code.
Derived specific exceptions within Lumiera's exception hierarchy.
Token or Atom with distinct identity.
A handle to allow for safe »remote implantation« of an unknown subclass into a given opaque InPlaceBu...
static const Ref END
symbolic ID ref "_END_"
virtual bool mutateChild(GenNode const &spec, TreeMutator::Handle targetBuff) override
if this binding layer is in charge, then invoke the closure, which is assumed to construct a nested T...
Marker types to indicate a literal string and a Symbol.
bool isApplicable(GenNode const &spec)
hard wired "selector predicate" for this binding layer.
virtual bool assignElm(GenNode const &spec) override
invoke the setter lambda, when this binding layer is in charge
virtual bool accept_until(GenNode const &spec) override
there is no real support for navigating to a 'position', since attribute / data field binding has no ...
virtual void skipSrc(GenNode const &refSpec) override
any reordering or deletion of object fields is prohibited
Generic building block for tree shaped (meta)data structures.
virtual bool injectNew(GenNode const &spec) override
while, strictly speaking, one can not "insert" fields into a given class definition, this binding can tolerate an INS verb whenever this means to touch a field which is actually known and present in the class definition underlying this binding.
Lumiera error handling (C++ interface).
static const Ref ATTRIBS
symbolic ID ref "_ATTRIBS_"
Customisable intermediary to abstract generic tree mutation operations.
Bare symbolic and hash ID used for accounting of asset like entries.
Generic behaviour of any binding to object fields (attributes).
virtual bool injectNew(GenNode const &spec) override
default setup: silently absorb insert.
generic data element node within a tree