Lumiera 0.pre.04~rc.1
»edit your freedom«
Loading...
Searching...
No Matches
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 306 of file tree-mutator-collection-binding.hpp.

Public Member Functions

 ChildCollectionMutator (BIN &&wiringClosures, PAR &&chain)
 
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 hasSrc () override
 
virtual bool matchSrc (GenNode const &spec) override
 ensure the next recorded source element matches on a formal level with given spec
 
virtual void skipSrc (GenNode const &n) override
 skip next pending src element, causing this element to be discarded
 
virtual bool acceptSrc (GenNode const &n) override
 accept existing element, when matching the given spec
 
virtual bool findSrc (GenNode const &refSpec) override
 locate designated element and accept it at current position
 
virtual bool accept_until (GenNode const &spec) override
 repeatedly accept, until after the designated location
 
virtual bool assignElm (GenNode const &spec) override
 locate element already accepted into the target sequence and assign the designated payload value to it.
 
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.
 
virtual bool completeScope () override
 verify all our pending (old) source elements where mentioned.
 

Private Types

using Iter = BIN::iterator
 

Private Attributes

BIN binding_
 
Iter pos_
 

Constructor & Destructor Documentation

◆ ChildCollectionMutator()

template<class PAR , class BIN >
ChildCollectionMutator ( BIN &&  wiringClosures,
PAR &&  chain 
)
inline

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

Member Typedef Documentation

◆ Iter

template<class PAR , class BIN >
using Iter = BIN::iterator
private

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

Member Function Documentation

◆ init()

template<class PAR , class BIN >
virtual void init ( )
inlineoverridevirtual

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

◆ injectNew()

template<class PAR , class BIN >
virtual bool injectNew ( GenNode const &  n)
inlineoverridevirtual

fabricate a new element, based on the given specification (GenNode), and insert it at current position into the target sequence.

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

◆ hasSrc()

template<class PAR , class BIN >
virtual bool hasSrc ( )
inlineoverridevirtual

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

◆ matchSrc()

template<class PAR , class BIN >
virtual bool matchSrc ( GenNode const &  spec)
inlineoverridevirtual

ensure the next recorded source element matches on a formal level with given spec

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

◆ skipSrc()

template<class PAR , class BIN >
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 373 of file tree-mutator-collection-binding.hpp.

◆ acceptSrc()

template<class PAR , class BIN >
virtual bool acceptSrc ( GenNode const &  n)
inlineoverridevirtual

accept existing element, when matching the given spec

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

◆ findSrc()

template<class PAR , class BIN >
virtual bool findSrc ( GenNode const &  refSpec)
inlineoverridevirtual

locate designated element and accept it at current position

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

◆ accept_until()

template<class PAR , class BIN >
virtual bool accept_until ( GenNode const &  spec)
inlineoverridevirtual

repeatedly accept, until after the designated location

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

References GenNode::matches().

+ Here is the call graph for this function:

◆ assignElm()

template<class PAR , class BIN >
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 456 of file tree-mutator-collection-binding.hpp.

◆ mutateChild()

template<class PAR , class BIN >
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 480 of file tree-mutator-collection-binding.hpp.

References GenNode::idi.

◆ completeScope()

template<class PAR , class BIN >
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 494 of file tree-mutator-collection-binding.hpp.

Member Data Documentation

◆ binding_

template<class PAR , class BIN >
BIN binding_
private

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

◆ pos_

template<class PAR , class BIN >
Iter pos_
private

Definition at line 312 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: