Lumiera  0.pre.03
»edit your freedom«
Record< VAL >::Mutator Class Reference

Description

template<typename VAL>
class lib::diff::Record< VAL >::Mutator

Definition at line 408 of file record.hpp.

Public Types

using BufferHandle = PlantingHandle< TreeMutator, TreeMutator >
 

Public Member Functions

 Mutator (Rec const &startingPoint)
 
 Mutator (Rec &&startingPoint)
 
VAL const & accessLast ()
 get the tail element. More...
 
Mutator && appendAttrib (VAL const &newAttrib)
 
Mutator && appendChild (VAL const &newChild)
 
template<typename X , typename... ARGS>
Mutator && attrib (string const &key, X &&initialiser, ARGS &&...args)
 
Mutator && attrib ()
 
template<>
void buildMutator (BufferHandle buff)
 
void buildMutator (BufferHandle)
 attachment point to receive and apply tree-diff changes. More...
 
bool empty () const
 
auto exposeToDiff ()
 
VAL genNode ()
 
VAL genNode (idi::BareEntryID rawID)
 
VAL genNode (string const &symbolicID)
 
 operator Rec & ()
 
Mutator && prependChild (VAL const &newChild)
 
template<typename X , typename... ARGS>
Mutator && scope (X const &initialiser, ARGS &&...args)
 
Mutator && scope ()
 
template<typename X >
Mutator && set (string const &key, X &&content)
 
Mutator && set (VAL &&attribute)
 
void setType (string const &newTypeID)
 
void swap (Rec &existingInstance) noexcept
 
Mutator && type (string const &typeID)
 

Private Types

using Rec = Record< VAL >
 

Private Attributes

Rec record_
 

Additional Inherited Members

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

Member Function Documentation

◆ buildMutator() [1/2]

void buildMutator ( BufferHandle  )

attachment point to receive and apply tree-diff changes.

implementation is provided by the "diff framework"

The actual implementation needs to be provided for concrete Record payload types; in case of Record<GenNode>, a default implementation for this feature is provided by the "diff framework", which offers a preconfigured binding to create a TreeMutator implementation, which can then be used for a DiffApplicator. This way, a Rec::Mutator can receive diff messages to reorder and reshape the contents.

Parameters
BufferHandlepointing to an (implementation provided) storage location, where this function is expected to construct a suitable TreeMutator, linked to the internals of this Record::Mutator.
See also
lib::diff::mutatorBinding()
lib::diff::DiffApplicationStrategy
tree-diff-application.hpp
DiffTreeApplication_test usage example
tree-mutator-gen-node-binding.hpp
tree-diff.cpp (implementation)

◆ accessLast()

VAL const& accessLast ( )
inline

get the tail element.

Returns
either the last child, or the last attribute, when children are empty.
Note
typically this might be used to get back at the element "just added", as when muting a child node in diff application. But there is a loophole: we might have added an attribute even when there are already children.

Definition at line 547 of file record.hpp.

◆ buildMutator() [2/2]

void buildMutator ( BufferHandle  buff)

possibly recursive invocation to build a TreeMutator binding to an "object" / scope /child node. This function is invoked when creating a DiffApplicator<Rec::Mutator>, and it is then invoked recursively, when the top level TreeMutator enters a nested scope (child node).

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

References TreeMutator::build(), and PlantingHandle< BA, DEFAULT >::emplace().

+ Here is the call graph for this function:
+ Inheritance diagram for Record< VAL >::Mutator:
+ Collaboration diagram for Record< VAL >::Mutator:

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