95 #ifndef LIB_DIFF_TREE_MUTATOR_ATTRIBUTE_BINDING_H 96 #define LIB_DIFF_TREE_MUTATOR_ATTRIBUTE_BINDING_H 133 : PAR(std::forward<PAR>(chain))
134 , attribID_(attribID)
147 return spec.isNamed()
148 and attribID_ == spec.idi;
154 if (this->isApplicable(spec))
156 "but this binding for '%s' is linked to a data field and " 157 "thus does not support any notion of 'order' or 'position', " 158 "inserting or deletion."}
159 % oper % spec.idi % this->attribID_);
173 return isApplicable (spec)
174 or PAR::matchSrc (spec);
185 return isApplicable (spec)
186 or PAR::acceptSrc (spec);
198 __ifApplicable_refuse_to (
"skip or drop", refSpec);
199 PAR::skipSrc (refSpec);
203 findSrc (
GenNode const& refSpec)
override 205 __ifApplicable_refuse_to (
"re-order", refSpec);
206 return PAR::findSrc (refSpec);
222 return PAR::accept_until(spec);
225 __ifApplicable_refuse_to (
"navigate to a position behind", spec);
226 return PAR::accept_until(spec);
234 template<
class PAR,
class CLO>
264 if (not this->isApplicable(spec))
265 return PAR::injectNew(spec);
267 setter_(spec.data.get<ValueType>());
275 if (not this->isApplicable(spec))
276 return PAR::assignElm(spec);
278 setter_(spec.data.get<ValueType>());
285 template<
class PAR,
class MUT>
298 , mutatorBuilder_(clo)
308 if (not this->isApplicable(spec))
309 return PAR::mutateChild(spec, targetBuff);
311 mutatorBuilder_(targetBuff);
334 return this->isApplicable(spec)
335 or PAR::injectNew(spec);
343 template<
typename CLO>
345 Builder<PAR>::change (
Symbol attributeID, CLO setterClosure)
347 return chainedBuilder<ChangeOperation<PAR,CLO>> (attributeID, setterClosure);
353 template<
typename CLO>
355 Builder<PAR>::mutateAttrib (
Symbol attributeID, CLO mutatorBuilderClosure)
358 return chainedBuilder<MutationOperation<PAR,CLO>> (key, mutatorBuilderClosure);
363 template<
typename CLO>
365 Builder<PAR>::mutateAttrib (
idi::BareEntryID const& rawID, CLO mutatorBuilderClosure)
367 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