24 class StackIteratorPimpl;
37 typedef std::shared_ptr<StackIteratorPimpl> PimplPtr;
97 operator bool()
const;
128 auto as(
bool required =
true) ->
typename T::Ptr {
129 typename T::Ptr asT = std::dynamic_pointer_cast<T, StackItem>(this->
operator*());
130 if(required && !asT) {
131 addError(std::string(
"Value is not ") + T::indef_type_string());
144 void addError(
unsigned int position,
const std::string& message);
150 void addError(
const std::string& message);
191 t = iter.template as<typename T::element_type>();
210 typedef std::shared_ptr<StackPimpl> PimplPtr;
211 typedef std::shared_ptr<StackItem> StackItemPtr;
262 void push(StackItemPtr item);
Collection of Result information for an operation.
Stack of values to process from.
Stack(Stack &&rhs)=delete
VariableSet & getVariables()
void push(StackItemPtr item)
Push item onto the stack.
Stack & operator=(Stack &&rhs)=delete
std::string toString() const
Create string representation of the current contents of the Stack.
void popAfter(StackIterator &iter)
Pop all items after iter on the Stack.
Stack(const Stack &rhs)=delete
void popAll()
Pop all items from the stack.
void reset()
Reset the stack including pop all variables and reset the variables.
Stack & operator=(const Stack &rhs)=delete
unsigned int Count
Count of StackItems.
Iterator over a Stack from top to bottom.
Hint
Hint for accessing the value at an iterator.
@ NO_DEREFERENCE_NEXT
Do not dereference the next read.
@ DEREFERENCE_NEXT
Dereference the next read.
auto as(bool required=true) -> typename T::Ptr
Convenience method to read the current value by operator->* (respecting the current hint) and return ...
bool operator!=(const StackIterator &rhs) const
Return true if this iterator is not the same position as rhs.
StackIterator & operator=(const StackIterator &)
StackIterator & operator=(StackIterator &&)=default
const Result & getResult() const
StackIterator & operator++()
Pre-increment: Move to the next position away from the top.
StackItemPtr noDereference()
bool operator==(const StackIterator &rhs) const
Return true if this iterator is the same position as rhs.
StackIterator & setHint(Hint theHint)
Set the current hint for reading the value to theHint.
StackIterator(StackIterator &&)=default
void addError(unsigned int position, const std::string &message)
Add error message at position.
std::shared_ptr< StackItem > StackItemPtr
Equivalent of StackItem::Ptr;.
All variables belonging to a Stack.
Container of Calculator resources.
StackIterator & operator>>(StackIterator &iter, StackIterator::Hint hint)
Set the iter's hint and return the iter.