Lumiera  0.pre.03
»edit your freedom«
TreeMutator Class Reference

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

Description

Customisable intermediary to abstract mutating operations on arbitrary, hierarchical object-like data.

The TreeMutator exposes two distinct interfaces

  • the operation API – similar to what a container exposes – is the entirety of abstract operations that can be performed on the subsumed, tree like target structure
  • the binding API allows to link some or all of these generic activities to concrete manipulations known within target scope.

Definition at line 145 of file tree-mutator.hpp.

Public Types

using Handle = PlantingHandle< TreeMutator >
 

Public Member Functions

 TreeMutator (TreeMutator &&)=default
 
virtual ~TreeMutator ()
 this is an interface More...
 
virtual bool accept_until (GenNode const &spec)
 repeatedly accept, until after the designated location
 
virtual bool acceptSrc (GenNode const &)
 accept existing element, when matching the given spec
 
virtual bool assignElm (GenNode const &)
 locate the designated target element (must be already accepted into the target sequence). More...
 
virtual bool completeScope ()
 ensure the scope addressed by this TreeMutator was processed and exhausted without mismatch More...
 
virtual bool findSrc (GenNode const &)
 locate designated element and accept it at current position
 
virtual bool hasSrc ()
 
virtual void init ()
 initialisation immediately before start of diff application More...
 
virtual bool injectNew (GenNode const &)
 establish new element at current position More...
 
virtual bool matchSrc (GenNode const &)
 ensure the next source element matches with given spec
 
virtual bool mutateChild (GenNode const &, Handle)
 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 &)
 skip next src element and advance abstract source position. More...
 

Static Public Member Functions

static Builder< TreeMutatorbuild ()
 DSL: start building a custom adapted tree mutator, where the operations are tied by closures or wrappers into the current implementation context.
 

Additional Inherited Members

- Private Member Functions inherited from MoveOnly
 MoveOnly (MoveOnly &&)=default
 
 MoveOnly (MoveOnly const &)=delete
 
MoveOnlyoperator= (MoveOnly &&)=delete
 
MoveOnlyoperator= (MoveOnly const &)=delete
 

Constructor & Destructor Documentation

◆ ~TreeMutator()

~TreeMutator ( )
virtual

this is an interface

emit VTables here...

Definition at line 51 of file tree-diff.cpp.

Member Function Documentation

◆ init()

virtual void init ( )
inlinevirtual

initialisation immediately before start of diff application

Remarks
allows for setup of state which is dependent on memory location, like e.g. iterators. Due to the invocation via Builder DSL, the implementation object may be moved after construction, but prior to invoking this hook

Definition at line 167 of file tree-mutator.hpp.

◆ injectNew()

virtual bool injectNew ( GenNode const &  )
inlinevirtual

establish new element at current position

Returns
true when successfully inserted something

Definition at line 179 of file tree-mutator.hpp.

◆ skipSrc()

virtual void skipSrc ( GenNode const &  )
inlinevirtual

skip next src element and advance abstract source position.

The argument shall be used to determine applicability

Remarks
this operation is used both to implement the del verb and the skip verb. Since the latter discards garbage left back by find we must not touch the contents, to prevent a SEGFAULT. Thus skipSrc can not match and thus can not return anything. Consequently the del implementation has to use matchSrc explicitly, and the latter must invoke the "layer selector" prior to performing the local match.

Definition at line 204 of file tree-mutator.hpp.

◆ assignElm()

virtual bool assignElm ( GenNode const &  )
inlinevirtual

locate the designated target element (must be already accepted into the target sequence).

Perform an assignment with the given payload value

Exceptions
whenassignment fails (typically error::Logic)
Returns
false when unable to locate the target

Definition at line 240 of file tree-mutator.hpp.

◆ mutateChild()

virtual bool mutateChild ( GenNode const &  ,
Handle   
)
inlinevirtual

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

Exceptions
error::Fatalwhen buffer is insufficient
Returns
false when unable to locate the target

Definition at line 255 of file tree-mutator.hpp.

◆ completeScope()

virtual bool completeScope ( )
inlinevirtual

ensure the scope addressed by this TreeMutator was processed and exhausted without mismatch

Returns
true when all "open ends" are closed and no pending work remains to be done.

Definition at line 266 of file tree-mutator.hpp.

+ Inheritance diagram for TreeMutator:
+ Collaboration diagram for TreeMutator:

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