Qt 4.8
Public Functions | Protected Functions | Properties | List of all members
QPatternist::StackContextBase< TSuperClass > Class Template Reference

Base class for all DynamicContext classes that needs to supply variables. It has a new frame for local caches, position iterators, expressions, range variables, template parameters but notably continues to delegate global caches. More...

#include <qstackcontextbase_p.h>

Inheritance diagram for QPatternist::StackContextBase< TSuperClass >:

Public Functions

virtual Expression::Ptr expressionVariable (const VariableSlotID slotNumber) const
 
virtual ItemCacheCellitemCacheCell (const VariableSlotID slot)
 
virtual ItemSequenceCacheCell::VectoritemSequenceCacheCells (const VariableSlotID slot)
 
virtual Item::Iterator::Ptr positionIterator (const VariableSlotID slot) const
 
virtual Item rangeVariable (const VariableSlotID slotNumber) const
 
virtual void setExpressionVariable (const VariableSlotID slotNumber, const Expression::Ptr &newValue)
 
virtual void setPositionIterator (const VariableSlotID slot, const Item::Iterator::Ptr &newValue)
 
virtual void setRangeVariable (const VariableSlotID slotNumber, const Item &newValue)
 
template<typename VectorType , typename UnitType >
void setSlotVariable (const VariableSlotID slot, const UnitType &newValue, VectorType &container) const
 
 StackContextBase ()
 
 StackContextBase (const DynamicContext::Ptr &prevContext)
 
virtual DynamicContext::TemplateParameterHashtemplateParameterStore ()
 

Protected Functions

template<typename VectorType , typename UnitType >
void setSlotVariable (const VariableSlotID slot, const UnitType &newValue, VectorType &container) const
 

Properties

Expression::Vector m_expressionVariables
 
ItemCacheCell::Vector m_itemCacheCells
 
ItemSequenceCacheCell::Vector m_itemSequenceCacheCells
 
Item::Iterator::Vector m_positionIterators
 
Item::Vector m_rangeVariables
 
DynamicContext::TemplateParameterHash m_templateParameterStore
 

Detailed Description

template<typename TSuperClass>
class QPatternist::StackContextBase< TSuperClass >

Base class for all DynamicContext classes that needs to supply variables. It has a new frame for local caches, position iterators, expressions, range variables, template parameters but notably continues to delegate global caches.

Author
Frans Englich frans.nosp@m..eng.nosp@m.lich@.nosp@m.noki.nosp@m.a.com

Definition at line 76 of file qstackcontextbase_p.h.

Constructors and Destructors

◆ StackContextBase() [1/2]

template<typename TSuperClass >
QPatternist::StackContextBase< TSuperClass >::StackContextBase ( )

Definition at line 49 of file qstackcontextbase.cpp.

49  : m_rangeVariables(10),
54 {
55  /* The m_* containers are initialized with default sizes. Estimated guesses on usage patterns. */
56 }
ItemCacheCell::Vector m_itemCacheCells
Item::Iterator::Vector m_positionIterators
ItemSequenceCacheCell::Vector m_itemSequenceCacheCells
Expression::Vector m_expressionVariables

◆ StackContextBase() [2/2]

template<typename TSuperClass >
QPatternist::StackContextBase< TSuperClass >::StackContextBase ( const DynamicContext::Ptr prevContext)

Construct a StackContextBase and passes prevContext to its super class. This constructor is typically used when the super class is DelegatingDynamicContext.

Definition at line 59 of file qstackcontextbase.cpp.

60  : TSuperClass(prevContext),
61  m_rangeVariables(10),
66 {
67  Q_ASSERT(prevContext);
68 }
ItemCacheCell::Vector m_itemCacheCells
Item::Iterator::Vector m_positionIterators
ItemSequenceCacheCell::Vector m_itemSequenceCacheCells
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
Expression::Vector m_expressionVariables

Functions

◆ expressionVariable()

template<typename TSuperClass >
Expression::Ptr QPatternist::StackContextBase< TSuperClass >::expressionVariable ( const VariableSlotID  slotNumber) const
virtual

Definition at line 97 of file qstackcontextbase.cpp.

98 {
101  return m_expressionVariables.at(slot);
102 }
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
Expression::Vector m_expressionVariables
const T & at(int i) const
Returns the item at index position i in the vector.
Definition: qvector.h:350
int size() const
Returns the number of items in the vector.
Definition: qvector.h:137

◆ itemCacheCell()

template<typename TSuperClass >
ItemCacheCell & QPatternist::StackContextBase< TSuperClass >::itemCacheCell ( const VariableSlotID  slot)
virtual

Definition at line 71 of file qstackcontextbase.cpp.

72 {
73  if(slot >= m_itemCacheCells.size())
75 
76  return m_itemCacheCells[slot];
77 }
ItemCacheCell::Vector m_itemCacheCells
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
Definition: qglobal.h:1217
void resize(int size)
Sets the size of the vector to size.
Definition: qvector.h:342
int size() const
Returns the number of items in the vector.
Definition: qvector.h:137

◆ itemSequenceCacheCells()

template<typename TSuperClass >
ItemSequenceCacheCell::Vector & QPatternist::StackContextBase< TSuperClass >::itemSequenceCacheCells ( const VariableSlotID  slot)
virtual

Definition at line 80 of file qstackcontextbase.cpp.

81 {
82  if(slot >= m_itemSequenceCacheCells.size())
84 
86 }
ItemSequenceCacheCell::Vector m_itemSequenceCacheCells
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
Definition: qglobal.h:1217
void resize(int size)
Sets the size of the vector to size.
Definition: qvector.h:342
int size() const
Returns the number of items in the vector.
Definition: qvector.h:137

