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

StackItem representing a number. More...

#include <Number.h>

Inheritance diagram for Calculator::Number:
Collaboration diagram for Calculator::Number:

Public Types

typedef std::shared_ptr< NumberPtr
 
- 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 ~Number ()
 
float getValue () 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 Number::Ptr create (float theValue)
 Create with theValue to represent. More...
 

Protected Member Functions

 Number (float theValue)
 Create with theValue to represent. More...
 
 Number ()=delete
 
 Number (const Number &)=delete
 
 Number (Number &&)=delete
 
Numberoperator= (const Number &)=delete
 
Numberoperator= (Number &&)=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 number.

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

Definition at line 31 of file Number.h.

Member Typedef Documentation

◆ Ptr

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

Definition at line 33 of file Number.h.

Constructor & Destructor Documentation

◆ ~Number()

Calculator::Number::~Number ( )
virtual

Definition at line 38 of file Number.cpp.

◆ Number() [1/4]

Calculator::Number::Number ( float  theValue)
protected

Create with theValue to represent.

Parameters
theValueto be stored in this

Definition at line 41 of file Number.cpp.

◆ Number() [2/4]

Calculator::Number::Number ( )
protecteddelete

◆ Number() [3/4]

Calculator::Number::Number ( const Number )
protecteddelete

◆ Number() [4/4]

Calculator::Number::Number ( Number &&  )
protecteddelete

Member Function Documentation

◆ create()

Number::Ptr Calculator::Number::create ( float  theValue)
static

Create with theValue to represent.

Parameters
theValueto be stored in this
Returns
Number created
Examples
StackReadingExample.cpp.

Definition at line 34 of file Number.cpp.

◆ getValue()

float Calculator::Number::getValue ( ) const
Returns
the value this represents

Definition at line 46 of file Number.cpp.

◆ indef_type_string()

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

Definition at line 35 of file Number.h.

◆ operator=() [1/2]

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

◆ operator=() [2/2]

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

◆ toString()

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

Implements Calculator::StackItem.

Definition at line 50 of file Number.cpp.


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