Lumiera  0.pre.03
»edit your freedom«
TextTemplate::InstanceCore< SRC > Class Template Reference

Description

template<class SRC>
class TextTemplate::InstanceCore< SRC >

Iterator »State Core« to process the template instantiation.

Definition at line 344 of file text-template.hpp.

Public Member Functions

 InstanceCore (ActionSeq const &actions, SRC)
 
bool checkPoint () const
 TextTemplate instantiation: check point on rendered Action. More...
 
bool conditional (string key)
 retrieve a data value for the key and interpret it as boolean expression
 
void focusNested ()
 Step down into the innermost data item context, prepared at the top of #ctxStack_. More...
 
Value getContent (string key)
 retrieve a data value from the data source for the indiated key
 
Value instantiateNext ()
 Instantiate next Action token and expose its rendering.
 
void iterNext ()
 
bool loopFurther ()
 Possibly continue the iteration within an already established nested scope. More...
 
bool openIteration (string key)
 Attempt to open data sequence by evaluating the entrance key. More...
 
Value reInstatiate (Idx=Idx(-1))
 relocate to another Action token and continue instantiation there More...
 
auto & yield () const
 

Private Types

using ActionIter = IndexIter< const ActionSeq >
 
using CtxStack = std::stack< NestedCtx, std::vector< NestedCtx > >
 
using DataCtxIter = typename SRC::Iter
 
using NestedCtx = std::pair< DataCtxIter, SRC >
 
using Value = typename SRC::Value
 

Private Attributes

ActionIter actionIter_
 
CtxStack ctxStack_
 
SRC dataSrc_
 
Value rendered_
 

Member Function Documentation

◆ checkPoint()

bool checkPoint ( ) const
inline

TextTemplate instantiation: check point on rendered Action.

In active operation, there is a further Action, and this action can be (or has already been) rendered successfully.

Definition at line 806 of file text-template.hpp.

◆ reInstatiate()

SRC::Value reInstatiate ( Idx  nextCode = Idx(-1))
inline

relocate to another Action token and continue instantiation there

Parameters
nextCodeindex number of the next token; when not given, then iterate one step ahead
Returns
the rendering produced by the selected next Action token

Definition at line 844 of file text-template.hpp.

Referenced by TextTemplate::Action::instantiate().

+ Here is the caller graph for this function:

◆ openIteration()

bool openIteration ( string  key)
inline

Attempt to open data sequence by evaluating the entrance key.

Data is retrieved for the key and evaluated to produce a collection of data entities to be iterated; each of these will be handled as a data scope nested into the current data scope. This implies to push a #NestedCtx into the #ctxStack_, store aside the current data source and replace it with the new data source for the nested scope. If iteration can not be initiated, all of the initialisation is reverted and the previous scope is reinstated.

Returns
true if the nested context exists and the first element is available, false if iteration is not possible and the original context was restored

Definition at line 883 of file text-template.hpp.

Referenced by TextTemplate::Action::instantiate().

+ Here is the caller graph for this function:

◆ loopFurther()

bool loopFurther ( )
inline

Possibly continue the iteration within an already established nested scope.

If iteration to the next element is possible, it is expanded into the nested scope, else, when reaching iteration end, the enclosing scope is reinstated

Returns
true if the next iterated element is available, false after iteration end

Definition at line 904 of file text-template.hpp.

◆ focusNested()

void focusNested ( )
inline

Step down into the innermost data item context, prepared at the top of #ctxStack_.

This includes re-assigning the current #dataSrc_ to a new nested data scope, created from the enclosing scope, which is assumed to sit at the top of ctxStack_, and which is guaranteed to rest locked at this memory location as long as operation is carried on within the new nested context. This is to say that a pointer to the parent scope (residing at ctxStack_.top()) can be embedded and used from this nested context safely. To leave this nested scope, it is sufficient to swap this->dataSrc_ with the stack top and then pop the topmost frame.

Definition at line 934 of file text-template.hpp.

+ Collaboration diagram for TextTemplate::InstanceCore< SRC >:

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