Kanzi 4.0.0-beta2
kanzi::CompositionStack::StateStack< T > Class Template Reference

Template class for handling state arrays. More...

#include <kanzi/core.ui/graphics/composition_stack.hpp>

Public Member Functions

const TappliedState () const
 Gets the currently applied state.
 
void apply (Renderer &renderer)
 Apply the topmost element.
 
Tback ()
 Access last element.
 
const Tback () const
 Access last element (const version).
 
void clear ()
 Pop all elements from the stack.
 
bool empty () const
 Indicates whether or not the stack is empty.
 
void invalidateState ()
 Invalidate state.
 
void pop ()
 Pop element from the stack.
 
void push (T state)
 Push new element into the stack.
 
 StateStack ()=default
 

Protected Member Functions

bool isLastStackApplied ()
 Indicates whether the last element in the stack has been applied.
 

Protected Attributes

optional< size_t > m_appliedStackIndex
 What stack index has been applied. When no state is applied, this is nullopt.
 
vector< Tm_stack
 Stack for holding.
 

Detailed Description

template<typename T>
class kanzi::CompositionStack::StateStack< T >

Template class for handling state arrays.

Constructor & Destructor Documentation

◆ StateStack()

template<typename T >
kanzi::CompositionStack::StateStack< T >::StateStack ( )
explicitdefault

Member Function Documentation

◆ apply()

template<typename T >
void kanzi::CompositionStack::StateStack< T >::apply ( Renderer & renderer)
inline

Apply the topmost element.

If no elements present, apply default 2D rendering state.

◆ back() [1/2]

template<typename T >
T & kanzi::CompositionStack::StateStack< T >::back ( )
inline

Access last element.

Returns
Reference to back of the stack.

◆ back() [2/2]

template<typename T >
const T & kanzi::CompositionStack::StateStack< T >::back ( ) const
inline

Access last element (const version).

Returns
Reference to back of the stack.

◆ empty()

template<typename T >
bool kanzi::CompositionStack::StateStack< T >::empty ( ) const
inline

Indicates whether or not the stack is empty.

Returns
If the stack is empty true, false otherwise.

◆ invalidateState()

template<typename T >
void kanzi::CompositionStack::StateStack< T >::invalidateState ( )
inline

Invalidate state.

Only be used when stack applies some other state than any of the default states.

◆ push()

template<typename T >
void kanzi::CompositionStack::StateStack< T >::push ( T state)
inline

Push new element into the stack.

Parameters
stateState to push.

◆ pop()

template<typename T >
void kanzi::CompositionStack::StateStack< T >::pop ( )
inline

Pop element from the stack.

◆ clear()

template<typename T >
void kanzi::CompositionStack::StateStack< T >::clear ( )
inline

Pop all elements from the stack.

Since
Kanzi 4.0.0

◆ appliedState()

template<typename T >
const T * kanzi::CompositionStack::StateStack< T >::appliedState ( ) const
inline

Gets the currently applied state.

Both default states and empty stack return nullptr.

Returns
The currently applied state or nullptr.

◆ isLastStackApplied()

template<typename T >
bool kanzi::CompositionStack::StateStack< T >::isLastStackApplied ( )
inlineprotected

Indicates whether the last element in the stack has been applied.

Returns
If the last element is applied true, false otherwise.

Member Data Documentation

◆ m_stack

template<typename T >
vector<T> kanzi::CompositionStack::StateStack< T >::m_stack
protected

Stack for holding.

◆ m_appliedStackIndex

template<typename T >
optional<size_t> kanzi::CompositionStack::StateStack< T >::m_appliedStackIndex
protected

What stack index has been applied. When no state is applied, this is nullopt.


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