Lumiera  0.pre.03
»edit your freedom«
ChildCollectionMutator< PAR, BIN > Class Template Reference

#include "lib/diff/tree-mutator-collection-binding.hpp"

Description

template<class PAR, class BIN>
class lib::diff::anonymous_namespace{tree-mutator-collection-binding.hpp}::ChildCollectionMutator< PAR, BIN >

Attach to collection: Building block for a concrete TreeMutator.

This decorator will be outfitted with actual binding and closures and then layered on top of the (TreeMutator) base. The resulting compound is able to consume tree diff messages and apply the respective changes and mutations to an otherwise opaque implementation data structure.

Remarks
in practice, this is the most relevant and typical TreeMutator setup.
Template Parameters
PARbase implementation TreeMutator; anything not implemented within this current "onion layer", is delegated down to the parent. This way, a complete TreeMutator implementation is assembled from several layers.
BINbinding adapter to the actual target collection. This implementation of TreeMutator operations does not directly manipulate the attached collection, but rather uses the primitive operation building blocks provided through the binding; typically these building blocks are in fact lambdas, provided when setting up this binding to the target.

Definition at line 315 of file tree-mutator-collection-binding.hpp.

Public Member Functions

 ChildCollectionMutator (BIN &&wiringClosures, PAR &&chain)
 
virtual bool accept_until (GenNode const &spec) override
 repeatedly accept, until after the designated location
 
virtual bool acceptSrc (GenNode const &n) override
 accept existing element, when matching the given spec
 
virtual bool assignElm (GenNode const &spec) override
 locate element already accepted into the target sequence and assign the designated payload value to it. More...
 
virtual bool completeScope () override
 verify all our pending (old) source elements where mentioned. More...
 
virtual bool findSrc (GenNode const &refSpec) override
 locate designated element and accept it at current position
 
virtual bool hasSrc () override
 
virtual void init () override
 
virtual bool injectNew (GenNode const &n) override
 fabricate a new element, based on the given specification (GenNode), and insert it at current position into the target sequence.
 
virtual bool matchSrc (GenNode const &spec) override
 ensure the next recorded source element matches on a formal level with given spec
 
virtual bool mutateChild (GenNode const &spec, TreeMutator::Handle targetBuff) override
 locate the designated target element and build a suitable sub-mutator for this element into the provided target buffer. More...
 
virtual void skipSrc (GenNode const &n) override
 skip next pending src element, causing this element to be discarded More...
 

Private Types

using Iter = typename BIN::iterator
 

Private Attributes

BIN binding_
 
Iter pos_
 

Member Function Documentation

◆ skipSrc()

virtual void skipSrc ( GenNode const &  n)
inlineoverridevirtual

skip next pending src element, causing this element to be discarded

Note
can not perform a match on garbage data

Definition at line 382 of file tree-mutator-collection-binding.hpp.

◆ assignElm()

virtual bool assignElm ( GenNode const &  spec)
inlineoverridevirtual

locate element already accepted into the target sequence and assign the designated payload value to it.

Definition at line 465 of file tree-mutator-collection-binding.hpp.

◆ mutateChild()

virtual bool mutateChild ( GenNode const &  spec,
TreeMutator::Handle  targetBuff 
)
inlineoverridevirtual

locate the designated target element and build a suitable sub-mutator for this element into the provided target buffer.

Remarks
basically we just delegate the implementation to the lambda provided as "mutator" MUT to the CollectionBinding instance, which in turn was created by the TreeMutator builder-DSL. However, in practice, the most relevant implementation will be the default implementation, which recursively forwards this invocation again to the DiffMutable::buildMutator() virtual function, which then is implemented on each actual "diff mutable" UI-Element. This default implementation can be found in tree-mutator-diffmutable-binding.cpp, within the struct _DefaultBinding (at the bottom of the file). Typically the concrete implementation will invoke targetBuff.emplant( TreeMutator::build() ...)
See also
stage::timeline::TimelineController::buildMutator (TreeMutator::Handle)

Definition at line 489 of file tree-mutator-collection-binding.hpp.

◆ completeScope()

virtual bool completeScope ( )
inlineoverridevirtual

verify all our pending (old) source elements where mentioned.

Note
allows chained "onion-layers" to clean-up and verify.

Definition at line 503 of file tree-mutator-collection-binding.hpp.

+ Inheritance diagram for ChildCollectionMutator< PAR, BIN >:
+ Collaboration diagram for ChildCollectionMutator< PAR, BIN >:

The documentation for this class was generated from the following file: