Iterator over a Stack from top to bottom.
More...
#include <Stack.h>
Iterator over a Stack from top to bottom.
Definition at line 35 of file Stack.h.
◆ StackItemPtr
◆ Hint
Hint for accessing the value at an iterator.
Enumerator |
---|
DEREFERENCE_NEXT | Dereference the next read.
|
NO_DEREFERENCE_NEXT | Do not dereference the next read.
|
Definition at line 44 of file Stack.h.
◆ ~StackIterator()
Calculator::StackIterator::~StackIterator |
( |
| ) |
|
|
default |
◆ StackIterator() [1/4]
Calculator::StackIterator::StackIterator |
( |
std::shared_ptr< StackIteratorPimpl > |
thePimpl | ) |
|
Create with reference to the variables and the implementint iterator.
- Parameters
-
Definition at line 86 of file Stack.cpp.
◆ StackIterator() [2/4]
Calculator::StackIterator::StackIterator |
( |
| ) |
|
|
delete |
◆ StackIterator() [3/4]
Calculator::StackIterator::StackIterator |
( |
const StackIterator & |
rhs | ) |
|
◆ StackIterator() [4/4]
◆ addError() [1/2]
void Calculator::StackIterator::addError |
( |
const std::string & |
message | ) |
|
Add error message at current position.
- Parameters
-
message | describing the error |
Definition at line 158 of file Stack.cpp.
◆ addError() [2/2]
void Calculator::StackIterator::addError |
( |
unsigned int |
position, |
|
|
const std::string & |
message |
|
) |
| |
Add error message at position.
- Parameters
-
position | in the stack the error occurred |
message | describing the error |
Definition at line 154 of file Stack.cpp.
◆ as()
template<typename T >
auto Calculator::StackIterator::as |
( |
bool |
required = true | ) |
-> typename T::Ptr |
|
inline |
Convenience method to read the current value by operator->* (respecting the current hint) and return it to a T::Ptr by std::dynamic_pointer_cast.
If the cast fails, the returned value is empty
- Template Parameters
-
T | desired type to cast the value to |
- Parameters
-
required | if true, conversion failure is logged as a positional message in the Result. |
- Returns
- the current value from operator* as a T::Ptr, which may be empty if the cast failed
Definition at line 128 of file Stack.h.
◆ getPimpl()
StackIterator::PimplPtr Calculator::StackIterator::getPimpl |
( |
| ) |
|
- Returns
- the private implementation
Definition at line 162 of file Stack.cpp.
◆ getResult()
const Result & Calculator::StackIterator::getResult |
( |
| ) |
const |
- Returns
- Errors, such as conversion and variable, thus far, if any
Definition at line 150 of file Stack.cpp.
◆ noDereference()
- Returns
- the current item without dereferencing, ignoring the hint entirely
Definition at line 141 of file Stack.cpp.
◆ operator bool()
Calculator::StackIterator::operator bool |
( |
| ) |
const |
- Returns
- false if any errors have been reported, otherwise true
Definition at line 125 of file Stack.cpp.
◆ operator!=()
bool Calculator::StackIterator::operator!= |
( |
const StackIterator & |
rhs | ) |
const |
Return true if this iterator is not the same position as rhs.
- Parameters
-
rhs | to compare this iterator to |
- Returns
- false if this iterator and rhs refer to the same position, otherwise true
Definition at line 121 of file Stack.cpp.
◆ operator*()
- Returns
- the object at the current position as per the current hint and reset the hint for the next read to Hint::DEREFERENCE_NEXT
Definition at line 129 of file Stack.cpp.
◆ operator++() [1/2]
Pre-increment: Move to the next position away from the top.
- Returns
- this iterator
Definition at line 103 of file Stack.cpp.
◆ operator++() [2/2]
Post-increment: Move to the next position away from the top, but return the a copy of this iterator without the modification.
- Returns
- a copy of this iterator before the increment.
Definition at line 111 of file Stack.cpp.
◆ operator=() [1/2]
◆ operator=() [2/2]
◆ operator==()
bool Calculator::StackIterator::operator== |
( |
const StackIterator & |
rhs | ) |
const |
Return true if this iterator is the same position as rhs.
- Parameters
-
rhs | to compare this iterator to |
- Returns
- true if this iterator and rhs refer to the same position, otherwise false
Definition at line 117 of file Stack.cpp.
◆ setHint()
Set the current hint for reading the value to theHint.
- Parameters
-
theHint | to set the hint for the next read to |
- Returns
- this iterator
Definition at line 145 of file Stack.cpp.
The documentation for this class was generated from the following files: