supply implementation, basically working already
so this test case is more or less finished, just needs some more polishing and documentation
This commit is contained in:
parent
20c6116732
commit
b5ab5df929
4 changed files with 55 additions and 5 deletions
|
|
@ -385,6 +385,9 @@ namespace diff{
|
|||
template<class CLO>
|
||||
using Change = ChangeOperation<PAR,CLO>;
|
||||
|
||||
template<class CLO>
|
||||
using MutateAttrib = MutationOperation<PAR,CLO>;
|
||||
|
||||
template<class BIN>
|
||||
using Collection = ChildCollectionMutator<PAR,BIN>;
|
||||
|
||||
|
|
@ -419,6 +422,17 @@ namespace diff{
|
|||
return Change<CLO> (attributeID, setterClosure, move(*this));
|
||||
}
|
||||
|
||||
///////////////////////////////////////TODO documentation
|
||||
template<typename CLO>
|
||||
Builder<MutateAttrib<CLO>>
|
||||
mutateAttrib (Symbol attributeID, CLO mutatorBuilderClosure)
|
||||
{
|
||||
idi::EntryID<Rec> key{attributeID};
|
||||
return MutateAttrib<CLO> (key, mutatorBuilderClosure, move(*this));
|
||||
}
|
||||
|
||||
///////////////////////////////////////TODO define variant taking a GenNode::ID
|
||||
|
||||
/** set up a binding to a structure of "child objects",
|
||||
* implemented through a typical STL container
|
||||
* @param collectionBindingSetup as created by invoking a nested DSL,
|
||||
|
|
|
|||
|
|
@ -833,6 +833,19 @@ namespace test{
|
|||
{
|
||||
LOG_SETTER ("gamma")
|
||||
gamma = val;
|
||||
})
|
||||
.mutateAttrib("δ", [&](TreeMutator::MutatorBuffer buff)
|
||||
{
|
||||
// NOTE: we use "implementation inside knowledge" regarding the nested scope,
|
||||
// which is here represented as TestMutationTarget
|
||||
buff.create (
|
||||
TreeMutator::build()
|
||||
.attachDummy (delta));
|
||||
|
||||
// NOTE: when this closure is invoked, we're about to open the sub scope,
|
||||
// while mutation has not happened yet
|
||||
cout << "openSub()...\n"
|
||||
<< join(delta.getLog(), "\n") <<endl;
|
||||
});
|
||||
|
||||
#if false /////////////////////////////////////////////////////////////////////////////////////////////////////////////UNIMPLEMENTED :: TICKET #992
|
||||
|
|
@ -871,6 +884,7 @@ namespace test{
|
|||
// It is implemented as `TestMutationTarget delta`, which allows us to verify a fully operational nested mutator.
|
||||
|
||||
const size_t BUFF_SIZ = sizeof(TreeMutator::build().attachDummy (delta));
|
||||
// just use some suitable size, not the point in focus for this test
|
||||
|
||||
InPlaceBuffer<TreeMutator, BUFF_SIZ> subMutatorBuffer;
|
||||
TreeMutator::MutatorBuffer placementHandle(subMutatorBuffer);
|
||||
|
|
@ -889,7 +903,9 @@ namespace test{
|
|||
|
||||
CHECK (not isnil (delta)); // ...and "magically" these instructions happened to insert
|
||||
cout << "Sub|" << delta.showContent() <<endl; // some new content into our implementation defined sub scope!
|
||||
cout << delta <<endl;
|
||||
cout << "____Mutation-Log(nested)______\n"
|
||||
<< join(delta.getLog(), "\n")
|
||||
<< "\n───╼━━━━━━━━━╾────────────────"<<endl;
|
||||
|
||||
// verify contents of nested scope after mutation
|
||||
CHECK (delta.showContent() == "type = ξ, β = 2, b, a");
|
||||
|
|
|
|||
|
|
@ -8214,7 +8214,7 @@ On receiving the terms of this "diff language", it is possible to gene
|
|||
i.e. a ''unified diff'' or the ''predicate notation'' used above to describe the list diffing algorithm, just by accumulating changes.
|
||||
</pre>
|
||||
</div>
|
||||
<div title="TreeMutator" creator="Ichthyostega" modifier="Ichthyostega" created="201503292115" modified="201606041215" tags="Model Concepts GuiPattern design draft" changecount="86">
|
||||
<div title="TreeMutator" creator="Ichthyostega" modifier="Ichthyostega" created="201503292115" modified="201606051455" tags="Model Concepts GuiPattern design draft" changecount="87">
|
||||
<pre>The TreeMutator is an intermediary to translate a generic structure pattern into heterogeneous local invocation sequences.
|
||||
within the [[diff framework|TreeDiffModel]], this is a crucial joint, since here the abstract, generic, ~DOM-like ExternalTreeDescription meeds opaque, local and undisclosed data structures.
|
||||
|
||||
|
|
@ -8341,13 +8341,13 @@ attached to a clip, or the mixture of clips, effects and labels found within a [
|
|||
:any re-ordering, inserting and deleting of fields is ''prohibited'', while defaultable optional fields are tolerated
|
||||
:there is only one common »binding layer« for object fields (i.e. we don't offer a customisable selector)
|
||||
:binding is created ''alternatively'' through the following closures
|
||||
:* "key", lambda {{{change: void(T val)}}}
|
||||
:* ''change'': "key", setter lambda {{{void(T val)}}}
|
||||
:** binding for a regular setter to assign a new value
|
||||
:** the value type is picked up from the provided lambda
|
||||
:** possible value types are restricted to the selection of GenNode payload types
|
||||
:** any further type conversions are to be handled by the closure and thus the client code
|
||||
:* "key", lambda {{{mutateAttrib: void(TreeMutator::MutatorBuffer)}}}
|
||||
:** fabricate a recursive sub-TreeMutator to handle an "object valued" attribute
|
||||
:* ''mutateAttrib'': "key", mutator-builder lambda {{{void(TreeMutator::MutatorBuffer)}}}
|
||||
:** fabricate a recursive sub-TreeMutator to handle an //object valued// attribute
|
||||
:** implicit typing -- the fabricated sub-TreeMutator just needs to be able to deal with the bound attribute
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -4173,6 +4173,26 @@
|
|||
</richcontent>
|
||||
<icon BUILTIN="idea"/>
|
||||
</node>
|
||||
<node CREATED="1465139405203" ID="ID_103737978" MODIFIED="1465139492329" TEXT="...hey, der Typ ist implizit klar! es ist immer Rec">
|
||||
<richcontent TYPE="NOTE"><html>
|
||||
<head>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<p>
|
||||
...die offensichtlichsten Dinge übersieht man nur zu leicht!!!!!
|
||||
</p>
|
||||
<p>
|
||||
Da es ein nested scope ist, ist es immer ein Objekt,
|
||||
</p>
|
||||
<p>
|
||||
also repräsentiert als Rec<GenNode>
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
</richcontent>
|
||||
<icon BUILTIN="idea"/>
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
|
|
|
|||
Loading…
Reference in a new issue