Lumiera
0.pre.03
»edit your freedom«
|
#include "lib/diff/tree-mutator.hpp"
Builder-DSL to create and configure a concrete TreeMutator.
Definition at line 122 of file tree-mutator.hpp.
Public Member Functions | |
Builder (PAR &&par) | |
template<typename BIN > | |
auto | attach (BIN &&collectionBindingSetup) |
set up a binding to a structure of "child objects", implemented through a typical STL container More... | |
auto | attach (Rec::Mutator &targetTree) |
set up binding to a GenNode tree: Special setup to build a concrete TreeMutator . More... | |
auto | attachDummy (TestMutationTarget &dummy) |
set up a diagnostic layer, binding to TestMutationTarget. More... | |
template<typename BIN , typename... ARGS> | |
Builder< BIN > | chainedBuilder (ARGS &&...args) |
template<typename CLO > | |
auto | change (Symbol attributeID, CLO setterClosure) |
set up a binding to represent an "attribute" through a data or object field. More... | |
auto | ignoreAllChanges () |
set up a catch-all and ignore-everything layer | |
template<typename CLO > | |
auto | mutateAttrib (Symbol attributeID, CLO mutatorBuilderClosure) |
set up a binding for an object valued "attribute" or named scope. More... | |
template<typename CLO > | |
auto | mutateAttrib (idi::BareEntryID const &rawID, CLO mutatorBuilderClosure) |
template<typename LIS > | |
auto | onLocalChange (LIS changeListener) |
attach a listener function, to be invoked on any local change. This includes the structural changes, but also value assignments to any attribute or element. More... | |
template<typename LIS > | |
auto | onSeqChange (LIS changeListener) |
attach a listener function, to be invoked on structural changes. Here, we define any change as "structural", which alters the sequence of child elements, as opposed to their content. More... | |
auto change | ( | Symbol | attributeID, |
CLO | setterClosure | ||
) |
set up a binding to represent an "attribute" through a data or object field.
This binding will allow to apply basic diff operations, but no re-ordering or deletion. Rationale is the fixed nature of a class definition, which does not support any notion of ordering, or adding and removal of members.
attributeID | symbolic key to denote this "attribute" |
setterClosure | functor or lambda to apply a new value |
auto mutateAttrib | ( | Symbol | attributeID, |
CLO | mutatorBuilderClosure | ||
) |
set up a binding for an object valued "attribute" or named scope.
This covers the rather special case, where some relevant sub object is accessed as a (named) property of a managing parent object. On implementation level, this corresponds to using a getter to access a subcomponent or "PImpl". On a formal level, for tree diff handling, such counts as attribute, yet with the special twist that we can not just assign a new "value", but rather have to enter a sub scope and handle a nested diff – similar to how nested child objects are dealt with in general. Thus, all we need here is a way how to build a nested TreeMutator for this sub-scope.
attributeID | symbolic key to denote this "attribute" |
mutatorBuilderClosure | functor or lambda to emplace a custom sub TreeMutator into the given buffer (handle). Such a nested mutator shall be wired internally to the object representation of the attribute in question. |
auto mutateAttrib | ( | idi::BareEntryID const & | rawID, |
CLO | mutatorBuilderClosure | ||
) |
rawID | the explicitly given ID of an attribute object, used literally to match the attribute in question |
auto attach | ( | BIN && | collectionBindingSetup | ) |
set up a binding to a structure of "child objects", implemented through a typical STL container
collectionBindingSetup | as created by invoking a nested DSL, initiated by a builder function collection(implRef) , where implRef is a (language) reference to a STL compliant container existing somewhere within the otherwise opaque implementation. The type of the container and thus the type of the elements will be picked up, and the returned builder can be further outfitted with the builder methods, which take lambdas as callback into the implementation.
|
after(Ref::ATTRIBS)
verb can only processed if the selector responds correct to a Ref::ATTRIBS spec. The implicit default selector does so, i.e. it rejects Ref::ATTRIBS
. Please be sure to accept this token only if your layer indeed holds something meant to implement "attributes", because in that case, the verb after(Ref::ATTRIBS)
will fast forward and accept all the current contents of this layer auto attach | ( | Rec::Mutator & | targetTree | ) |
set up binding to a GenNode tree: Special setup to build a concrete TreeMutator
.
This decorator is already outfitted with the necessary closures to work on a diff::Record<GenNode> – which is typically used as "meta representation" of object-like structures. Thus this binding allows to apply a MutationMessage onto such a given »External Tree Description«, mutating it into new shape.
auto attachDummy | ( | TestMutationTarget & | dummy | ) |
set up a diagnostic layer, binding to TestMutationTarget.
This can be used to monitor the behaviour of the resulting TreeMutator for tests.
Definition at line 530 of file test-mutation-target.hpp.
auto onSeqChange | ( | LIS | changeListener | ) |
attach a listener function, to be invoked on structural changes. Here, we define any change as "structural", which alters the sequence of child elements, as opposed to their content.
In practice, this listener will be invoked after applying a diff with any INS
, DEL
, FIND
, SKIP
verb.
auto onLocalChange | ( | LIS | changeListener | ) |
attach a listener function, to be invoked on any local change. This includes the structural changes, but also value assignments to any attribute or element.