Krita Source Code Documentation
Loading...
Searching...
No Matches
FormulaTokenStack Class Reference
+ Inheritance diagram for FormulaTokenStack:

Public Member Functions

 FormulaTokenStack ()
 
bool isEmpty () const
 
unsigned itemCount () const
 
FormulaToken pop ()
 
void push (const FormulaToken &token)
 
const FormulaTokentop ()
 
const FormulaTokentop (unsigned index)
 

Private Member Functions

void ensureSpace ()
 

Private Attributes

unsigned topIndex
 

Detailed Description

Definition at line 37 of file EnhancedPathFormula.cpp.

Constructor & Destructor Documentation

◆ FormulaTokenStack()

FormulaTokenStack::FormulaTokenStack ( )
inline

Definition at line 40 of file EnhancedPathFormula.cpp.

References ensureSpace().

Member Function Documentation

◆ ensureSpace()

void FormulaTokenStack::ensureSpace ( )
inlineprivate

Definition at line 76 of file EnhancedPathFormula.cpp.

77 {
78 while ((int) topIndex >= size()) {
79 resize(size() + 10);
80 }
81 }
int size(const Forest< T > &forest)
Definition KisForest.h:1232

References topIndex.

◆ isEmpty()

bool FormulaTokenStack::isEmpty ( ) const
inline

Definition at line 46 of file EnhancedPathFormula.cpp.

47 {
48 return topIndex == 0;
49 }

References topIndex.

◆ itemCount()

unsigned FormulaTokenStack::itemCount ( ) const
inline

Definition at line 50 of file EnhancedPathFormula.cpp.

51 {
52 return topIndex;
53 }

References topIndex.

◆ pop()

FormulaToken FormulaTokenStack::pop ( )
inline

Definition at line 59 of file EnhancedPathFormula.cpp.

60 {
61 return (topIndex > 0) ? FormulaToken(at(--topIndex)) : FormulaToken();
62 }

References topIndex.

◆ push()

void FormulaTokenStack::push ( const FormulaToken & token)
inline

Definition at line 54 of file EnhancedPathFormula.cpp.

55 {
57 insert(topIndex++, token);
58 }

References ensureSpace(), and topIndex.

◆ top() [1/2]

const FormulaToken & FormulaTokenStack::top ( )
inline

Definition at line 63 of file EnhancedPathFormula.cpp.

64 {
65 return top(0);
66 }
const FormulaToken & top()

References top().

◆ top() [2/2]

const FormulaToken & FormulaTokenStack::top ( unsigned index)
inline

Definition at line 67 of file EnhancedPathFormula.cpp.

68 {
69 static FormulaToken null;
70 if (topIndex > index) {
71 return at(topIndex - index - 1);
72 }
73 return null;
74 }

References topIndex.

Member Data Documentation

◆ topIndex

unsigned FormulaTokenStack::topIndex
private

Definition at line 82 of file EnhancedPathFormula.cpp.


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