Calculator
Extensible stack-based calculator primarily in library form
Calculator::StackItem Class Referenceabstract

Base class of all items that can be on the stack. More...

#include <StackItem.h>

Inheritance diagram for Calculator::StackItem:
Collaboration diagram for Calculator::StackItem:

Public Types

typedef std::shared_ptr< StackItemPtr
 
- Public Types inherited from Calculator::StackOperator
typedef std::shared_ptr< StackOperatorPtr
 

Public Member Functions

virtual ~StackItem ()
 
virtual Result operator() (Stack &stack, StackOperator::Ptr ofThis)
 Execute this item modifying stack. More...
 
virtual std::string toString () const =0
 
- Public Member Functions inherited from Calculator::StackOperator
virtual ~StackOperator ()
 

Protected Member Functions

 StackItem ()=default
 
 StackItem (const StackItem &)=delete
 
 StackItem (StackItem &&)=delete
 
StackItemoperator= (const StackItem &)=delete
 
StackItemoperator= (StackItem &&)=delete
 
- Protected Member Functions inherited from Calculator::StackOperator
 StackOperator ()=default
 
 StackOperator (const StackOperator &)=delete
 
 StackOperator (StackOperator &&)=delete
 
StackOperatoroperator= (const StackOperator &)=delete
 
StackOperatoroperator= (StackOperator &&)=delete
 

Detailed Description

Base class of all items that can be on the stack.

Definition at line 28 of file StackItem.h.

Member Typedef Documentation

◆ Ptr

typedef std::shared_ptr<StackItem> Calculator::StackItem::Ptr
Examples
StackReadingExample.cpp.

Definition at line 30 of file StackItem.h.

Constructor & Destructor Documentation

◆ ~StackItem()

Calculator::StackItem::~StackItem ( )
virtual

Definition at line 24 of file StackItem.cpp.

◆ StackItem() [1/3]

Calculator::StackItem::StackItem ( )
protecteddefault

◆ StackItem() [2/3]

Calculator::StackItem::StackItem ( const StackItem )
protecteddelete

◆ StackItem() [3/3]

Calculator::StackItem::StackItem ( StackItem &&  )
protecteddelete

Member Function Documentation

◆ operator()()

Result Calculator::StackItem::operator() ( Stack stack,
StackOperator::Ptr  ofThis 
)
virtual

Execute this item modifying stack.

Parameters
stackto process on
ofThisthe StackOperator::Ptr for this object so that its info can be passed around.
Returns
Result from execution

Implements Calculator::StackOperator.

Definition at line 27 of file StackItem.cpp.

◆ operator=() [1/2]

StackItem& Calculator::StackItem::operator= ( const StackItem )
protecteddelete

◆ operator=() [2/2]

StackItem& Calculator::StackItem::operator= ( StackItem &&  )
protecteddelete

◆ toString()

virtual std::string Calculator::StackItem::toString ( ) const
pure virtual
Returns
string representation of this

Implemented in Calculator::Variable, and Calculator::Number.


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