Calculator
Extensible stack-based calculator primarily in library form
Calculator::Variable Class Reference

StackItem representing a variable. More...

#include <Variable.h>

Inheritance diagram for Calculator::Variable:
Collaboration diagram for Calculator::Variable:

Public Types

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

Public Member Functions

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

Static Public Member Functions

static const std::string indef_type_string ()
 
static Variable::Ptr create (const std::string &theName)
 Create with theName to represent. More...
 

Protected Member Functions

 Variable (const std::string &theName)
 Create with theName to represent. More...
 
 Variable ()=delete
 
 Variable (const Variable &)=delete
 
 Variable (Variable &&)=delete
 
Variableoperator= (const Variable &)=delete
 
Variableoperator= (Variable &&)=delete
 
- Protected Member Functions inherited from Calculator::StackItem
 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

StackItem representing a variable.

These are not re-used and the current value is not modified after creation.

Definition at line 29 of file Variable.h.

Member Typedef Documentation

◆ Ptr

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

Definition at line 31 of file Variable.h.

Constructor & Destructor Documentation

◆ ~Variable()

Calculator::Variable::~Variable ( )
virtual

Definition at line 28 of file Variable.cpp.

◆ Variable() [1/4]

Calculator::Variable::Variable ( const std::string &  theName)
protected

Create with theName to represent.

Parameters
theNameto be stored in this

Definition at line 31 of file Variable.cpp.

◆ Variable() [2/4]

Calculator::Variable::Variable ( )
protecteddelete

◆ Variable() [3/4]

Calculator::Variable::Variable ( const Variable )
protecteddelete

◆ Variable() [4/4]

Calculator::Variable::Variable ( Variable &&  )
protecteddelete

Member Function Documentation

◆ create()

Variable::Ptr Calculator::Variable::create ( const std::string &  theName)
static

Create with theName to represent.

Parameters
theNameto be stored in this
Returns
the Variable created
Examples
StackReadingExample.cpp.

Definition at line 24 of file Variable.cpp.

◆ getName()

const std::string & Calculator::Variable::getName ( ) const
Returns
the name of this Variable

Definition at line 36 of file Variable.cpp.

◆ indef_type_string()

static const std::string Calculator::Variable::indef_type_string ( )
inlinestatic

Definition at line 33 of file Variable.h.

◆ operator=() [1/2]

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

◆ operator=() [2/2]

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

◆ toString()

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

Implements Calculator::StackItem.

Definition at line 40 of file Variable.cpp.


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