◆ positionIterator()

template<typename TSuperClass >
Item::Iterator::Ptr QPatternist::StackContextBase< TSuperClass >::positionIterator ( const VariableSlotID  slot) const
virtual

Definition at line 105 of file qstackcontextbase.cpp.

106 {
108  return m_positionIterators.at(slot);
109 }
Item::Iterator::Vector m_positionIterators
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
const T & at(int i) const
Returns the item at index position i in the vector.
Definition: qvector.h:350
int size() const
Returns the number of items in the vector.
Definition: qvector.h:137

◆ rangeVariable()

template<typename TSuperClass >
Item QPatternist::StackContextBase< TSuperClass >::rangeVariable ( const VariableSlotID  slotNumber) const
virtual

Definition at line 89 of file qstackcontextbase.cpp.

90 {
91  Q_ASSERT(slot < m_rangeVariables.size());
93  return m_rangeVariables.at(slot);
94 }
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
const T & at(int i) const
Returns the item at index position i in the vector.
Definition: qvector.h:350
int size() const
Returns the number of items in the vector.
Definition: qvector.h:137

◆ setExpressionVariable()

template<typename TSuperClass >
void QPatternist::StackContextBase< TSuperClass >::setExpressionVariable ( const VariableSlotID  slotNumber,
const Expression::Ptr newValue 
)
virtual

Definition at line 135 of file qstackcontextbase.cpp.

137 {
138  setSlotVariable(slot, newValue, m_expressionVariables);
139 }
Expression::Vector m_expressionVariables
void setSlotVariable(const VariableSlotID slot, const UnitType &newValue, VectorType &container) const

◆ setPositionIterator()

template<typename TSuperClass >
void QPatternist::StackContextBase< TSuperClass >::setPositionIterator ( const VariableSlotID  slot,
const Item::Iterator::Ptr newValue 
)
virtual

Definition at line 142 of file qstackcontextbase.cpp.

144 {
145  setSlotVariable(slot, newValue, m_positionIterators);
146 }
Item::Iterator::Vector m_positionIterators
void setSlotVariable(const VariableSlotID slot, const UnitType &newValue, VectorType &container) const

◆ setRangeVariable()

template<typename TSuperClass >
void QPatternist::StackContextBase< TSuperClass >::setRangeVariable ( const VariableSlotID  slotNumber,
const Item newValue 
)
virtual

Definition at line 128 of file qstackcontextbase.cpp.

130 {
131  setSlotVariable(slot, newValue, m_rangeVariables);
132 }
void setSlotVariable(const VariableSlotID slot, const UnitType &newValue, VectorType &container) const

◆ setSlotVariable() [1/2]

template<typename TSuperClass >
template<typename VectorType , typename UnitType >
void QPatternist::StackContextBase< TSuperClass >::setSlotVariable ( const VariableSlotID  slot,
const UnitType &  newValue,
VectorType &  container 
) const
inlineprotected

This function is protected, although it only is used in this class. I don't know why it has to be, but it won't compile when private.

Definition at line 115 of file qstackcontextbase_p.h.

◆ setSlotVariable() [2/2]

template<typename TSuperClass>
template<typename VectorType , typename UnitType >
void QPatternist::StackContextBase< TSuperClass >::setSlotVariable ( const VariableSlotID  slot,
const UnitType &  newValue,
VectorType &  container 
) const
inline

Definition at line 114 of file qstackcontextbase.cpp.

117 {
118  if(slot < container.size())
119  container.replace(slot, newValue);
120  else
121  {
122  container.resize(slot + 1);
123  container.replace(slot, newValue);
124  }
125 }

◆ templateParameterStore()

template<typename TSuperClass >
DynamicContext::TemplateParameterHash & QPatternist::StackContextBase< TSuperClass >::templateParameterStore ( )
virtual

Definition at line 149 of file qstackcontextbase.cpp.

150 {
152 }
DynamicContext::TemplateParameterHash m_templateParameterStore

Properties

◆ m_expressionVariables

template<typename TSuperClass>
Expression::Vector QPatternist::StackContextBase< TSuperClass >::m_expressionVariables
private

Definition at line 115 of file qstackcontextbase_p.h.

◆ m_itemCacheCells

template<typename TSuperClass>
ItemCacheCell::Vector QPatternist::StackContextBase< TSuperClass >::m_itemCacheCells
private

Definition at line 117 of file qstackcontextbase_p.h.

◆ m_itemSequenceCacheCells

template<typename TSuperClass>
ItemSequenceCacheCell::Vector QPatternist::StackContextBase< TSuperClass >::m_itemSequenceCacheCells
private

Definition at line 118 of file qstackcontextbase_p.h.

◆ m_positionIterators

template<typename TSuperClass>
Item::Iterator::Vector QPatternist::StackContextBase< TSuperClass >::m_positionIterators
private

Definition at line 116 of file qstackcontextbase_p.h.

◆ m_rangeVariables

template<typename TSuperClass>
Item::Vector QPatternist::StackContextBase< TSuperClass >::m_rangeVariables
private

Definition at line 114 of file qstackcontextbase_p.h.

◆ m_templateParameterStore

template<typename TSuperClass>
DynamicContext::TemplateParameterHash QPatternist::StackContextBase< TSuperClass >::m_templateParameterStore
private

Definition at line 119 of file qstackcontextbase_p.h.


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